Commit 2583792b by zhuzhequan

工厂端仓库

parent 90c52e7c
......@@ -15,7 +15,14 @@ export interface LogListData{
}
export interface PrintData{
code:string
list:{locationName:string,pickingLocation:string}[]
list:{
locationName:string,
pickingLocation?:string
skuName?:string
warehouseSku?:string
supplierItemNo?:string
number?:string
}[]
}
export interface factoryWarehouseInfo {
pageSize: number
......@@ -34,14 +41,16 @@ export interface WarehouseInventory {
skuName: string;
warehouseSku: string;
occupyInventory: string;
inventoryStart: string;
inventoryEnd: string;
productNumber: string;
freezeInventory: string;
inventory: string;
upperLimit: string;
usableInventoryStart: string;
usableInventoryEnd: string;
occupyInventoryEnd: string;
occupyInventoryStart: string;
floorLimit: string;
}
export interface UpdateDefaulted {
......@@ -68,6 +77,10 @@ export interface warehouseInfo {
export interface WarehouseWarning {
id: number | string;
locationCode: string;
skuName: string;
warehouseSku: string;
productNumber: string;
number: string;
locationName: string;
}
......@@ -153,12 +166,26 @@ export function factoryLogWarehouseLog(id: number | string | undefined) {
}
export function factoryWarehouseInfoPrint(data:PrintData) {
return axios.post<never, BaseRespData<LogListData[]>>(
return axios.post<never, BaseRespData<never[]>>(
'/factoryWarehouseInfo/print',
data
)
}
export function importWarehouseLocation(data:FormData) {
return axios.post<never, BaseRespData<never[]>>(
'/factoryWarehouseLocation/importWarehouseLocation',
data
)
}
export function factoryWarehouseInventoryPrint(data:PrintData) {
return axios.post<never, BaseRespData<never[]>>(
'/factoryWarehouseInventory/print',
data
)
}
export function createPositionApi(data: positionInfo) {
return axios.post<never, BaseRespData<never>>(
'/factoryWarehouseLocation/add',
......
......@@ -6,11 +6,18 @@ import {
warehouseInfoGetAll,
createPositionApi,
updatePositionApi,
positionInfo, deleteLocationApi, positionFormInfo, updatePositionStatusApi, factoryWarehouseInfoPrint,
positionInfo,
deleteLocationApi,
positionFormInfo,
updatePositionStatusApi,
factoryWarehouseInfoPrint,
importWarehouseLocation,
} from '@/api/warehouse.ts'
import { nextTick, ref } from 'vue'
import SplitDiv from '@/components/splitDiv/splitDiv.vue'
import { filePath } from '@/api/axios.ts'
const importLoading = ref(false)
const searchForm = ref({
warehouseId: '',
locationCode: '',
......@@ -95,24 +102,26 @@ const handleConfirm = async () => {
ElMessage.success('操作成功')
await getData()
}
async function printLocationTag() {
if(!selections.value.length) {
if (!selections.value.length) {
return ElMessage.warning('请选择数据')
}
const list = selections.value.map((item) => {
return {
locationName:item.locationName,
pickingLocation:item.locationCode,
locationName: item.locationCode,
pickingLocation: item.locationName,
}
})
const res = await factoryWarehouseInfoPrint({
list,
code:'PT001'
code: 'PT001',
})
console.log(res)
window.open(filePath + res.message, '_blank')
}
const handleBatchDelete = async (row: positionInfo | null) => {
if(!row && !selections.value.length){
if (!row && !selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
await ElMessageBox.confirm('确定要删除吗?', '提示', {
......@@ -125,6 +134,31 @@ const handleBatchDelete = async (row: positionInfo | null) => {
ElMessage.success('删除成功')
await getData()
}
const importLocation = async () => {
const i = document.createElement('input')
i.type = 'file'
i.style.display = 'none'
i.accept = '.xlsx,.xls'
i.click()
i.onchange = async () => {
if (i && i.files) {
importLoading.value = true
try {
console.log(i.files[0])
const formData = new FormData()
formData.append('importExcel', i.files[0])
await importWarehouseLocation(formData)
ElMessage.success('导入成功')
await getData()
} finally {
importLoading.value = false
}
}
}
}
const createWarehouse = () => {
createData.value.show = true
createData.value.isEdit = false
......@@ -213,6 +247,7 @@ getWarehouse()
<el-form-item>
<el-button type="primary" @click="getData">查询</el-button>
<el-button type="success" @click="createWarehouse">新增库位</el-button>
<el-button :loading="importLoading" type="primary" @click="importLocation">导入库位</el-button>
<el-button type="primary" @click="printLocationTag">打印库位标签</el-button>
<el-button type="danger" @click="handleBatchDelete(null)">删除</el-button>
</el-form-item>
......
......@@ -6,25 +6,26 @@ import {
getWarehouseInventoryInfo,
factoryLogWarehouseLog,
LogListData,
factoryWarehouseInfoPrint,
WarehouseWarning,
WarehouseWarning, factoryWarehouseInventoryPrint,
} from '@/api/warehouse.ts'
import { ref } from 'vue'
import SplitDiv from '@/components/splitDiv/splitDiv.vue'
import { filePath } from '@/api/axios.ts'
const searchForm = ref({
warehouseId: '',
inventoryStart: '',
inventoryEnd: '',
productNumber: '',
skuName: '',
warehouseSku: '',
occupyInventory: '',
freezeInventory: '',
inventory: '',
upperLimit: '',
usableInventoryStart: '',
usableInventoryEnd: '',
occupyInventoryEnd: '',
occupyInventoryStart: '',
floorLimit: '',
})
const warehouseList = ref<warehouseInfo[]>([])
const logList = ref<LogListData[]>([])
......@@ -35,7 +36,9 @@ const pagination = ref<factoryWarehouseInfo>({
currentPage: 1,
total: 0,
})
const showPrintDialog = ref(false)
const clickItem = (row: WarehouseWarning) => {
if (!row) return
getDetail(row.id)
}
......@@ -51,12 +54,45 @@ async function getData() {
}
}
async function handlePrintProductTag() {
const flag = selections.value.every(el => el.number && el.number != '0')
if (!flag) {
return ElMessage.warning('打印数量需大于0')
}
const list = selections.value.map((item) => {
return {
skuName: item.skuName,
warehouseSku: item.warehouseSku,
supplierItemNo: item.productNumber,
number: item.number,
locationName: item.locationCode,
}
})
const res = await factoryWarehouseInventoryPrint({
list,
code: 'PT002',
})
showPrintDialog.value = false
window.open(filePath + res.message, '_blank')
}
async function printProductTag() {
if (!selections.value.length) {
return ElMessage.warning('请选择数据')
}
showPrintDialog.value = true
selections.value.forEach(el => {
el.number = ''
})
}
const getDetail = async (id: number | string | undefined) => {
const { data } = await factoryLogWarehouseLog(id)
logList.value = data
}
const handleSelectionChange = (data: WarehouseWarning[]) => {
selections.value = data
selections.value = JSON.parse(JSON.stringify(data))
}
const handleSizeChange = (pageSize: number) => {
pagination.value.pageSize = pageSize
......@@ -78,6 +114,26 @@ getWarehouse()
<template>
<split-div>
<template #top>
<el-dialog v-model="showPrintDialog" title="打印参数设置">
<el-table height="400px" :data="selections" border>
<el-table-column width="60" align="center" type="index" label="序号"></el-table-column>
<el-table-column align="center" prop="skuName" label="商品名称"></el-table-column>
<el-table-column align="center" prop="warehouseSku" label="商品SKU"></el-table-column>
<el-table-column align="center" prop="locationCode" label="库位编码"></el-table-column>
<el-table-column align="center" prop="productNumber" label="货号 "></el-table-column>
<el-table-column align="center" prop="number" label="打印数量">
<template #default="{row}">
<el-input
v-model="row.number" oninput="value=value.replace(/[^\-?\d.]/g,'')" placeholder="打印数量"
clearable></el-input>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="showPrintDialog = false">取消</el-button>
<el-button type="primary" @click="handlePrintProductTag">打印</el-button>
</template>
</el-dialog>
<el-card>
<el-form class="search-form" inline :model="searchForm">
<el-form-item label="仓库">
......@@ -97,13 +153,18 @@ getWarehouse()
v-model="searchForm.skuName" style="width: 140px;" placeholder="请输入商品名称"
clearable></el-input>
</el-form-item>
<el-form-item label="货号">
<el-input
v-model="searchForm.productNumber" style="width: 140px;" placeholder="请输入货号"
clearable></el-input>
</el-form-item>
<el-form-item label="库存数">
<el-input
v-model="searchForm.upperLimit" style="width: 80px;margin-right: 5px" placeholder=""
v-model="searchForm.inventoryStart" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
-
<el-input
v-model="searchForm.floorLimit" style="width: 80px;margin-left: 5px" placeholder=""
v-model="searchForm.inventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
</el-form-item>
<el-form-item label="可用数">
......@@ -124,9 +185,12 @@ getWarehouse()
v-model="searchForm.occupyInventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
</el-form-item>
<el-form-item>
<el-form-item style="margin-top: 5px">
<el-button type="primary" @click="getData">查询</el-button>
</el-form-item>
<el-form-item style="margin-top: 5px">
<el-button type="primary" @click="printProductTag">打印商品SKU标签</el-button>
</el-form-item>
</el-form>
</el-card>
......@@ -144,25 +208,22 @@ getWarehouse()
<el-table-column align="center" fixed="left" type="index" label="序号" width="60" />
<el-table-column align="center" prop="warehouseName" label="图片" width="100">
<template #default="scope">
<el-image :preview-teleported="true" style="width: 40px;" :src="scope.row.productItem?.image" :preview-src-list="[scope.row.productItem?.image]"></el-image>
<el-image
:preview-teleported="true" style="width: 40px;" :src="scope.row.image"
:preview-src-list="[scope.row.image]"></el-image>
</template>
</el-table-column>
<el-table-column align="center" prop="warehouseName" label="仓库名称" width="180"></el-table-column>
<el-table-column align="center" prop="locationCode" label="库位" width="160"></el-table-column>
<el-table-column align="center" prop="warehouseSku" label="商品SKU" width="180"></el-table-column>
<el-table-column align="center" prop="skuName" label="商品名称" width="250"></el-table-column>
<el-table-column align="center" prop="productNumber" label="货号" width="150"></el-table-column>
<el-table-column align="center" prop="unit" label="单位" width="80"></el-table-column>
<el-table-column align="center" prop="productItem.factoryPrice" label="商品成本价(¥)" width="160"></el-table-column>
<el-table-column align="center" prop="price" label="商品成本价(¥)" width="160"></el-table-column>
<el-table-column align="center" prop="usableInventory" label="可用数量" width="120"></el-table-column>
<el-table-column align="center" prop="inventory" label="库存数量" width="120"></el-table-column>
<el-table-column align="center" prop="occupyInventory" label="占用数量" width="120"></el-table-column>
<el-table-column align="center" prop="freezeInventory" label="冻结数量" width="120"></el-table-column>
<el-table-column align="center" prop="productNumber" label="货号" width="150"></el-table-column>
<el-table-column fixed="right" label="操作" align="center">
<template #default="{row}">
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination">
......@@ -268,6 +329,7 @@ getWarehouse()
background: white;
box-sizing: border-box;
padding: 10px;
::v-deep(.el-tabs) {
height: 100%;
display: flex;
......
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