Commit d0b4ff7e by wuqian

入库单按钮操作

parent ba93e883
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"vue": "^3.4.19", "vue": "^3.4.19",
"vue-dompurify-html": "^5.1.0", "vue-dompurify-html": "^5.1.0",
"vue-router": "^4.3.0", "vue-router": "^4.3.0",
"vue-tsc": "^2.1.10" "vue-tsc": "^2.1.10",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@types/splitpanes": "^2.2.6", "@types/splitpanes": "^2.2.6",
...@@ -2509,6 +2510,15 @@ ...@@ -2509,6 +2510,15 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmmirror.com/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/ajv": { "node_modules/ajv": {
"version": "6.12.6", "version": "6.12.6",
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
...@@ -2714,6 +2724,19 @@ ...@@ -2714,6 +2724,19 @@
} }
] ]
}, },
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chalk": { "node_modules/chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
...@@ -2754,6 +2777,15 @@ ...@@ -2754,6 +2777,15 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
...@@ -2800,6 +2832,18 @@ ...@@ -2800,6 +2832,18 @@
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
"dev": true "dev": true
}, },
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"license": "Apache-2.0",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz",
...@@ -3498,6 +3542,15 @@ ...@@ -3498,6 +3542,15 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
...@@ -4904,6 +4957,18 @@ ...@@ -4904,6 +4957,18 @@
"url": "https://github.com/sponsors/antoniandre" "url": "https://github.com/sponsors/antoniandre"
} }
}, },
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"license": "Apache-2.0",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/ssr-window": { "node_modules/ssr-window": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz",
...@@ -5501,12 +5566,51 @@ ...@@ -5501,12 +5566,51 @@
"resolved": "https://registry.npmjs.org/wildcard/-/wildcard-1.1.2.tgz", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-1.1.2.tgz",
"integrity": "sha512-DXukZJxpHA8LuotRwL0pP1+rS6CS7FF2qStDDE1C7DDg2rLud2PXRMuEDYIPhgEezwnlHNL4c+N6MfMTjCGTng==" "integrity": "sha512-DXukZJxpHA8LuotRwL0pP1+rS6CS7FF2qStDDE1C7DDg2rLud2PXRMuEDYIPhgEezwnlHNL4c+N6MfMTjCGTng=="
}, },
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true "dev": true
}, },
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/xml-name-validator": { "node_modules/xml-name-validator": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz", "resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"vue": "^3.4.19", "vue": "^3.4.19",
"vue-dompurify-html": "^5.1.0", "vue-dompurify-html": "^5.1.0",
"vue-router": "^4.3.0", "vue-router": "^4.3.0",
"vue-tsc": "^2.1.10" "vue-tsc": "^2.1.10",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@types/splitpanes": "^2.2.6", "@types/splitpanes": "^2.2.6",
......
...@@ -8,11 +8,11 @@ import { ...@@ -8,11 +8,11 @@ import {
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
InRecordEditForm,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData { export interface LogListData {
createTime: string createTime: string
description: string description: string
createdTime?: string | null
} }
export interface PrintData{ export interface PrintData{
code:string code:string
...@@ -274,8 +274,22 @@ export function warehouseInRecordListPageApi( ...@@ -274,8 +274,22 @@ export function warehouseInRecordListPageApi(
}, },
) )
} }
export function rejectInRecordApi({
export function addInRecordApi(form: InRecordEditForm) { ids,
rejectReason,
}: {
ids: string
rejectReason: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/turnDown',
{
ids,
rejectReason,
},
)
}
export function addInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/add', 'factory/warehouseInRecord/add',
{ {
...@@ -284,7 +298,7 @@ export function addInRecordApi(form: InRecordEditForm) { ...@@ -284,7 +298,7 @@ export function addInRecordApi(form: InRecordEditForm) {
) )
} }
export function updateInRecordApi(form: InRecordEditForm) { export function updateInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/update', 'factory/warehouseInRecord/update',
{ {
...@@ -292,8 +306,8 @@ export function updateInRecordApi(form: InRecordEditForm) { ...@@ -292,8 +306,8 @@ export function updateInRecordApi(form: InRecordEditForm) {
}, },
) )
} }
export function getWarehouseInRecordDetailApi(id: number) { export function getWarehouseInRecordDetailApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterWarehouseDetail[]>>( return axios.get<never, BaseRespData<InterWarehouseDetail>>(
'factory/warehouseInRecord/get', 'factory/warehouseInRecord/get',
{ {
params: { params: {
...@@ -302,7 +316,7 @@ export function getWarehouseInRecordDetailApi(id: number) { ...@@ -302,7 +316,7 @@ export function getWarehouseInRecordDetailApi(id: number) {
}, },
) )
} }
export function getBySkuApi(warehouseId: number, sku: string | null) { export function getBySkuApi(warehouseId: number | string, sku: string | null) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku', 'customProductItem/getBySku',
{ {
...@@ -314,7 +328,7 @@ export function getBySkuApi(warehouseId: number, sku: string | null) { ...@@ -314,7 +328,7 @@ export function getBySkuApi(warehouseId: number, sku: string | null) {
) )
} }
export function getByWareHouseIdAndCodeApi( export function getByWareHouseIdAndCodeApi(
wareHouseId: number, wareHouseId: number | string | undefined,
code: string | null, code: string | null,
) { ) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
...@@ -339,8 +353,8 @@ export function getWarehouseListApi() { ...@@ -339,8 +353,8 @@ export function getWarehouseListApi() {
) )
} }
interface WarehouseParams { interface WarehouseParams {
id: number id?: number
dataVersion: number dataVersion?: number
} }
export function auditOrderApi(url: string, data: WarehouseParams[]) { export function auditOrderApi(url: string, data: WarehouseParams[]) {
return axios.post(url, data) return axios.post(url, data)
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as XLSX from 'xlsx'
import { ref, watch, defineProps, defineEmits, computed } from 'vue' import { ref, watch, defineProps, defineEmits, computed } from 'vue'
import { UploadFilled, Document, Close } from '@element-plus/icons-vue' import { UploadFilled, Document, Close } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
...@@ -55,8 +56,9 @@ interface FileItem { ...@@ -55,8 +56,9 @@ interface FileItem {
} }
const props = defineProps<{ const props = defineProps<{
modelValue: string modelValue: string
importType: string
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue', 'imported'])
const fileList = ref<FileItem[]>([]) const fileList = ref<FileItem[]>([])
const fileInputRef = ref<HTMLInputElement | null>(null) const fileInputRef = ref<HTMLInputElement | null>(null)
...@@ -118,8 +120,27 @@ const onFileChange = async (e: Event) => { ...@@ -118,8 +120,27 @@ const onFileChange = async (e: Event) => {
ElMessage.error('文件大小不能超过50MB') ElMessage.error('文件大小不能超过50MB')
return return
} }
if (props.importType === 'local') {
// 本地解析
const reader = new FileReader()
reader.onload = (evt) => {
const data = evt.target?.result
const workbook = XLSX.read(data, { type: 'binary' })
const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]
const jsonData = XLSX.utils.sheet_to_json(worksheet)
//emit 路径和数据
emit('imported', { path: file.name, data: jsonData })
fileList.value = [{ path: file.name, filename: file.name }]
value.value = file.name || ''
ElMessage.success('导入成功')
}
reader.readAsBinaryString(file)
if (fileInputRef.value) fileInputRef.value.value = ''
return
}
// 走原有上传逻辑
await fileUpload(file) await fileUpload(file)
// 清空input
if (fileInputRef.value) fileInputRef.value.value = '' if (fileInputRef.value) fileInputRef.value.value = ''
} }
...@@ -132,7 +153,7 @@ const fileUpload = async (file: File) => { ...@@ -132,7 +153,7 @@ const fileUpload = async (file: File) => {
try { try {
const res = await uploadFileApi(formData) const res = await uploadFileApi(formData)
fileList.value = [{ path: res.message ?? '', filename }] fileList.value = [{ path: res.message ?? '', filename }]
value.value = res.message value.value = res.message ?? ''
ElMessage.success('导入成功') ElMessage.success('导入成功')
} catch (e) { } catch (e) {
ElMessage.error('上传失败') ElMessage.error('上传失败')
......
export interface warehouseSearchForm { export interface warehouseSearchForm {
status?: string billStatus?: string
batchNumber?: string batchNumber?: string
createTimeEnd?: string createTimeEnd?: string
createTimeStart?: string createTimeStart?: string
orderNumber?: string orderNumber?: string
sku?: string sku?: string
warehouseId?: number warehouseId?: number
id?: number
} }
export interface InterProductList { export interface InterProductList {
createTime?: string createTime?: string
...@@ -22,12 +23,13 @@ export interface InterProductList { ...@@ -22,12 +23,13 @@ export interface InterProductList {
warehouseSku?: string warehouseSku?: string
locationId?: number | null locationId?: number | null
locationCode?: string | null locationCode?: string | null
[propName: string]: string | number | boolean | undefined | unknown
} }
export interface InterWarehouseBase { export interface InterWarehouseBase {
id: number id?: number
factoryId?: number factoryId?: number
factoryCode?: string factoryCode?: string
warehouseId?: number warehouseId?: number | string
warehouseName?: string warehouseName?: string
inNo?: string inNo?: string
shipmentNumber?: string shipmentNumber?: string
...@@ -39,6 +41,7 @@ export interface InterWarehouseBase { ...@@ -39,6 +41,7 @@ export interface InterWarehouseBase {
dataVersion?: number dataVersion?: number
createTime?: string | null createTime?: string | null
updateTime?: string | null updateTime?: string | null
rejectReason?: string | null
} }
// 主表列表ts // 主表列表ts
export interface InterWarehousePage extends InterWarehouseBase {} export interface InterWarehousePage extends InterWarehouseBase {}
...@@ -47,12 +50,12 @@ export interface InterWarehouseDetail extends InterWarehouseBase { ...@@ -47,12 +50,12 @@ export interface InterWarehouseDetail extends InterWarehouseBase {
productList: InterProductList[] productList: InterProductList[]
} }
export interface InterWarehouseTree { export interface InterWarehouseTree {
id: number id?: number
code: string code?: string | null
name: string name?: string
countQuantity: string | null countQuantity?: string | null
children: null children: InterWarehouseTree[] | null
leaf: boolean leaf?: boolean
} }
export interface InterProductList { export interface InterProductList {
createTime?: string createTime?: string
...@@ -98,18 +101,3 @@ export interface ILocation { ...@@ -98,18 +101,3 @@ export interface ILocation {
locationId?: number | null locationId?: number | null
locationCode?: string | null locationCode?: string | null
} }
export interface InRecordEditForm {
id: number
factoryId?: number
factoryCode?: string
warehouseId?: number
warehouseName?: string
inNo?: string
shipmentNumber?: string
skuAmount?: string
total?: number
totalPrice?: number
billStatus?: string
remark?: string
productList?: InterProductList[]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment