fix:车间库存报废,在库存管理里查看

This commit is contained in:
shijing 2024-09-06 11:00:53 +08:00
parent 2eca64bf93
commit 408f83436c
5 changed files with 333 additions and 58 deletions

View File

@ -1869,6 +1869,15 @@ const routes = [
},
component: "inm/workshop_mio",
},
{
name: "inmScrap",
path: "/inm/inmScrap",
meta: {
title: "废品库",
perms: ["inmScrap"],
},
component: "inm/inmScrap",
},
],
},
//采购 pum

214
src/views/inm/inmScrap.vue Normal file
View File

@ -0,0 +1,214 @@
<template>
<el-container>
<el-header>
<!-- <div class="left-panel">
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">
报废</el-button>
</div> -->
<div class="right-panel">
<!-- <el-button type="primary" @click="materialsChoses('wm')"
>选择物料</el-button
> -->
<!-- <el-select
v-model="query.mgroupx"
placeholder="工段"
clearable
@change="handleQuery"
style="width: 250px"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> -->
<el-input
style="margin-right: 5px;width: 250px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
>
<el-table-column label="状态" prop="state" width="100" >
<template #default="scope">
<el-tag :type="wmState[scope.row.state]?.type">
{{wmState[scope.row.state]?.text}}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="物料名称"
prop="material_name"
min-width="150"
>
<template #default="scope">
{{ scope.row.material_name }}
<span v-if="scope.row.material_origin != null"
>{{ scope.row.material_origin_name }}</span
>
</template>
</el-table-column>
<el-table-column
label="批次号"
prop="batch"
min-width="120"
></el-table-column>
<el-table-column
label="部门/工段"
prop="belong_dept_name"
>
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="数量"
prop="count"
min-width="80"
></el-table-column>
<el-table-column
label="不合格标记"
prop="notok_sign_name"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
<scrap-dialog
v-if="dialog.scrap"
ref="scrapDialog"
:type="type"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
>
</scrap-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
// import materials from "./../mtm/materials.vue";
// import checkDialog from "./check_form.vue";
// import showDrawer from "./check_drawer.vue";
// import scrapDialog from "./handover_form.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
// components: {
// materials,
// checkDialog,
// showDrawer,
// scrapDialog
// },
name: "wmaterial",
data() {
return {
wmState,
apiObj: this.$API.wpm.wmaterial.list,
params: {
state : 50,
state_all: 1
},
query: {
search:''
},
dialog: {
scrap: false,
},
options:[],
tableData: [],
selection: [],
queryWm: {
search: "",
material: "",
},
materialType: "wm",
visibleDrawer: false,
};
},
mounted() {
let that = this;
// that.$API.mtm.mgroup.list.req({ page: 0 }).then((res) => {
// that.options = res;
// if(res.length>0){
// that.params.mgroupx = res[0].id;
// }
// });
},
methods: {
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
tomio() {
this.$router.push({ name: "halfgood_mio" });
},
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
table_add(type) {
this.dialog.scrap = true;
this.type = type;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add");
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
},
};
</script>
<style scoped></style>

View File

