Commit e90405ab by zhuzhequan

Merge branch 'dev_ware_in' into 'release'

Dev ware in

See merge request !151
parents ef266d5b 6f560892
......@@ -439,6 +439,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,
......@@ -702,6 +717,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[]>>(
......
......@@ -61,6 +61,8 @@ export interface InterWarehouseBase {
export interface InterWarehousePage extends InterWarehouseBase { }
// 子表列表ts
export interface InterWarehouseDetail extends InterWarehouseBase {
currencyName?:string
currencyCode?:string
productList: InterProductList[]
}
export interface ExportInWarehouseInfo extends warehouseSearchForm {
......@@ -88,7 +90,7 @@ export interface InterProductList {
remark?: string | null
skuImage?: string
skuName?: string
costPrice?: number | null
costPrice?: number | null | undefined
totalPrice?: number | null
updateTime?: string
warehouseSku?: string
......@@ -102,7 +104,13 @@ export interface InterskuList {
id?: number
productId?: number
sku?: string
userMark?: string
customerId?: string
customerName?: string
skuName?: string
productName?: string
skuImage?: string
costPrice?: undefined | null | number
image?: string
factoryPrice?: number | null
productNo?: string | null //货号
......
......@@ -554,7 +554,7 @@ const renderItemBox = (bool: boolean) => {
parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3]
: parts.length > 1
? parts[1]
? currentCode
: parts[0]
}
......
......@@ -1511,7 +1511,7 @@
<span class="goods-item-info-item-label"
>申报重量(g):</span
>
<span :title="item.customsWeight" class="goods-item-info-item-value">
<span :title="item.customsWeight" class="goods-item-info-item-value">
{{ item.customsWeight }}
</span>
</div>
......@@ -6226,7 +6226,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 {
......
......@@ -272,6 +272,7 @@
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
v-if="nodeCode === 'PENDING_SUBMIT'"
width="100"
......@@ -386,6 +387,13 @@
prop="remark"
/>
<ElTableColumn
label="所属客户"
show-overflow-tooltip
prop="userMark"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
label="创建时间"
......@@ -604,6 +612,12 @@
<ElTableColumn
show-overflow-tooltip
align="center"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
label="备注"
prop="remark"
......@@ -624,7 +638,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="skuData" height="100%" border>
<ElTableColumn
......@@ -687,6 +701,12 @@
prop="locationCode"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
width="80"
align="center"
header-align="center"
......@@ -1266,6 +1286,11 @@ const handleLocalImport = async ({
return {
skuImage: skuItem.image,
customerId: skuItem.customerId,
userMark: skuItem.userMark,
customerName: skuItem.customerName,
currencyName: skuItem.currencyName,
currencyCode: skuItem.currencyCode,
warehouseSku: skuItem.warehouseSku,
skuName: skuItem.skuName,
productNo: skuItem.productNumber,
......@@ -1386,8 +1411,11 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值
const {
locationCode = '',
customerId = '',
customerName = '',
price = null,
productNo = '',
userMark = '',
warehouseSku = '',
skuName = '',
image = '',
......@@ -1413,8 +1441,11 @@ const skudblclick = (val: InterskuList) => {
{
skuImage: image,
warehouseSku,
customerId,
customerName,
skuName,
productNo,
userMark,
locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? null, // 确保空值处理
costPrice: price,
......@@ -1750,6 +1781,11 @@ const submitPurchase = async () => {
const mergedProductList = filteredSkusList.map((skuItem) => {
return {
skuImage: skuItem.image,
customerId: skuItem.customerId,
userMark: skuItem.userMark,
customerName: skuItem.customerName,
currencyName: skuItem.currencyName,
currencyCode: skuItem.currencyCode,
warehouseSku: skuItem.warehouseSku,
skuName: skuItem.skuName,
productNo: skuItem.productNumber,
......
......@@ -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>
......@@ -340,7 +340,9 @@
label="库存SKU"
width="180"
prop="warehouseSku"
/>
>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
......@@ -389,6 +391,12 @@
<ElTableColumn
show-overflow-tooltip
align="center"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
label="备注"
prop="remark"
......@@ -457,6 +465,12 @@
:close-on-click-modal="false"
>
<div class="import-dialog">
<div class="label" style="margin-bottom: 10px">
<span style="margin-right: 10px">所属客户:</span>
<el-select v-model="importUserMark" 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 class="import-content">
<UploadExcel
v-model="importedFileUrl"
......@@ -471,7 +485,7 @@
<ElDialog
v-model="newDialogVisible"
:title="formId ? '编辑' : '新增'"
width="80%"
width="85%"
:close-on-click-modal="false"
>
<div class="dialog-form">
......@@ -547,13 +561,16 @@
<ElTableColumn
show-overflow-tooltip
align="center"
width="140"
label="库存SKU"
prop="warehouseSku"
/>
>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
width="160"
label="商品名称"
prop="skuName"
/>
......@@ -614,9 +631,15 @@
</template>
</ElTableColumn>
<ElTableColumn
align="center"
width="100"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
width="140"
label="备注"
prop="remark"
>
......@@ -628,7 +651,11 @@
</div>
<template #footer>
<div class="product-dialog-footer">
<div>
<div style="display: flex;align-items: center">
<span style="margin-right: 10px;font-style:13px;color: gray">搜索:</span>
<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"
......@@ -636,7 +663,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
......@@ -654,15 +681,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
......@@ -670,7 +697,7 @@
align="center"
width="200"
label="库存SKU"
prop="sku"
prop="warehouseSku"
/>
<ElTableColumn
show-overflow-tooltip
......@@ -690,7 +717,7 @@
align="center"
label="成本价"
width="80"
prop="factoryPrice"
prop="costPrice"
/>
<ElTableColumn
show-overflow-tooltip
......@@ -699,6 +726,12 @@
prop="locationCode"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
width="80"
align="center"
header-align="center"
......@@ -838,6 +871,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"
......@@ -871,7 +910,6 @@ import {
getInRecordStatusTree,
warehouseInRecordListPageApi,
getWarehouseInRecordDetailApi,
getBySkuApi,
warehouseInfoGetAll,
getByWareHouseIdAndCodeApi,
addInRecordApi,
......@@ -884,7 +922,7 @@ import {
warehouseInfo,
InRecordBatchCheckPrintApi,
factoryWarehouseInventoryPrint,
warehouseInRecordExport,
warehouseInRecordExport, getLocalFactoryList, getBySkuAndUserMarkApi,
} from '@/api/warehouse'
import { filePath } from '@/api/axios.ts'
import BigNumber from 'bignumber.js'
......@@ -901,10 +939,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: [
{
......@@ -1024,6 +1066,9 @@ function getStartTime() {
return `${year}-${month}-${day} 00:00:00`
}
const selectSku = ref('')
const userMark = ref(0)
const batchUserMark = ref(0)
const importUserMark = ref(0)
const treeData = ref<InterWarehouseTree[]>()
const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
......@@ -1147,13 +1192,23 @@ async function handlePrintProductTag() {
window.open(filePath + res.message, '_blank')
}
const batchAddCommodity = async (sku: string): Promise<InterskuList[]> => {
const batchAddCommodity = async (sku: string,type:string): Promise<InterskuList[]> => {
if (!editForm.value.warehouseId) {
ElMessage.error('请选择仓库')
return []
}
try {
const res = await getBySkuApi(editForm.value.warehouseId, sku)
let userValue: string | number = ''
if(type==='1'){
userValue = userMark.value
}else if(type==='2'){
userValue = batchUserMark.value
}else if(type==='3'){
userValue = importUserMark.value
}
const item = userMarkList.value.find(e=>e.userId===userValue)
const user = userValue===0 ? null : item?.userMark
const res = await getBySkuAndUserMarkApi(editForm.value.warehouseId, sku,user)
const arr: InterskuList[] = res.data || []
const ids: Record<string, boolean> = {}
// 过滤掉商品列表已经加了的
......@@ -1242,7 +1297,7 @@ const handleLocalImport = async ({
// 2. 提取导入的 SKU 列表
const importedSkus = importedData.map((item) => item.warehouseSku).join(',')
// 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
const filteredSkusList = await batchAddCommodity(importedSkus) // 使用 await 等待结果
const filteredSkusList = await batchAddCommodity(importedSkus,'3') // 使用 await 等待结果
if (filteredSkusList.length === 0) {
ElMessage.warning('导入的商品SKU已存在或无效')
importedFileUrl.value = path
......@@ -1253,24 +1308,30 @@ const handleLocalImport = async ({
const mergedProductList = filteredSkusList.map((skuItem) => {
// 在导入数据中找到匹配的备注信息
const importedItem = importedData.find(
(item) => item.warehouseSku === skuItem.sku,
(item) => skuItem.warehouseSku?.includes(item.warehouseSku),
)
const target = locationList.value.find((item: InterProductList) => {
return item.locationCode == importedItem?.locationCode
})
const item = userMarkList.value.find(e=>e.userId===importUserMark.value)
return {
skuImage: skuItem.image,
warehouseSku: skuItem.sku,
skuName: skuItem.skuName,
customerId:importUserMark.value !== 0 ?importUserMark.value : null,
customerName: importUserMark.value !== 0 ? item?.userName || '' : null,
userMark: importUserMark.value !== 0 ? item?.userMark : null,
skuImage: skuItem.skuImage,
currencyName: skuItem.currencyName,
currencyCode: skuItem.currencyCode,
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,
......@@ -1348,7 +1409,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)
......@@ -1358,11 +1421,11 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值
const {
locationCode = '',
factoryPrice = null,
costPrice = null,
productNo = '',
sku = '',
skuName = '',
image = '',
warehouseSku = '',
productName = '',
skuImage = '',
locationId = null,
currencyName = '',
currencyCode = null,
......@@ -1377,16 +1440,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,
......@@ -1429,7 +1496,17 @@ 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) => {
await getUserMark()
if (i === 2) {
if (v) formId.value = v.id
if (v) getProduct(v.id)
......@@ -1437,6 +1514,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
// editForm.value = JSON.parse(JSON.stringify(v))
} else {
await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value))
resetEditForm()
const userJson = localStorage.getItem('user')
......@@ -1623,7 +1701,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 }
......@@ -1690,6 +1774,7 @@ const addPurchaseVisible = ref(false)
const purchaseTextarea = ref('')
const addPurchase = async () => {
addPurchaseVisible.value = true
batchUserMark.value = 0
purchaseTextarea.value = ''
}
const submitPurchase = async () => {
......@@ -1697,16 +1782,22 @@ const submitPurchase = async () => {
ElMessage.warning('请输入库存 SKU')
return
}
const filteredSkusList = await batchAddCommodity(purchaseTextarea.value)
const item = userMarkList.value.find(e=>e.userId===batchUserMark.value)
const filteredSkusList = await batchAddCommodity(purchaseTextarea.value,'2')
const mergedProductList = filteredSkusList.map((skuItem) => {
return {
skuImage: skuItem.image,
warehouseSku: skuItem.sku,
skuName: skuItem.skuName,
customerId:batchUserMark.value !== 0 ?batchUserMark.value : null,
customerName: batchUserMark.value !== 0 ? item?.userName || '' : null,
userMark: batchUserMark.value !== 0 ? item?.userMark : null,
skuImage: skuItem.skuImage,
warehouseSku: skuItem.warehouseSku,
currencyName: skuItem.currencyName,
currencyCode: skuItem.currencyCode,
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,
......@@ -1729,6 +1820,7 @@ const importedFileUrl = ref('')
const importData = async () => {
importDialogVisible.value = true
importedFileUrl.value = ''
importUserMark.value = 0
}
const handleBatchDelete = async () => {
if (!selections.value.length) {
......@@ -1759,6 +1851,10 @@ const searchDetail = async () => {
detailLoading.value = true
try {
const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
res.data.productList.forEach(item => {
item.currencyName = res.data.currencyName || ''
item.currencyCode = res.data.currencyCode || ''
})
detailList.value = res.data?.productList || []
} catch (e) {
console.error(e)
......
......@@ -12,7 +12,7 @@ import {
WarehouseWarning,
factoryWarehouseInventoryPrint,
exportWarehouseInfo,
loactionData,
loactionData, getLocalFactoryList,
} from '@/api/warehouse.ts'
import { AnyObject } from '@/types/api/warehouse'
import { ref, computed } from 'vue'
......@@ -20,12 +20,18 @@ import SplitDiv from '@/components/splitDiv/splitDiv.vue'
import { filePath } from '@/api/axios.ts'
import { useEnterKeyTrigger } from '@/utils/hooks/useEnterKeyTrigger.ts'
import { getInventoryLowerLimitApi } from '@/api/externalAuth'
interface UserMark{
userId: number | string
userMark: string
userName: string
}
import { LocationInfoGetAll } from '@/api/common'
const searchForm = ref({
warehouseId: '',
inventoryStart: '',
inventoryEnd: '',
userMark: '',
productNo: '',
skuName: '',
warehouseSku: '',
......@@ -38,6 +44,7 @@ const searchForm = ref({
occupyInventoryStart: '',
})
const warehouseList = ref<warehouseInfo[]>([])
const userMarkList = ref<UserMark[]>([])
const logList = ref<LogListData[]>([])
const selections = ref<WarehouseWarning[]>([])
const leftData = ref<WarehouseWarning[]>([])
......@@ -56,6 +63,13 @@ const isSameWarehouse = computed(() => {
const modifyLocationDialog = ref(false)
const modifyProductNoDialog = ref(false)
const modifyCustomSkuDialog = ref(false)
const getUserMark = async () => {
const {data} = await getLocalFactoryList()
userMarkList.value = [
...[{userMark:'九猫商品', userId: 'JMP',userName:''}],
...data
]
}
/** 修改库位 */
const locationForm = ref({
......@@ -351,6 +365,7 @@ const getInventoryLowerLimit = async () => {
}
onMounted(async () => {
getData()
getUserMark()
getWarehouse()
getInventoryLowerLimit()
})
......@@ -387,6 +402,7 @@ onMounted(async () => {
prop="productNo"
label="款号 "
></el-table-column>
<el-table-column align="center" prop="number" label="打印数量">
<template #default="{ row }">
<el-input
......@@ -407,10 +423,11 @@ onMounted(async () => {
</el-dialog>
<el-card>
<el-form
ref="searchFormRef"
class="search-form"
inline
label-width="80px"
:model="searchForm"
ref="searchFormRef"
>
<el-form-item label="仓库">
<el-select
......@@ -418,7 +435,7 @@ onMounted(async () => {
clearable
filterable
placeholder="请输入仓库"
style="width: 140px"
style="width: 175px"
>
<el-option
v-for="item in warehouseList"
......@@ -497,8 +514,21 @@ onMounted(async () => {
clearable
></el-input>
</el-form-item>
<el-form-item label="所属客户">
<el-select
v-model="searchForm.userMark"
clearable
filterable
placeholder="请输入所属客户"
style="width: 140px"
>
<el-option
v-for="user in userMarkList" :key="user.userMark" :label="user.userMark" :value="user.userMark==='九猫商品'?'JMP':user.userMark"
></el-option>
</el-select>
</el-form-item>
<el-form-item style="margin-top: 5px">
<el-button type="primary" @click="getData" ref="searchBtnRef"
<el-button ref="searchBtnRef" type="primary" @click="getData"
>查询</el-button
>
</el-form-item>
......@@ -618,6 +648,11 @@ onMounted(async () => {
></el-table-column>
<el-table-column
align="center"
prop="userMark"
label="所属客户"
></el-table-column>
<el-table-column
align="center"
prop="unit"
label="单位"
width="60"
......
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