Commit 84da97ca by zhuzhequan

功能提交

parent 430cbb36
......@@ -447,6 +447,21 @@ export function getBySkuApi(
},
)
}
export function getBySkuAndUserMarkApi(
warehouseId: number | string | undefined,
sku: string | null,
userMark: string | null | undefined,
) {
return axios.post<never, BaseRespData<InterskuList[]>>(
'factory/warehouseInRecord/getProductBySku',
{
warehouseId,
userMark,
sku,
},
)
}
export function getByWareHouseIdAndCodeApi(
wareHouseId: number | string | undefined,
code: string | null,
......@@ -710,6 +725,14 @@ export function scanBoxCodeApi(boxCode: string) {
},
)
}
// 备货计划 盘点
export function getLocalFactoryList() {
return axios.get<never, BaseRespData<never>>(
'dbDiyUser/getLocalFactoryList',
)
}
// 备货计划 打印箱贴
export function printBarcodeApi(data: { id: number, dataVersion: number }[]) {
return axios.post<never, BaseRespData<never[]>>(
......
......@@ -88,7 +88,7 @@ export interface InterProductList {
remark?: string | null
skuImage?: string
skuName?: string
costPrice?: number | null
costPrice?: number | null | string
totalPrice?: number | null
updateTime?: string
warehouseSku?: string
......@@ -103,6 +103,9 @@ export interface InterskuList {
productId?: number
sku?: string
skuName?: string
productName?: string
skuImage?: string
costPrice?: undefined | null | number
image?: string
factoryPrice?: number | null
productNo?: string | null //货号
......
......@@ -1458,14 +1458,14 @@
</el-button>
</div>
</div>
<div class="goods-item-info">
<div class="goods-item-info-item">
<span class="goods-item-info-item-label"
>英文报关名称:</span
>
<span class="goods-item-info-item-value">
<span :title="item.customsNameEnglish" class="goods-item-info-item-value">
{{ item.customsNameEnglish }}
</span>
</div>
......@@ -1473,7 +1473,7 @@
<span class="goods-item-info-item-label"
>中文报关名称:</span
>
<span class="goods-item-info-item-value">
<span :title="item.customsNameChinese" class="goods-item-info-item-value">
{{ item.customsNameChinese }}
</span>
</div>
......@@ -1481,7 +1481,7 @@
<span class="goods-item-info-item-label"
>申报重量(g):</span
>
<span class="goods-item-info-item-value">
<span :title="item.customsWeight" class="goods-item-info-item-value">
{{ item.customsWeight }}
</span>
</div>
......@@ -1489,7 +1489,7 @@
<span class="goods-item-info-item-label"
>申报价值($):</span
>
<span class="goods-item-info-item-value">
<span :title="item.customsValue" class="goods-item-info-item-value">
{{ item.customsValue }}
</span>
</div>
......@@ -6189,7 +6189,7 @@ const onUpdateCustomsDeclarationInfo = () => {
.goods-item {
display: grid;
// grid-template-columns: 100px 1fr minmax(150px, 1fr) 150px;
grid-template-columns: 100px 254px 1fr minmax(150px, 1fr) 150px 200px;
grid-template-columns: 100px 254px 1fr minmax(150px, 1fr) 220px 200px;
gap: 15px;
.goods-item-img {
......
......@@ -30,7 +30,7 @@
<splitDiv size="50">
<template #top>
<div class="header-filter-form">
<ElForm :model="searchForm" inline ref="searchFormRef">
<ElForm ref="searchFormRef" :model="searchForm" inline>
<ElFormItem label="采购仓库">
<ElSelect
v-model="searchForm.warehouseId"
......@@ -88,7 +88,7 @@
/>
</ElFormItem>
<ElFormItem>
<ElButton type="primary" @click="search" ref="searchBtnRef"
<ElButton ref="searchBtnRef" type="primary" @click="search"
>查询</ElButton
>
</ElFormItem>
......@@ -620,6 +620,9 @@
<template #footer>
<div class="product-dialog-footer">
<div>
<el-select v-model="userMark" size="small" style="width: 100px;">
<el-option v-for="user in userMarkList" :key="user.userId" :label="user.userMark" :value="user.userId"></el-option>
</el-select>
<el-input
v-model.trim="selectSku"
placeholder="库存SKU"
......@@ -627,7 +630,7 @@
clearable
size="small"
></el-input>
<el-popover placement="top-start" width="1000" trigger="click">
<el-popover placement="top-start" width="1200" trigger="click">
<div v-if="skuData.length > 0" style="height: 50vh">
<ElTable size="small" :data="filterSkuData" height="100%" border>
<ElTableColumn
......@@ -645,15 +648,15 @@
prop="image"
>
<template #default="{ row }">
<ImageView :src="row.image" width="40px" height="40px" />
<ImageView :src="row.skuImage" width="40px" height="40px" />
</template>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
label="库存SKU"
label="商品名称"
width="200"
prop="skuName"
prop="productName"
/>
<ElTableColumn
......@@ -661,7 +664,7 @@
align="center"
width="200"
label="库存SKU"
prop="sku"
prop="warehouseSku"
/>
<ElTableColumn
show-overflow-tooltip
......@@ -681,7 +684,7 @@
align="center"
label="成本价"
width="80"
prop="factoryPrice"
prop="costPrice"
/>
<ElTableColumn
show-overflow-tooltip
......@@ -690,6 +693,12 @@
prop="locationCode"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
width="80"
align="center"
header-align="center"
......@@ -829,6 +838,12 @@
width="500px"
:close-on-click-modal="false"
>
<div class="label" style="margin-bottom: 10px">
<span style="margin-right: 10px">所属客户:</span>
<el-select v-model="batchUserMark" size="small" style="width: 100px;">
<el-option v-for="user in userMarkList" :key="user.userId" :label="user.userMark" :value="user.userId"></el-option>
</el-select>
</div>
<div>
<el-input
v-model.trim="purchaseTextarea"
......@@ -864,7 +879,6 @@ import {
getInRecordStatusTree,
warehouseInRecordListPageApi,
getWarehouseInRecordDetailApi,
getBySkuApi,
warehouseInfoGetAll,
getByWareHouseIdAndCodeApi,
addInRecordApi,
......@@ -877,7 +891,7 @@ import {
warehouseInfo,
InRecordBatchCheckPrintApi,
factoryWarehouseInventoryPrint,
warehouseInRecordExport,
warehouseInRecordExport, getLocalFactoryList, getBySkuAndUserMarkApi,
} from '@/api/warehouse'
import { filePath } from '@/api/axios.ts'
import BigNumber from 'bignumber.js'
......@@ -894,10 +908,14 @@ import {
} from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue'
import UploadExcel from '@/components/UploadExcel.vue'
// import { debounce } from 'lodash-es'
import { useEnterKeyTrigger } from '@/utils/hooks/useEnterKeyTrigger.ts'
interface UserMark{
userId: number
userMark: string
userName: string
}
const warehouseList = ref<warehouseInfo[]>([])
const userMarkList = ref<UserMark[]>([])
const pickerOptions = {
shortcuts: [
{
......@@ -1017,6 +1035,8 @@ function getStartTime() {
return `${year}-${month}-${day} 00:00:00`
}
const selectSku = ref('')
const userMark = ref(0)
const batchUserMark = ref(0)
const treeData = ref<InterWarehouseTree[]>()
const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
......@@ -1142,7 +1162,9 @@ const batchAddCommodity = async (sku: string): Promise<InterskuList[]> => {
return []
}
try {
const res = await getBySkuApi(editForm.value.warehouseId, sku)
const item = userMarkList.value.find(e=>e.userId===userMark.value)
const user = userMark.value===0 ? null : item?.userMark
const res = await getBySkuAndUserMarkApi(editForm.value.warehouseId, sku,user)
const arr: InterskuList[] = res.data || []
const ids: Record<string, boolean> = {}
// 过滤掉商品列表已经加了的
......@@ -1247,19 +1269,23 @@ const handleLocalImport = async ({
const target = locationList.value.find((item: InterProductList) => {
return item.locationCode == importedItem?.locationCode
})
const item = userMarkList.value.find(e=>e.userId===userMark.value)
return {
skuImage: skuItem.image,
warehouseSku: skuItem.sku,
skuName: skuItem.skuName,
customerId:userMark.value !== 0 ?userMark.value : null,
customerName: userMark.value !== 0 ? item?.userName || '' : null,
userMark: userMark.value !== 0 ? item?.userMark : null,
skuImage: skuItem.skuImage,
warehouseSku: skuItem.warehouseSku,
skuName: skuItem.productName,
productNo: skuItem.productNo,
locationCode: target?.locationCode ?? '',
locationId: target?.locationId,
costPrice: skuItem.factoryPrice,
costPrice: skuItem.costPrice,
buyStored: importedItem?.buyStored ?? null,
totalPrice: new BigNumber(
(importedItem?.buyStored ?? 0) as number | string,
)
.multipliedBy(skuItem.factoryPrice ?? 0)
.multipliedBy(skuItem.costPrice ?? 0)
.toNumber(),
usableInventory: skuItem.usableInventory,
remark: importedItem?.remark ?? null,
......@@ -1337,7 +1363,9 @@ const skuData = ref<InterskuList[]>([])
const selectbySku = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
try {
const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value)
const item = userMarkList.value.find(e=>e.userId===userMark.value)
const user = userMark.value===0 ? null : item?.userMark
const res = await getBySkuAndUserMarkApi(editForm.value.warehouseId, selectSku.value,user)
skuData.value = res.data || []
} catch (e) {
console.error(e)
......@@ -1347,11 +1375,11 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值
const {
locationCode = '',
factoryPrice = null,
costPrice = null,
productNo = '',
sku = '',
skuName = '',
image = '',
warehouseSku = '',
productName = '',
skuImage = '',
locationId = null,
currencyName = '',
currencyCode = null,
......@@ -1366,16 +1394,20 @@ const skudblclick = (val: InterskuList) => {
return
}
}
const item = userMarkList.value.find(e=>e.userId===userMark.value)
otherPurchaseData.value = [
...otherPurchaseData.value,
...JSON.parse(JSON.stringify(otherPurchaseData.value)),
{
skuImage: image,
warehouseSku: sku,
skuName,
skuImage,
warehouseSku,
customerId:userMark.value !== 0 ?userMark.value : null,
customerName: userMark.value !== 0 ? item?.userName || '' : null,
userMark: userMark.value !== 0 ? item?.userMark : null,
skuName:productName,
productNo,
locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? null, // 确保空值处理
costPrice: factoryPrice,
costPrice,
buyStored: null,
totalPrice: null,
currencyName,
......@@ -1418,6 +1450,15 @@ const editFormRef = ref()
const editForm2 = ref({})
const formId = ref<number | undefined>(undefined)
const otherPurchaseData = ref<InterProductList[]>([])
const getUserMark = async () => {
const {data} = await getLocalFactoryList()
userMarkList.value = [
...[{userMark:'九猫商品', userId: 0,userName:''}],
...data
]
}
const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (i === 2) {
if (v) formId.value = v.id
......@@ -1426,6 +1467,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
// editForm.value = JSON.parse(JSON.stringify(v))
} else {
await nextTick()
await getUserMark()
editForm.value = JSON.parse(JSON.stringify(editForm2.value))
resetEditForm()
const userJson = localStorage.getItem('user')
......@@ -1601,7 +1643,13 @@ const addOtherCurrency = async () => {
const filterSkuData = computed(() => {
const skuList = otherPurchaseData.value.map((el) => el.warehouseSku)
// console.log(skuList, skuData.value)
return skuData.value.filter((el) => !skuList.includes(el.sku))
const item = userMarkList.value.find(u=>u.userId===userMark.value)
return skuData.value.filter((el) => !skuList.includes(el.warehouseSku)).map(e=>{
return {
...e,
userMark:userMark.value===0?'':item?.userMark
}
})
})
const addSection = async () => {
const params = { ...editForm.value }
......@@ -1668,6 +1716,7 @@ const addPurchaseVisible = ref(false)
const purchaseTextarea = ref('')
const addPurchase = async () => {
addPurchaseVisible.value = true
batchUserMark.value = 0
purchaseTextarea.value = ''
}
const submitPurchase = async () => {
......@@ -1675,16 +1724,20 @@ const submitPurchase = async () => {
ElMessage.warning('请输入库存 SKU')
return
}
const item = userMarkList.value.find(e=>e.userId===userMark.value)
const filteredSkusList = await batchAddCommodity(purchaseTextarea.value)
const mergedProductList = filteredSkusList.map((skuItem) => {
return {
skuImage: skuItem.image,
warehouseSku: skuItem.sku,
skuName: skuItem.skuName,
customerId:userMark.value !== 0 ?userMark.value : null,
customerName: userMark.value !== 0 ? item?.userName || '' : null,
userMark: userMark.value !== 0 ? item?.userMark : null,
skuImage: skuItem.skuImage,
warehouseSku: skuItem.warehouseSku,
skuName: skuItem.productName,
productNo: skuItem.productNo,
locationCode: skuItem.locationCode ?? '',
locationId: skuItem.locationId ?? null,
costPrice: skuItem.factoryPrice,
costPrice: skuItem.costPrice,
buyStored: null,
totalPrice: null,
usableInventory: skuItem.usableInventory,
......
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