Commit 1379c57f by zhuzhequan

工厂端仓库

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