Commit e6f88fe5 by wusiyi

feat: 入库单出库单优化

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