This commit is contained in:
shilixia 2021-10-29 11:10:31 +08:00
parent fd371532f5
commit 3481e13e44
9 changed files with 696 additions and 123 deletions

View File

@ -38,22 +38,34 @@ export function getInventoryList(query) {
}
export function createInventory(data) {
return request({
url: '/inm/inventory/',
url: '/inm/fifo/in_pur/',
method: 'post',
data
})
}
export function updateInventory(id, data) {
//仓库对应的物料
export function getfifodetailList(query) {
return request({
url: `/inm/inventory/${id}/`,
method: 'put',
data
url: '/inm/fifodetail/',
method: 'get',
params: query
})
}
export function deleteInventory(id, data) {
//出入库记录
export function getfifoList(query) {
return request({
url: `/inm/inventory/${id}/`,
method: 'delete',
data
url: '/inm/fifo/',
method: 'get',
params: query
})
}
//物料批次
export function getmaterialbatchList(query) {
return request({
url: '/inm/materialbatch/',
method: 'get',
params: query
})
}

View File

@ -293,32 +293,34 @@ export const asyncRoutes = [
meta: { title: '仓库', icon: 'example', perms: ['index_manage'] }
},
{
path: 'materialbatch/:id',
name: 'MaterialBatch',
component: () => import('@/views/inm/materialbatch'),
path: 'inventory/:id',
name: 'inventory',
component: () => import('@/views/inm/inventory'),
meta: { title: '仓库物料', perms: ['vendor_manage'] },
hidden: true
}
,
{
path: 'warehouse',
name: 'warehouse',
component: () => import('@/views/inm/warehouse'),
meta: { title: '物料库存', icon: 'example', perms: ['index_manage'] }
path: 'materialbatch',
name: 'materialbatch',
component: () => import('@/views/inm/materialbatch'),
meta: { title: '物料批次', icon: 'example', perms: ['index_manage'] }
},
{
path: 'warehouse',
name: 'warehouse',
component: () => import('@/views/inm/warehouse'),
meta: { title: '半成品库存', icon: 'example', perms: ['index_manage'] }
}
,
path: 'fifo',
name: 'fifo',
component: () => import('@/views/inm/fifo'),
meta: { title: '出入库记录', icon: 'example', perms: ['index_manage'] }
},
{
path: 'warehouse',
name: 'warehouse',
component: () => import('@/views/inm/warehouse'),
meta: { title: '成品库存', icon: 'example', perms: ['index_manage'] }
path: 'fifodetail/:id',
name: 'fifodetail',
component: () => import('@/views/inm/fifodetail'),
meta: { title: '仓库物料', perms: ['vendor_manage'] },
hidden: true
}
]
},

View File

