fix: 混料添加车间库存及相应bug修复

This commit is contained in:
caoqianming 2024-03-06 22:30:38 +08:00
parent cc29f2b2aa
commit 5def66cf5c
4 changed files with 213 additions and 120 deletions

View File

@ -259,6 +259,7 @@ export default {
this.$API.wpm.handover.submit.req(row.id).then(res => { this.$API.wpm.handover.submit.req(row.id).then(res => {
this.$message.success('操作成功') this.$message.success('操作成功')
this.$refs.table_handover.refresh(); this.$refs.table_handover.refresh();
this.$refs.table_wm.refresh();
}).catch(err => { }) }).catch(err => { })
}, },
} }

View File

@ -22,12 +22,14 @@
<el-table-column label="数量/桶数" prop="count_real"> <el-table-column label="数量/桶数" prop="count_real">
</el-table-column> </el-table-column>
<el-table-column label="每桶重量/kg" prop="count_real_eweight"> <el-table-column label="每桶重量/kg" prop="count_real_eweight">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.count_real_eweight"> {{ scope.row.count_real_eweight.toFixed(2) <span v-if="scope.row.count_real_eweight"> {{ scope.row.count_real_eweight.toFixed(2)
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="配料人" prop="handle_user_name"> <el-table-column label="配料人" prop="handle_user_name">
<template #default="scope"> <template #default="scope">
<span v-for="item in scope.row.handle_users_" v-bind:key="item.id"> <span v-for="item in scope.row.handle_users_" v-bind:key="item.id">
{{ item.name }}/ {{ item.name }}/
@ -35,16 +37,24 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="180"> <el-table-column label="操作" fixed="right" align="center" width="180">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="table_edit(scope.row)" v-auth="'mlog.update'"> <el-button link type="primary" v-if="scope.row.submit_time == null"
@click="table_edit(scope.row)" v-auth="'mlog.update'">
编辑 编辑
</el-button> </el-button>
<el-button link type="primary" @click="addHandover(scope.row)" v-auth="'handover.create'"> <el-button link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'"
转交接单 v-if="scope.row.submit_time == null">
</el-button>
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'">
删除 删除
</el-button> </el-button>
<el-button link type="success" v-if="scope.row.submit_user == null"
@click="table_submit(scope.row)" v-auth="'mlog.submit'">
提交
</el-button>
<el-button link type="warning" v-if="scope.row.submit_time != null"
@click="table_revert(scope.row)" v-auth="'mlog.submit'">
撤回
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
@ -53,49 +63,58 @@
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<el-container>
<el-aside style="width: 60%">
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<span style="font-size: 14px">交接记录</span> <span style="font-size: 14px">交接记录</span>
</div> </div>
<div class="right-panel">
<el-button type="primary" @click="addHandover" v-auth="'handover.create'">
新增
</el-button>
</div>
</el-header> </el-header>
<el-main> <el-main>
<scTable ref="table2" :apiObj="apiObjHandover" row-key="id" stripe :params="paramsHandover"> <scTable ref="table2" :apiObj="apiObjHandover" row-key="id" stripe :params="paramsHandover">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="送料日期" prop="send_date"> <el-table-column label="送料日期" prop="send_date" width="120">
</el-table-column> </el-table-column>
<el-table-column label="产物" prop="material" show-overflow-tooltip> <el-table-column label="产物" prop="material_name" show-overflow-tooltip width="120">
<template #default="scope"><span v-if="scope.row.material_">{{
scope.row.material_.full_name
}}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="批次" prop="batch"> </el-table-column> <el-table-column label="批次" prop="batch"> </el-table-column>
<el-table-column label="数量/桶数" prop="count"> <el-table-column label="数量/桶数" prop="count">
</el-table-column> </el-table-column>
<el-table-column label="每桶重量/kg" prop="count_eweight"> <el-table-column label="每桶/kg" prop="count_eweight">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.count_eweight"> {{ scope.row.count_eweight.toFixed(2) }}</span> <span v-if="scope.row.count_eweight"> {{ scope.row.count_eweight.toFixed(2)
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="交送人" prop="send_user_name"> <el-table-column label="交送人" prop="send_user_name">
</el-table-column> </el-table-column>
<el-table-column label="接收车间" prop="recive_dept_name">
</el-table-column>
<el-table-column label="接收人" prop="recive_user_name"> <el-table-column label="接收人" prop="recive_user_name">
</el-table-column> </el-table-column>
<el-table-column label="是否确认" prop="submit_time"> <el-table-column label="是否确认" prop="submit_time">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.submit_time"></span> <span v-if="scope.row.submit_time"></span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="100"> <el-table-column label="操作" fixed="right" align="left" width="100">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="handover_edit(scope.row)" v-auth="'handover.update'" <!-- <el-button link type="primary" @click="handover_edit(scope.row)"
v-if="scope.row.submit_time == null"> v-auth="'handover.update'" v-if="scope.row.submit_time == null">
编辑 编辑
</el-button> </el-button> -->
<el-button link type="danger" @click="handover_delete(scope.row)" v-auth="'handover.delete'" <el-button link type="danger" @click="handover_delete(scope.row)"
v-if="scope.row.submit_time == null"> v-auth="'handover.delete'" v-if="scope.row.submit_time == null">
删除 删除
</el-button> </el-button>
</template> </template>
@ -103,12 +122,54 @@
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
</el-aside>
<el-main class="nopadding">
<el-container>
<el-header>
<div class="left-panel">
<span style="font-size: 14px">车间库存</span>
</div>
</el-header>
<el-main>
<scTable ref="table_wm" :apiObj="apiObjWm" row-key="id" :params="paramsWm" stripe
hidePagination>
<el-table-column label="物料" prop="material">
<template #default="scope">{{
scope.row.material_name
}}</template>
</el-table-column>
<el-table-column label="批次" prop="batch"> </el-table-column>
<el-table-column label="数量/桶数" prop="count">
</el-table-column>
<el-table-column label="每桶/kg" prop="count_eweight"></el-table-column>
</scTable>
</el-main>
</el-container>
</el-main>
</el-container>
</el-main> </el-main>
</el-container> </el-container>
<el-dialog title="交接单" ref="handoverDialog" v-model="handoverVisible" :size="1000" destroy-on-close <el-dialog title="交接单" ref="handoverDialog" v-model="handoverVisible" :size="1000" destroy-on-close
@closed="handoverVisible = false"> @closed="handoverVisible = false">
<el-form ref="dialogForm" :model="handoverForm" :rules="rules" label-width="120px"> <el-form ref="dialogForm" :model="handoverForm" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :md="24" :sm="24">
<el-form-item label="交送物料" prop="wm">
<el-select v-model="selectWm" placeholder="交送物料" clearable style="width: 100%"
:disabled="handoverType == 'edit'" value-key="id" @change="selectWmChange">
<el-option v-for="item in wmaterialList" :key="item.id"
:label="item.material_name + '---' + item.batch" :value="item">
<span style="float: left">{{ item.material_name }}---{{ item.batch }}</span>
<span style="
float: right;
color: var(--el-text-color-secondary);
font-size: 13px;
">{{ item.count }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="送料日期" prop="send_date"> <el-form-item label="送料日期" prop="send_date">
<el-date-picker v-model="handoverForm.send_date" type="date" value-format="YYYY-MM-DD" <el-date-picker v-model="handoverForm.send_date" type="date" value-format="YYYY-MM-DD"
@ -159,10 +220,12 @@
<el-button type="primary" @click="submitHandover">提交</el-button> <el-button type="primary" @click="submitHandover">提交</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<save-dialog v-if="dialogSave" ref="saveDialog" :mgroup="currentMgroup.id" :mgroupShiftRule="currentMgroup.shift_rule" <save-dialog v-if="dialogSave" ref="saveDialog" :mgroup="currentMgroup.id"
:activeType="activeName" @success="handleSaveSuccess" @closed="dialogSave = false"> :mgroupShiftRule="currentMgroup.shift_rule" :activeType="activeName" @success="handleSaveSuccess"
@closed="dialogSave = false">
</save-dialog> </save-dialog>
</template> </template>
<script> <script>
import saveDialog from "./worktask_form.vue"; import saveDialog from "./worktask_form.vue";
export default { export default {
@ -177,12 +240,16 @@ export default {
params: {}, params: {},
apiObjHandover: null, apiObjHandover: null,
paramsHandover: {}, paramsHandover: {},
apiObjWm: null,
paramsWm: {},
handoverForm: {}, handoverForm: {},
handoverVisible: false, handoverVisible: false,
dialogSave: false, dialogSave: false,
deptOptions: [], deptOptions: [],
userList: [], userList: [],
userList2: [] userList2: [],
wmaterialList: [],
selectWm: null
} }
}, },
mounted() { mounted() {
@ -190,6 +257,20 @@ export default {
this.getDepts() this.getDepts()
}, },
methods: { methods: {
table_revert(row) {
this.$API.wpm.mlog.revert.req(row.id).then(res => {
this.$message.success("撤回成功");
this.$refs.table.refresh();
this.$refs.table_wm.refresh();
}).catch(e => { })
},
table_submit(row) {
this.$API.wpm.mlog.submit.req(row.id).then(res => {
this.$message.success("提交成功");
this.$refs.table.refresh();
this.$refs.table_wm.refresh();
})
},
add() { add() {
this.dialogSave = true; this.dialogSave = true;
this.$nextTick(() => { this.$nextTick(() => {
@ -238,6 +319,12 @@ export default {
this.paramsHandover.send_mgroup = this.currentMgroup.id this.paramsHandover.send_mgroup = this.currentMgroup.id
this.apiObjHandover = this.$API.wpm.handover.list this.apiObjHandover = this.$API.wpm.handover.list
this.paramsWm.belong_dept = this.currentMgroup.belong_dept
this.paramsWm.material__name__contains = '混料'
this.paramsWm.count__gte = 1
this.apiObjWm = this.$API.wpm.wmaterial.list
this.$API.system.user.list.req({ page: 0, belong_dept: this.currentMgroup.belong_dept }).then(res => { this.$API.system.user.list.req({ page: 0, belong_dept: this.currentMgroup.belong_dept }).then(res => {
this.userList = res this.userList = res
}) })
@ -247,19 +334,37 @@ export default {
}) })
}, },
// //
addHandover(row) { addHandover() {
this.getWmaterial();
this.handoverForm.wm = '';
this.handoverForm.send_date = ""; this.handoverForm.send_date = "";
this.handoverForm.mlog = row.id;
this.handoverForm.batch = row.batch;
this.handoverForm.count = row.count_real;
this.handoverForm.material = row.material_out;
this.handoverForm.count_eweight = row.count_real_eweight;
this.handoverForm.send_dept = row.belong_dept;
this.handoverForm.recive_dept = "";
this.handoverForm.send_user = ""; this.handoverForm.send_user = "";
this.handoverForm.recive_user = ""; this.handoverForm.recive_user = '';//
this.handoverForm.recive_dept = '';//
this.handoverForm.send_dept = this.currentMgroup.belong_dept;
this.handoverForm.send_mgroup = this.currentMgroup.id;
this.handoverType = 'add';
this.handoverVisible = true; this.handoverVisible = true;
}, },
getWmaterial() {
let obj = {};
obj.belong_dept = this.currentMgroup.belong_dept;
obj.material__name__contains = '混料';
obj.page = 0;
obj.count__gte = 1;
this.$API.wpm.wmaterial.list.req(obj).then(res => {
this.wmaterialList = res;
})
},
selectWmChange(item) {
this.handoverForm.count = item.count
this.handoverForm.count_eweight = item.count_eweight
this.handoverForm.wm = item.id
this.handoverForm.send_dept = this.currentMgroup.belong_dept;
this.handoverForm.send_mgroup = this.currentMgroup.id;
this.handoverForm.material = item.material;
this.handoverForm.batch = item.batch;
},
submitHandover() { submitHandover() {
this.$API.wpm.handover.create.req(this.handoverForm).then((res) => { this.$API.wpm.handover.create.req(this.handoverForm).then((res) => {
this.$message.success("创建成功"); this.$message.success("创建成功");

View File

@ -57,7 +57,7 @@
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<el-container> <el-container>
<el-aside style="width:50%"> <el-aside style="width:60%">
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
@ -70,21 +70,17 @@
<el-main> <el-main>
<scTable ref="table2" :apiObj="apiObjHandover" row-key="id" stripe :params="paramsHandover"> <scTable ref="table2" :apiObj="apiObjHandover" row-key="id" stripe :params="paramsHandover">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="送料日期" prop="send_date"> <el-table-column label="送料日期" prop="send_date" width="120">
</el-table-column> </el-table-column>
<el-table-column label="产物" prop="material" show-overflow-tooltip> <el-table-column label="产物" prop="material_name" show-overflow-tooltip width="120">
<template #default="scope">
<span v-if="scope.row.material_out_">
{{ scope.row.material_out_.full_name }}
</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="批次" prop="batch"> </el-table-column> <el-table-column label="批次" prop="batch"> </el-table-column>
<el-table-column label="数量" prop="count"> <el-table-column label="数量" prop="count">
</el-table-column> </el-table-column>
<el-table-column label="交送人" prop="send_user_name"> <el-table-column label="交送人" prop="send_user_name">
</el-table-column> </el-table-column>
<el-table-column label="接收部门" prop="recive_dept_name">
</el-table-column>
<el-table-column label="接收人" prop="recive_user_name"> <el-table-column label="接收人" prop="recive_user_name">
</el-table-column> </el-table-column>
<el-table-column label="是否确认" prop="submit_time"> <el-table-column label="是否确认" prop="submit_time">
@ -97,10 +93,10 @@
<el-table-column label="操作" fixed="right" align="left" width="100"> <el-table-column label="操作" fixed="right" align="left" width="100">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="handover_edit(scope.row)" <!-- <el-button link type="primary" @click="handover_edit(scope.row)"
v-auth="'handover.update'" v-if="scope.row.submit_time == null"> v-auth="'handover.update'" v-if="scope.row.submit_time == null">
编辑 编辑
</el-button> </el-button> -->
<el-button link type="danger" @click="handover_delete(scope.row)" <el-button link type="danger" @click="handover_delete(scope.row)"
v-auth="'handover.delete'" v-if="scope.row.submit_time == null"> v-auth="'handover.delete'" v-if="scope.row.submit_time == null">
删除 删除
@ -125,29 +121,7 @@
<el-main> <el-main>
<scTable ref="table_wm" :apiObj="apiObjWm" row-key="id" :params="paramsWm" stripe <scTable ref="table_wm" :apiObj="apiObjWm" row-key="id" :params="paramsWm" stripe
hidePagination> hidePagination>
<el-table-column label="物料名" prop="material"> <el-table-column label="物料" prop="material_name">
<template #default="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
<el-table-column label="规格" prop="material">
<template #default="scope">{{
scope.row.material_.specification
}}</template>
</el-table-column>
<el-table-column label="型号" prop="material">
<template #default="scope">{{
scope.row.material_.model
}}</template>
</el-table-column>
<el-table-column label="已到工序" prop="material">
<template #default="scope">{{
scope.row.material_.process_name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="批次" prop="batch"> </el-table-column> <el-table-column label="批次" prop="batch"> </el-table-column>
<el-table-column label="数量" prop="count" width="80"> <el-table-column label="数量" prop="count" width="80">
@ -165,11 +139,11 @@
<el-row> <el-row>
<el-col :md="24" :sm="24"> <el-col :md="24" :sm="24">
<el-form-item label="交送物料" prop="wm"> <el-form-item label="交送物料" prop="wm">
<el-select v-model="handoverForm.wm" placeholder="交送物料" clearable style="width: 100%" <el-select v-model="selectWm" placeholder="交送物料" clearable style="width: 100%"
:disabled="handoverType == 'edit'"> :disabled="handoverType == 'edit'" value-key="id" @change="selectWmChange">
<el-option v-for="item in wmaterialList" :key="item.id" :label="item.material_name" <el-option v-for="item in wmaterialList" :key="item.id"
:value="item.id"> :label="item.material_name + '---' + item.batch" :value="item">
<span style="float: left">{{ item.material_name }} {{ item.batch }}</span> <span style="float: left">{{ item.material_name }}---{{ item.batch }}</span>
<span style=" <span style="
float: right; float: right;
color: var(--el-text-color-secondary); color: var(--el-text-color-secondary);
@ -257,7 +231,8 @@ export default {
deptOptions: [], deptOptions: [],
userList: [], userList: [],
userList2: [], userList2: [],
wmaterialList: [] wmaterialList: [],
selectWm: null,
} }
}, },
mounted() { mounted() {
@ -334,6 +309,7 @@ export default {
this.apiObjHandover = this.$API.wpm.handover.list this.apiObjHandover = this.$API.wpm.handover.list
this.paramsWm.belong_dept = this.currentMgroup.belong_dept this.paramsWm.belong_dept = this.currentMgroup.belong_dept
this.paramsWm.material__process__name__contains = '管料'
this.paramsWm.count__gte = 1 this.paramsWm.count__gte = 1
this.apiObjWm = this.$API.wpm.wmaterial.list this.apiObjWm = this.$API.wpm.wmaterial.list
@ -351,7 +327,6 @@ export default {
this.handoverForm.wm = ''; this.handoverForm.wm = '';
this.handoverForm.send_date = ""; this.handoverForm.send_date = "";
this.handoverForm.send_user = ""; this.handoverForm.send_user = "";
this.handoverForm.count = 1;
this.handoverForm.recive_user = '';// this.handoverForm.recive_user = '';//
this.handoverForm.recive_dept = '';// this.handoverForm.recive_dept = '';//
@ -359,6 +334,15 @@ export default {
this.handoverType = 'add'; this.handoverType = 'add';
this.handoverVisible = true; this.handoverVisible = true;
}, },
selectWmChange(item) {
this.handoverForm.count = item.count
this.handoverForm.count_eweight = item.count_eweight
this.handoverForm.wm = item.id
this.handoverForm.send_dept = this.currentMgroup.belong_dept;
this.handoverForm.send_mgroup = this.currentMgroup.id;
this.handoverForm.material = item.material;
this.handoverForm.batch = item.batch;
},
getWmaterial() { getWmaterial() {
let obj = {}; let obj = {};
obj.belong_dept = this.currentMgroup.belong_dept; obj.belong_dept = this.currentMgroup.belong_dept;
@ -370,7 +354,7 @@ export default {
}) })
}, },
submitHandover() { submitHandover() {
this.$API.wpm.handover.genByWm.req(this.handoverForm).then((res) => { this.$API.wpm.handover.create.req(this.handoverForm).then((res) => {
this.$message.success("创建成功"); this.$message.success("创建成功");
this.handoverVisible = false; this.handoverVisible = false;
this.$refs.table2.refresh(); this.$refs.table2.refresh();

View File

@ -615,7 +615,7 @@ export default {
count_n_js: 0, count_n_js: 0,
count_n_qx: 0, count_n_qx: 0,
count_n_qt: 0, count_n_qt: 0,
count_n_xzp:0, count_n_xzp: 0,
count_break: 0, count_break: 0,
count_notok: 0, count_notok: 0,
mlogb: [], mlogb: [],
@ -720,7 +720,7 @@ export default {
let list = res.filter(item => let list = res.filter(item =>
item.rule == '长白班' item.rule == '长白班'
); );
if (that.activeType !== '10车间') { if (that.activeType !== '10车间' && list.length > 0) {
that.form.shift = list[0].id; that.form.shift = list[0].id;
} }
}); });
@ -870,6 +870,9 @@ export default {
this.$refs.dialogForm.validate(async (valid) => { this.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
this.isSaveing = true; this.isSaveing = true;
if (this.activeType == '8车间') {
this.form.count_ok = this.form.count_real;
}
if (this.activeType == "7车间") { if (this.activeType == "7车间") {
this.form.mtask = this.mtask; this.form.mtask = this.mtask;
this.form.count_notok = this.form.count_notok =
@ -962,16 +965,16 @@ export default {
// //
setData(data) { setData(data) {
Object.assign(this.form, data); Object.assign(this.form, data);
if (this.activeType == "8车间") { // if (this.activeType == "8") {
if (this.form.handle_user.indexOf(",") > -1) { // if (this.form.handle_user.indexOf(",") > -1) {
this.handle_user = this.form.handle_user.split(","); // this.handle_user = this.form.handle_user.split(",");
} else { // } else {
this.handle_user = [this.form.handle_user]; // this.handle_user = [this.form.handle_user];
} // }
} else { // } else {
this.form.rate = this.form.rate =
(this.form.count_ok / this.form.count_real) * 100 + "%"; (this.form.count_ok / this.form.count_real) * 100 + "%";
} // }
}, },
// //
setFilters(filters) { setFilters(filters) {