@ -4,15 +4,15 @@
<div class="left-panel">
<el-button
type="primary"
@click="add('do_in')"
@click="add('do_out')"
v-auth="'mio.do'"
>生产入库</el-button
>生产领料</el-button
>
<el-button
type="primary"
@click="add('sale_out')"
v-auth="'mio.sale'"
>销售发货</el-button
@click="add('do_in')"
v-auth="'mio.do'"
>生产入库</el-button
>
<el-select
v-model="query.type"
@ -166,11 +166,11 @@ export default {
{ id: 20, name: "已提交" },
],
typeDict: {
sale_out: "销售发货",
do_out: "生产领料",
do_in: "生产入库",
},
cateOptions: [
{ id: "sale_out", name: "销售发货" },
{ id: "do_out", name: "生产领料" },
{ id: "do_in", name: "生产入库" },
],
dialog: {

View File

@ -132,17 +132,15 @@
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:label="item.label"
:value="item.id"
>
<span>{{ item.batch }}</span>
<div style="float: right">
<span>{{ item.count }}</span>
<span
v-if="item.notok_sign_name !== null"
style="color: #aaaaaa"
>({{ item.notok_sign_name }})</span
>
<span v-if="item.notok_sign_name !== null" style="color: #aaaaaa">
({{ item.notok_sign_name }})
</span>
</div>
</el-option>
</el-select>
@ -205,11 +203,11 @@ export default {
lists:[],//
handle_user: [],
form: {
send_date: "",
send_user: "",
send_mgroup: "",
recive_user: "",
recive_mgroup: "",
send_date: null,
send_user: null,
send_mgroup: null,
recive_user: null,
recive_mgroup: null,
handoverb:[{wm:'',count:''}],
},
rules: {
@ -294,7 +292,11 @@ export default {
that.deptID = that.$TOOL.data.get('gx_deptID');
that.getUserList();
}
if(that.type==40){
that.getMaterialNotok();
}else{
that.getMaterial();
}
that.getDeptOptions();
that.getMgroupOptions();
},
@ -329,28 +331,42 @@ export default {
}else if(that.mgroupName=="facade"){
req.material__process__name="二次超洗";
}
// else{
// if (this.type == 10) {
// req.notok_sign__isnull = 1;
// } else if (this.type == 20) {
// req.notok_sign__isnull = 0;
// }else if (this.type == 30) {
// req.notok_sign__isnull = 1;
// }
// }
this.$API.wpm.wmaterial.list
.req(req)
.then((res) => {
that.materialOptions = res;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
// that.materialOptions = res;
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
},
//
getMaterialNotok() {
let that = this;
var req = {
mgroupx: that.mgroupId,
page: 0,
notok_sign__isnull : 0,
count_xtest__isnull:1
};
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch+'('+item.notok_sign_name+')';
arr.push(obj);
})
that.materialOptions = arr;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list
.req({ depts: that.deptID, page: 0 })
.then((res) => {
this.$API.system.user.list.req({ depts: that.deptID, page: 0 }).then((res) => {
that.userList = res;
});
},
@ -361,9 +377,7 @@ export default {
this.mgroupOptions.forEach(item => {
if(item.id==that.form.recive_mgroup){
deptID = item.belong_dept;
this.$API.system.user.list
.req({ depts: deptID, page: 0 })
.then((res) => {
this.$API.system.user.list.req({ depts: deptID, page: 0 }).then((res) => {
that.userList2 = res;
});
}
@ -398,29 +412,40 @@ export default {
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
if (this.mode == "add") {
this.$API.wpm.handover.create.req(this.form).then((res) => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
if (that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
if(that.type==40){
//
that.$API.wpm.handover.submit.req(res.id).then((res1) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}else{
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}
}).catch((err) => {
//
this.isSaveing = false;
that.isSaveing = false;
return err;
});
} else if (this.mode == "edit") {
this.$API.wpm.handover.update.req(this.form.id, this.form).then((res) => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
} else if (that.mode == "edit") {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
//
this.isSaveing = false;
that.isSaveing = false;
return err;
});
}

View File

@ -9,6 +9,8 @@
<el-button type="primary" @click="tomio" v-auth="'mio.do'"
>入库</el-button
>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">
报废</el-button>
</div>
<div class="right-panel">
<!-- <el-button type="primary" @click="materialsChoses('wm')"
@ -135,6 +137,16 @@
@closed="dialog.save = false"
>
</check-dialog>
<scrap-dialog
v-if="dialog.scrap"
ref="scrapDialog"
:type="type"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
>
</scrap-dialog>
<showDrawer
ref="showDrawer"
v-if="visibleDrawer"
@ -149,6 +161,7 @@ import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
export default {
props: {
mgroupName: {
@ -159,7 +172,8 @@ export default {
components: {
materials,
checkDialog,
showDrawer
showDrawer,
scrapDialog
},
name: "wmaterial",
data() {
@ -172,6 +186,7 @@ export default {
query: {},
dialog: {
save: false,
scrap: false,
permission: false,
},
tableData: [],
@ -240,6 +255,18 @@ export default {
selectionChange(selection) {
this.selection = selection;
},
//
table_add(type) {
this.dialog.scrap = true;
this.type = type;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add");
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//
handleQuery() {
this.$refs.table.queryData(this.query);