@ -0,0 +1,324 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-input
v-model="listQuery.search"
placeholder="仓库名称/仓库编号"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<div style="margin-top: 10px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增物料</el-button
>
</div>
<el-table
v-loading="listLoading"
:data="fifoList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="出库入人员">
<template slot-scope="scope">{{ scope.row.operator_.username }}</template>
</el-table-column>
<el-table-column label="出入库时间">
<template slot-scope="scope">{{ scope.row.inout_date }}</template>
</el-table-column>
<el-table-column label="出入库类型">
<template slot-scope="scope">{{ types_[scope.row.type] }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDetail(scope)"
>查看详情</el-link
>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="fifoList.count > 0"
:total="fifoList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑仓库' : '新增仓库'"
>
<el-form
ref="Form"
:model="inventory"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="仓库" prop="warehouse">
<el-select v-model="inventory.warehouse" placeholder="请选择" filterable >
<el-option v-for="item in warehouseData" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="操作人" prop="operator">
<el-select v-model="inventory.operator" placeholder="请选择" filterable >
<el-option v-for="item in userData" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="入库时间" prop="inout_date">
<el-date-picker
v-model="inventory.inout_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
</el-form-item>
<div v-for="(item,index) in inventory.details" :key="index">
<el-row>
<el-col :span="8" style="margin-right:10px;">
<el-form-item class="material" label="物料:" :prop="'details.'+index+'.material'" >
<el-select v-model="item.material" size="small" >
<el-option v-for="item in materialoptions"
:key="item.value"
:value="item.value"
:label="item.label">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" style="margin-right:10px;">
<el-form-item class="count" label="数量" :prop="'details.'+index+'.count'" >
<el-input-number v-model="item.count" :min="0"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6" style="margin-right:10px;">
<el-form-item class="batch" label="批次" :prop="'details.'+index+'.batch'" >
<el-input v-model="item.batch" placeholder="批次号" ></el-input>
</el-form-item>
</el-col>
<!-- 删除按钮 -->
<el-col :span="1" >
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<el-button @click="deleteItem(index)" style='border:none;background:none;padding:0px;margin-top:4px;'>
<i class="el-icon-remove-outline" style='font-size:20px;'></i>
</el-button>
</el-tooltip>
</el-col>
</el-row>
</div>
<div>
<el-tooltip class="item" effect="dark" content="添加条件" placement="top">
<el-button @click="addConditions" style='cursor:pointer;width:95%;color:#fe000c;border:1px dashed #fe000c;height:40px;padding:0px;margin-top:10px;margin-left:20px;font-size:26px'>
+
</el-button>
</el-tooltip>
</div>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getfifoList,createInventory,getWarehouseList} from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList} from "@/api/mtm";
import { getUserList} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteinventory = {
details:[
{
material:'', // 物料
count:'',//数量
batch:'',//批次
}
],
};
export default {
components: { Pagination },
data() {
return {
inventory: defaulteinventory,
fifoList: {
count: 0,
},
types_:{
1:'生产领料',
2:'销售提货',
3:'采购入库',
4:'生产入库',
},
listQuery: {
page: 1,
page_size: 20,
},
warehouseData:[],
materialoptions:[],
userData:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getlists()
this.getList();
this.getUser();
this.getmaterialList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getfifoList(this.listQuery).then((response) => {
if (response.data) {
this.fifoList = response.data;
}
this.listLoading = false;
});
},
//出入库详情
handleDetail(scope){
this.$router.push({name: "fifodetail", params: { id: scope.row.id }, })
},
getlists(){
getWarehouseList({page:0}).then((response) => {
if (response.data) {
this.warehouseData = genTree(response.data);
}
this.listLoading = false;
});
},
getUser() {
getUserList({page:0}).then(res => {
if (res.data) {
this.userData = genTree(res.data);
}
})
},
addConditions () {
if(this.inventory.details.length<=10) {
this.inventory.details.push({
material:'', // 物料
count:'', //数量
batch:'', // 批次
});
} else {
this.$message('最多可添加十项条件');
}
},
deleteItem (index) {
this.inventory.details.splice(index, 1)
},
//物料
getmaterialList() {
this.listLoading = true;
getMaterialList({pageoff:true}).then((response) => {
if (response.data) {
this.materialoptions = genTree(response.data);
}
this.listLoading = false;
});
},
handleCreate()
{
this.inventory = Object.assign({}, defaulteinventory);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
async confirm(form) {
console.log(this.inventory)
createInventory(this.inventory).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
},
};
</script>

View File

@ -0,0 +1,131 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-input
v-model="listQuery.search"
placeholder="仓库名称/仓库编号"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="fifodetailList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="物料批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.material_.number }}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="入库数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
</el-table>
<pagination
v-show="fifodetailList.count > 0"
:total="fifodetailList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getfifodetailList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList} from "@/api/mtm";
import { getUserList} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
InventoryList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
this.listQuery.fifo=this.$route.params.id;
getfifodetailList(this.listQuery).then((response) => {
if (response.data) {
this.fifodetailList = response.data;
}
this.listLoading = false;
});
},
},
};
</script>

View File

@ -0,0 +1,137 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-input
v-model="listQuery.search"
placeholder="仓库名称/仓库编号"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="InventoryList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.material_.number }}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="物料存量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
</el-table>
<pagination
v-show="InventoryList.count > 0"
:total="InventoryList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getInventoryList,getfifoList,getfifodetailList,createInventory,getWarehouseList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList} from "@/api/mtm";
import { getUserList} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
InventoryList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
if(this.$route.params.id!="")
{
this.listQuery.warehouse=this.$route.params.id;
getInventoryList(this.listQuery).then((response) => {
if (response.data) {
this.InventoryList = response.data;
}
this.listLoading = false;
});
}
else
{
getInventoryList(this.listQuery).then((response) => {
if (response.data) {
this.InventoryList = response.data;
}
this.listLoading = false;
});
}
},
},
};
</script>

