Commit 1379c57f by zhuzhequan

工厂端仓库

parent 1aab27f4
......@@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
!/src/views/warehouse/manage.vue
......@@ -27,7 +27,7 @@ export interface WarehouseInventory {
floorLimit: string;
}
export interface UpdateDefaulted{
id?: number;
id?: number |string;
defaulted: number;
}
......@@ -36,7 +36,7 @@ export interface UpdateStatus{
status: number | undefined;
}
export interface warehouseInfo{
id?: number;
id?: number |string;
name: string;
code: string;
sort: string;
......@@ -48,7 +48,7 @@ export interface warehouseInfo{
export interface positionInfo{
id?: number;
warehouseId: string;
warehouseId?: string | number;
locationName: string;
pickingOrder: string;
locationCode: string;
......@@ -58,12 +58,13 @@ export interface positionInfo{
}
export interface positionFormInfo{
id?: number;
warehouseId: string;
warehouseId?: number | string;
locationName: string;
pickingOrder: string;
locationCode: string;
warehouseName: string ;
remark: string
status: number
}
interface WarehouseWarningData {
id: number;
......@@ -140,12 +141,18 @@ export function updateWarehouseApi(data:positionInfo | UpdateDefaulted) {
)
}
export function updatePositionApi(data:positionInfo | UpdateStatus) {
export function updatePositionApi(data:positionInfo) {
return axios.post<never, BaseRespData<never>>(
'/factoryWarehouseLocation/update',
data
)
}
export function updatePositionStatusApi(data: UpdateStatus) {
return axios.get<never, BaseRespData<never>>(
'/factoryWarehouseLocation/updateStatus',
{ params:data },
)
}
export function updateWarehouseInventoryApi(data:WarehouseWarningData) {
return axios.post<never, BaseRespData<never>>(
'/factoryWarehouseInventory/update',
......
......@@ -18,7 +18,7 @@ const createData = ref({
name: '',
code: '',
sort: '',
defaulted: 1,
defaulted: 0,
remarks: '',
},
})
......@@ -81,9 +81,13 @@ const handleBatchDelete = async () => {
type: 'warning',
})
const str = selections.value.map((el) => el.id).join(',')
await deleteWarehouseApi(str)
ElMessage.success('删除成功')
await getData()
try {
await deleteWarehouseApi(str)
ElMessage.success('删除成功')
await getData()
} catch (error) {
await getData()
}
}
const createWarehouse = () => {
createData.value.show = true
......@@ -93,7 +97,7 @@ const createWarehouse = () => {
name: '',
code: '',
sort: '',
defaulted: 1,
defaulted: 0,
remarks: '',
}
nextTick(() => {
......@@ -105,6 +109,7 @@ const updateDefaulted = async (item: warehouseInfo) => {
id: item.id,
defaulted: item.defaulted,
})
await getData()
}
const updateWarehouse = (item: warehouseInfo) => {
createData.value.show = true
......@@ -132,9 +137,8 @@ getData()
<el-table-column type="selection" />
<el-table-column type="index" label="序号" width="60" />
<el-table-column label="仓库名称" prop="name" align="center" />
<el-table-column label="仓库类型" prop="name" align="center" />
<el-table-column label="仓库编码" prop="code" align="center" />
<el-table-column label="仓库地址" prop="name" align="center" />
<el-table-column label="仓库序号" prop="sort" align="center" />
<el-table-column label="备注" prop="remarks" align="center" />
<el-table-column label="默认仓库" prop="defaulted" align="center">
<template #default="{row}">
......
......@@ -6,7 +6,7 @@ import {
warehouseInfoGetAll,
createPositionApi,
updatePositionApi,
positionInfo, deleteLocationApi, positionFormInfo,
positionInfo, deleteLocationApi, positionFormInfo, updatePositionStatusApi,
} from '@/api/warehouse.ts'
import { nextTick, ref } from 'vue'
import SplitDiv from '@/components/splitDiv/splitDiv.vue'
......@@ -14,6 +14,7 @@ import SplitDiv from '@/components/splitDiv/splitDiv.vue'
const searchForm = ref({
warehouseId: '',
locationCode: '',
status: '',
locationName: '',
remark: '',
})
......@@ -27,6 +28,7 @@ const form = ref<positionFormInfo>({
warehouseName: '',
warehouseId: '',
remark: '',
status: 1,
})
const createData = ref({
title: '',
......@@ -112,20 +114,22 @@ const createWarehouse = () => {
createData.value.show = true
createData.value.isEdit = false
createData.value.title = '新增库位'
const warehouse = warehouseList.value.find(w => w.defaulted === 1)
form.value = {
locationName: '',
locationCode: '',
pickingOrder: '',
warehouseName: '',
warehouseId: '',
warehouseName: warehouse ? warehouse.name : '',
warehouseId: warehouse ? warehouse.id : '',
remark: '',
status: 1,
}
nextTick(() => {
formRef.value?.clearValidate()
})
}
const updateStatus = async (item: positionInfo) => {
await updatePositionApi({
await updatePositionStatusApi({
id: item.id,
status: item.status,
})
......@@ -142,7 +146,8 @@ const updateWarehouse = (item: positionFormInfo) => {
warehouseName: item.warehouseName,
warehouseId: item.warehouseId,
remark: item.remark,
}
status: item.status,
}
nextTick(() => {
formRef.value?.clearValidate()
})
......@@ -154,7 +159,7 @@ const getWarehouse = async () => {
}
const warehouseChange = (v: number) => {
const warehouse = warehouseList.value.find(w => w.id == v)
form.value.warehouseName = warehouse?warehouse.name:''
form.value.warehouseName = warehouse ? warehouse.name : ''
}
getWarehouse()
</script>
......@@ -165,7 +170,8 @@ getWarehouse()
<el-card>
<el-form inline :model="searchForm">
<el-form-item label="仓库">
<el-select v-model="searchForm.warehouseId" clearable filterable style="width: 150px;">
<el-select v-model="searchForm.warehouseId" placeholder="请选择仓库" clearable filterable
style="width: 150px;">
<el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -184,7 +190,11 @@ getWarehouse()
v-model="searchForm.remark" style="width: 140px;" placeholder="请输入备注"
clearable></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchForm.status" placeholder="请选择状态" clearable filterable style="width: 150px;">
<el-option v-for="(item,index) in ['禁用','启用']" :key="index" :label="item" :value="index"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getData">查询</el-button>
<el-button type="success" @click="createWarehouse">新增库位</el-button>
......@@ -247,7 +257,7 @@ getWarehouse()
<el-input v-model="form.locationCode" clearable placeholder="请输入库位编码(例如:A1-01-03)"></el-input>
</el-form-item>
<el-form-item label="拣货顺序" prop="pickingOrder">
<el-input-number v-model="form.pickingOrder" placeholder="拣货顺序"></el-input-number>
<el-input-number v-model="form.pickingOrder" placeholder="拣货顺序"></el-input-number>
</el-form-item>
<el-form-item label="所属仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" @change="warehouseChange">
......@@ -261,6 +271,11 @@ getWarehouse()
v-model="form.remark" type="textarea" :rows="4" clearable
placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-switch
v-model="form.status" :active-value="1" :inactive-value="0"
></el-switch>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="createData.show=false">取消</el-button>
......
......@@ -2,9 +2,9 @@
import {
factoryWarehouseInfo,
warehouseInfo,
deleteWarehouseInventory, warehouseInfoGetAll, getWarehouseInventoryInfo, WarehouseInventory,
deleteWarehouseInventory, warehouseInfoGetAll, getWarehouseInventoryInfo, WarehouseInventory,
} from '@/api/warehouse.ts'
import { nextTick, ref } from 'vue'
import { ref } from 'vue'
import SplitDiv from '@/components/splitDiv/splitDiv.vue'
const searchForm = ref({
......@@ -23,12 +23,6 @@ const searchForm = ref({
})
const warehouseList = ref<warehouseInfo[]>([])
const selections = ref<warehouseInfo[]>([])
const formRef = ref()
const createData = ref({
title: '',
show: false,
isEdit: false,
})
const leftData = ref<warehouseInfo[]>([])
const pagination = ref<factoryWarehouseInfo>({
pageSize: 50,
......@@ -84,43 +78,52 @@ getWarehouse()
<template #top>
<el-card>
<el-form inline :model="searchForm">
<el-form-item label="仓库">
<el-select placeholder="请输入仓库" v-model="searchForm.warehouseId" style="width: 140px;">
<el-form-item label="仓库">
<el-select
v-model="searchForm.warehouseId" clearable filterable placeholder="请输入仓库"
style="width: 140px;">
<el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商品SKU">
<el-input v-model="searchForm.warehouseSku" style="width: 140px;" placeholder="请输入商品SKU"
clearable></el-input>
<el-input
v-model="searchForm.warehouseSku" style="width: 140px;" placeholder="请输入商品SKU"
clearable></el-input>
</el-form-item>
<el-form-item label="商品名称">
<el-input v-model="searchForm.skuName" style="width: 140px;" placeholder="请输入商品名称"
clearable></el-input>
<el-input
v-model="searchForm.skuName" 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=""
clearable></el-input>
<el-input
v-model="searchForm.upperLimit" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
-
<el-input v-model="searchForm.floorLimit" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
<el-input
v-model="searchForm.floorLimit" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
</el-form-item>
<el-form-item label="可用数">
<el-input v-model="searchForm.usableInventoryStart" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
<el-input
v-model="searchForm.usableInventoryStart" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
-
<el-input v-model="searchForm.usableInventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
<el-input
v-model="searchForm.usableInventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
</el-form-item>
<el-form-item label="占用数">
<el-input v-model="searchForm.occupyInventoryStart" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
<el-input
v-model="searchForm.occupyInventoryStart" style="width: 80px;margin-right: 5px" placeholder=""
clearable></el-input>
-
<el-input v-model="searchForm.occupyInventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
<el-input
v-model="searchForm.occupyInventoryEnd" style="width: 80px;margin-left: 5px" placeholder=""
clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getData">查询</el-button>
<el-button type="danger" @click="handleBatchDelete">删除</el-button>
</el-form-item>
</el-form>
</el-card>
......@@ -134,41 +137,20 @@ getWarehouse()
<el-table height="100%" :data="leftData" border @selection-change="handleSelectionChange">
<el-table-column align="center" fixed type="selection" />
<el-table-column align="center" fixed="left" type="index" label="序号" width="60" />
<el-table-column align="center" prop="warehouse" label="仓库" width="150"></el-table-column>
<el-table-column align="center" prop="category" label="商品类别" width="150"></el-table-column>
<el-table-column align="center" prop="sku" label="商品SKU" width="150"></el-table-column>
<el-table-column align="center" prop="productName" label="商品名称" width="200"></el-table-column>
<el-table-column align="center" prop="warehouseName" label="仓库名称" width="180"></el-table-column>
<el-table-column align="center" prop="locationName" 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="unit" label="单位" width="100"></el-table-column>
<el-table-column align="center" prop="costPrice" label="商品成本价(¥)" width="150"></el-table-column>
<el-table-column align="center" prop="weight" label="商品重量(克)" width="150"></el-table-column>
<el-table-column
align="center" prop="availableQuantity" label="可用数量"
width="120"></el-table-column>
<el-table-column
align="center" prop="inventoryQuantity" label="库存数量"
width="120"></el-table-column>
<el-table-column align="center" prop="occupyQuantity" label="占用数量" width="120"></el-table-column>
<el-table-column align="center" prop="freezeQuantity" label="冻结数量" width="120"></el-table-column>
<el-table-column
align="center" prop="outOfStockQuantity" label="缺货数量"
width="120"></el-table-column>
<el-table-column
align="center" prop="unreceivedPurchase" label="采购未入库"
width="160"></el-table-column>
<el-table-column
align="center" prop="unshippedReturns" label="退回未出库"
width="160"></el-table-column>
<el-table-column
align="center" prop="estimatedSalesDays" label="预计销售天数"
width="160"></el-table-column>
<el-table-column
align="center" prop="longestOutOfStockDays" label="最长缺货天数"
width="160"></el-table-column>
<el-table-column align="center" prop="location" label="库位" width="150"></el-table-column>
<el-table-column align="center" prop="status" 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="180"></el-table-column>
<el-table-column align="center" prop="inventory" label="实际库存" width="120"></el-table-column>
<el-table-column align="center" prop="upperLimit" label="库存上限" width="120"></el-table-column>
<el-table-column align="center" prop="floorLimit" 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}">
<el-button type="primary" @click="updateWarehouse(row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
......
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