Commit e6f88fe5 by wusiyi

feat: 入库单出库单优化

parent c17bd18e
...@@ -508,13 +508,11 @@ export function getBySkuAndWarehouseIdApi( ...@@ -508,13 +508,11 @@ export function getBySkuAndWarehouseIdApi(
warehouseId: number | string | undefined, warehouseId: number | string | undefined,
sku: string | null, sku: string | null,
) { ) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.post<never, BaseRespData<InterskuList[]>>(
'factoryWarehouseInventory/getBySkuAndWarehouseId', 'factoryWarehouseInventory/getBySkuAndWarehouseId',
{ {
params: { warehouseId,
warehouseId, sku,
sku,
},
}, },
) )
} }
......
...@@ -467,6 +467,13 @@ ...@@ -467,6 +467,13 @@
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
width="60"
align="center"
label="序号"
type="index"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center" align="center"
width="100" width="100"
label="SKU图片" label="SKU图片"
...@@ -1097,7 +1104,7 @@ const batchAddCommodity = async (sku: string): Promise<InterskuList[]> => { ...@@ -1097,7 +1104,7 @@ const batchAddCommodity = async (sku: string): Promise<InterskuList[]> => {
interface InterImportData { interface InterImportData {
warehouseSku: string warehouseSku: string
remark?: string | null remark?: string | null
buyStored?: string | number | null | object // 扩大 buyStored 类型,以兼容原始数据 outCount?: string | number | null | object // 扩大 outCount 类型,以兼容原始数据
[propName: string]: string | number | boolean | undefined | unknown [propName: string]: string | number | boolean | undefined | unknown
} }
// 前端导入Excel // 前端导入Excel
...@@ -1105,7 +1112,7 @@ const excelFieldMap: Record<string, keyof InterImportData> = { ...@@ -1105,7 +1112,7 @@ const excelFieldMap: Record<string, keyof InterImportData> = {
// SKU图片: 'skuImage', // SKU图片: 'skuImage',
库存SKU: 'warehouseSku', 库存SKU: 'warehouseSku',
// SKU名称: 'skuName', // SKU名称: 'skuName',
// 出库数量: 'outCount', 出库数量: 'outCount',
// 可用库存数量: 'usableInventory', // 可用库存数量: 'usableInventory',
// '成本价(¥)': 'costPrice', // '成本价(¥)': 'costPrice',
// '总成本(¥)': 'totalPrice', // '总成本(¥)': 'totalPrice',
...@@ -1136,8 +1143,8 @@ const handleLocalImport = async ({ ...@@ -1136,8 +1143,8 @@ const handleLocalImport = async ({
: value === null || value === undefined : value === null || value === undefined
? null ? null
: String(value) : String(value)
} else if (field === 'buyStored') { } else if (field === 'outCount') {
// 处理 buyStored: 确保它是一个数字、数字字符串,否则设置为 null // 处理 outCount: 确保它是一个数字、数字字符串,否则设置为 null
if (typeof value === 'number') { if (typeof value === 'number') {
obj[field] = String(value) // 将数字转换为字符串 obj[field] = String(value) // 将数字转换为字符串
} else if (typeof value === 'string' && !isNaN(Number(value))) { } else if (typeof value === 'string' && !isNaN(Number(value))) {
...@@ -1180,18 +1187,19 @@ const handleLocalImport = async ({ ...@@ -1180,18 +1187,19 @@ const handleLocalImport = async ({
) )
let outCountValueForBigNumber: string | number = '0' // 初始化为安全默认值 let outCountValueForBigNumber: string | number = '0' // 初始化为安全默认值
console.log(importedItem)
if ( if (
importedItem?.buyStored !== null && importedItem?.outCount !== null &&
importedItem?.buyStored !== undefined importedItem?.outCount !== undefined
) { ) {
if ( if (
typeof importedItem.buyStored === 'string' && typeof importedItem.outCount === 'string' &&
!isNaN(Number(importedItem.buyStored)) !isNaN(Number(importedItem.outCount))
) { ) {
outCountValueForBigNumber = importedItem.buyStored outCountValueForBigNumber = importedItem.outCount
} else if (typeof importedItem.buyStored === 'number') { } else if (typeof importedItem.outCount === 'number') {
outCountValueForBigNumber = importedItem.buyStored outCountValueForBigNumber = importedItem.outCount
} else { } else {
// 如果是对象或其他意外类型,则默认为 '0' // 如果是对象或其他意外类型,则默认为 '0'
outCountValueForBigNumber = '0' outCountValueForBigNumber = '0'
......
...@@ -490,6 +490,13 @@ ...@@ -490,6 +490,13 @@
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
width="60"
align="center"
label="序号"
type="index"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center" align="center"
width="100" width="100"
label="SKU图片" label="SKU图片"
...@@ -1706,10 +1713,10 @@ const fetchLocationList = async (query: string) => { ...@@ -1706,10 +1713,10 @@ const fetchLocationList = async (query: string) => {
} }
}) })
if (otherPurchaseData.value?.length > 0) { if (otherPurchaseData.value?.length > 0) {
//const importedSkus = otherPurchaseData.value.map((item) => item.warehouseSku).join(',') //const importedSkus = otherPurchaseData.value.map((item) => item.warehouseSku).join(',')
// // 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU // // 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
// const filteredSkusList = await batchAddCommodity(importedSkus) // const filteredSkusList = await batchAddCommodity(importedSkus)
// console.log('filteredSkusList', otherPurchaseData.value) // console.log('filteredSkusList', otherPurchaseData.value)
// 新增时切换仓库将重新匹配表格库位,确保该商品的库位和仓库一一对应 // 新增时切换仓库将重新匹配表格库位,确保该商品的库位和仓库一一对应
otherPurchaseData.value = otherPurchaseData.value.map( otherPurchaseData.value = otherPurchaseData.value.map(
(item: InterProductList) => { (item: 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