View File

@ -26,124 +26,106 @@
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="warehouseList.results"
:data="InventoryList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="物料批次">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.material_.number }}</template>
</el-table-column>
<el-table-column label="入库数量">
<template slot-scope="scope">{{ scope.row.place }}</template>
<el-table-column label="仓库名称">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="物料有效期">
<template slot-scope="scope">{{ scope.row.place }}</template>
<el-table-column label="仓库编号">
<template slot-scope="scope">{{ scope.row.warehouse_.number }}</template>
</el-table-column>
<el-table-column label="入库时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
</template>
<el-table-column label="物料总存量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
</el-table>
<pagination
v-show="warehouseList.count > 0"
:total="warehouseList.count"
v-show="InventoryList.count > 0"
:total="InventoryList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getWarehouseList, deleteWarehouse } from "@/api/inm";
import { getInventoryList,getfifoList,getmaterialbatchList,createInventory,getWarehouseList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList} from "@/api/mtm";
import { getUserList} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultewarehouse = {
};
export default {
components: { Pagination },
data() {
return {
warehouse: defaultewarehouse,
warehouseList: {
InventoryList: {
count: 0,
},
options: [{
value: 0,
label: '运转正常'
}, {
value: 1,
label: '停用'
}, {
value: 2,
label: '报废'
}],
listQuery: {
page: 1,
page_size: 20,
},
keeperOptions:[],
depOptions:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
number: [{ required: true, message: "请输入", trigger: "blur" }],
place: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//设备列表
getList() {
this.listLoading = true;
getWarehouseList(this.listQuery).then((response) => {
getmaterialbatchList(this.listQuery).then((response) => {
if (response.data) {
this.warehouseList = response.data;
this.InventoryList = response.data;
}
this.listLoading = false;
});
},
handleMaterial(scope){
alert(1)
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
@ -156,21 +138,7 @@ export default {
this.getList();
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteWarehouse(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
},

View File

@ -179,7 +179,7 @@ export default {
},
//跳转到该仓库的物料表
handleMaterial(scope){
this.$router.push({name: "MaterialBatch", params: { id: scope.row.id }, })
this.$router.push({name: "inventory", params: { id: scope.row.id }, })
},
handleFilter() {
this.listQuery.page = 1;

View File

@ -11,12 +11,12 @@
>计算物料</el-button>
<el-table
:data="orderList.results"
ref="multipleTable"
border
ref="multipleTable"
fit
stripe
style="width: 100%"
@selection-change="handleSelectionChange">
>
<el-table-column
type="selection"
width="55">
@ -41,7 +41,7 @@
<template slot-scope="scope" >
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number v-model="scope.row.pgcount" :min="0"></el-input-number>
<el-input-number v-model="scope.row.pgcount" :min="0" :value="0"></el-input-number>
</el-form-item>
</el-form>
</template>
@ -234,30 +234,21 @@ export default {
this.listLoading = false;
});
},
handleSelectionChange(rows) {
let _this=this
//物料计算
handlecount()
{
console.log()
let _this=this
_this.mutipID=[]
row.forEach((item) => {
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID.push({
"id":item.product_.id,
"count": item.pgcount
});
});
setTimeout(() => {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
}, 1)
},
//物料计算
handlecount()
{
createresource(this.mutipID).then((res) => {
if (res.code >= 200) {
this.materialpzTable=res.data;

View File

@ -27,6 +27,7 @@
<el-table-column label="工序编号">
<template slot-scope="scope">{{ scope.row.process_.number }}</template>
</el-table-column>
<el-table-column label="子工序">
<template slot-scope="scope" v-if="scope.row.steps">
<el-tag v-for="item in scope.row.steps"
@ -43,7 +44,9 @@
<el-table-column label="完工时间">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
@ -79,7 +82,12 @@ export default {
page: 1,
page_size: 20,
},
state_:{
0:'制定中',
1:'已下达',
2:'已接受',
3:'生产中',
4:'已完成'},
listLoading: true
};
},