fix:玻纤车间物料完成未完成分开

This commit is contained in:
shijing 2025-05-29 10:13:11 +08:00
parent 10a9ffba15
commit dd4bffd0a2
6 changed files with 1633 additions and 3 deletions

View File

@ -0,0 +1,28 @@
<template>
<widgets @on-mounted="onMounted"></widgets>
</template>
<script>
import { defineAsyncComponent } from "vue";
const widgets = defineAsyncComponent(() => import("./widgets/index_bx.vue"));
export default {
name: "dashboard",
components: {
widgets,
},
data() {
return {
pageLoading: true,
};
},
mounted() {},
methods: {
onMounted() {
this.pageLoading = false;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,447 @@
<template>
<div class="widgets-home" ref="main">
<div class="widgets-content">
<el-row>
<el-col :span="8">
<div class="retangleWrap">
<div class="retangleContainer">
<div class="retangleTitle">
<div class="title">待接收的物料</div>
</div>
<div class="retangleTable">
<el-table
:data="equipList"
style="width: 100%; height: 285px"
>
<el-table-column
prop="number"
label="设备编号"
/>
<el-table-column
prop="name"
label="设备名称"
/>
<el-table-column
prop="belong_dept_name"
label="所在车间"
/>
<el-table-column
prop="state"
label="设备状态"
>
<template #default="scope">
{{eqState_[scope.row.state]}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="retangleWrap">
<div class="retangleContainer">
<div class="retangleTitle">
<div class="title">待接收的物料</div>
</div>
<div class="retangleTable">
<el-table
:data="equipList"
style="width: 100%; height: 285px"
>
<el-table-column
prop="number"
label="设备编号"
/>
<el-table-column
prop="name"
label="设备名称"
/>
<el-table-column
prop="belong_dept_name"
label="所在车间"
/>
<el-table-column
prop="state"
label="设备状态"
>
<template #default="scope">
{{eqState_[scope.row.state]}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="retangleWrap">
<div class="retangleContainer">
<div class="retangleTitle">
<div class="title">待接收的物料</div>
</div>
<div class="retangleTable" style="">
<el-table
:data="equipList"
style="width: 100%; height: 285px"
>
<el-table-column
prop="number"
label="设备编号"
/>
<el-table-column
prop="name"
label="设备名称"
/>
<el-table-column
prop="belong_dept_name"
label="所在车间"
/>
<el-table-column
prop="state"
label="设备状态"
>
<template #default="scope">
{{eqState_[scope.row.state]}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="15">
<div class="retangleWrap">
<div class="retangleContainer">
<div class="retangleTitle">
<div class="title">待接收的物料</div>
</div>
<div class="retangleTable">
<el-table
:data="equipList"
style="width: 100%; height: 285px"
>
<el-table-column
prop="number"
label="设备编号"
/>
<el-table-column
prop="name"
label="设备名称"
/>
<el-table-column
prop="belong_dept_name"
label="所在车间"
/>
<el-table-column
prop="state"
label="设备状态"
>
<template #default="scope">
{{eqState_[scope.row.state]}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</el-col>
<el-col :span="9">
<div class="retangleWrap">
<div class="retangleContainer">
<div class="retangleTitle">
<div class="title">待接收的物料</div>
</div>
<div class="retangleTable">
<el-table
:data="equipList"
style="width: 100%; height: 285px"
>
<el-table-column
prop="number"
label="设备编号"
/>
<el-table-column
prop="name"
label="设备名称"
/>
<el-table-column
prop="belong_dept_name"
label="所在车间"
/>
<el-table-column
prop="state"
label="设备状态"
>
<template #default="scope">
{{eqState_[scope.row.state]}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
data() {
return {
time: "",
day: "",
year_s: "",
day_s: "",
month_s: "",
yesterday: "",
eqState_: {
10: "完好",
20: "限用",
30: "在修",
40: "禁用",
},
equipList: [],
tableData: [],
warningMaterial: [],
materialType: "20",
};
},
mounted() {
this.$emit("on-mounted");
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
let month = myDate.getMonth() + 1;
let day = myDate.getDate();
that.year_s = year;
that.month_s = month;
that.day_s = day;
this.getEquipList();
this.getMaterialWarning();
this.getMaterialList();
},
methods: {
// Class
bindClass(rate) {
let classInfo = {
socketDom: true,
redColor: false,
greenColor: true,
};
if (rate > 0) {
classInfo.greenColor = true;
} else if (rate < 0) {
classInfo.redColor = true;
}
return classInfo;
},
//
getEquipList() {
this.$API.em.equipment.list
.req({ page: 0, type: 10 })
.then((res) => {
this.equipList = res;
});
},
materialTypeChange() {
this.getMaterialList();
},
//
getMaterialList() {
let that = this;
that.$API.mtm.material.list
.req({ page: 0, type: that.materialType })
.then((res) => {
that.tableData = res.filter((item) => {
return item.count > 0;
});
});
},
//
getMaterialWarning() {
let that = this;
that.$API.mtm.material.list
.req({ page: 0, type__in: "10,20", count__lte: 1 })
.then((res) => {
if (res.length > 0) {
console.log("getMaterialWarning", res);
that.warningMaterial = res;
} else {
}
});
},
},
};
</script>
<style scoped lang="scss">
.retangleWrap {
width: 100%;
padding: 25px 20px 0 20px;
box-sizing: border-box;
}
.retangleContainer {
width: 100%;
border-radius: 15px;
box-sizing: border-box;
position: relative;
background: #ffffff;
height: auto;
padding-top: 20px;
}
.retangleTitle {
display: flex;
justify-content: space-between;
padding: 0 24px;
}
.retangleTitle > .title {
color: rgb(30, 30, 30);
font-size: 16px;
font-weight: 400;
line-height: 24px;
}
.retangleTable {
padding: 20px 24px 24px 24px
}
.radios_group {
color: rgb(122, 121, 121);
size: 12px;
font-weight: 290;
line-height: 22px;
height: 23px;
}
.retangleImg {
height: 188px;
color: #ffffff;
padding-left: 43px;
background: linear-gradient(
180deg,
rgb(58, 149, 255),
rgb(27, 92, 255) 100%
);
}
.companyName {
padding-top: 28px;
font-size: 24px;
line-height: 28px;
padding-bottom: 23px;
}
.companyDesc {
padding-left: 4px;
font-size: 14px;
line-height: 20px;
}
.topCardImg {
height: 188px;
position: absolute;
right: 10px;
top: 0;
}
.countRetangle {
height: 180px;
padding-top: 20px;
box-sizing: border-box;
}
.countItem {
width: 20%;
padding-left: 24px;
display: inline-block;
box-sizing: border-box;
border-right: 1px solid #eeeeee;
}
.countItem:last-child {
border-right: 0;
}
.countname {
font-size: 14px;
line-height: 22px;
color: rgba(94, 94, 94);
}
.countnum {
font-size: 30px;
padding-bottom: 11px;
line-height: 38px;
}
.countrate {
line-height: 20px;
color: rgba(0, 0, 0, 0.45);
}
.redColor {
color: rgb(255, 73, 87);
}
.greenColor {
color: rgb(71, 201, 58);
}
.middleRetangle {
border-radius: 2px;
position: relative;
box-sizing: border-box;
}
.middleItem {
width: 25%;
padding-left: 34px;
display: inline-block;
box-sizing: border-box;
}
.middleItem:first-child {
border-right: 1px solid #eeeeee;
}
.bottomRetangle {
padding: 20px 0;
box-sizing: border-box;
background: #ffffff;
}
.warningHead {
display: flex;
justify-content: space-between;
padding: 0 24px;
}
.warningHeadText {
font-size: 16px;
font-weight: 400;
line-height: 24px;
}
.warningTableHead {
display: flex;
height: 35px;
line-height: 35px;
font-size: 18spx;
padding: 0 24px;
}
.warningTbleBody {
padding: 0 24px;
height: 276px;
overflow-y: scroll;
}
.warningFlex1 {
flex: 1;
}
.warningNumberStyle {
color: red;
font-weight: bold;
text-align: right;
}
</style>

View File

@ -0,0 +1,270 @@
<template>
<el-dialog
:title="titleMap[mtype]"
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-col>
<span>交接物料{{codeText}}</span>
<span style="margin: 0 20px;">物料总数{{totalCount}} </span>
<el-button type="primary" @click="batchAdd">分批</el-button>
</el-col>
<el-form-item label="剩余可分配数量:" label-width="130">
{{saveCount}}
</el-form-item>
</el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="批次号">
<el-input v-model="listItem.batch"></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="数量">
<el-input-number
v-model="listItem.count"
controls-position="right"
:min="0"
step="1"
:max="batchOrign.count"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange($index)"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="交送日期" prop="send_date">
<el-date-picker
v-model="form.send_date"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注">
<el-input v-model="form.note" placeholder="处理备注"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer v-if="mode!=='show'">
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-dialog>
</template>
<script>
import scanDialog from "./../template/scan.vue";
export default {
emits: ["success", "closed"],
props: {
type: {
type: Number,
default: 10,
},
mgroupId: {
type: String,
default: "",
},
process:{
type:String,
default:""
}
},
components: {
scanDialog
},
data() {
return {
selectItems:[],
loading: false,
mode: "add",
titleMap: {
20: "分批",
30: "合批",
},
mtype:20,
saveCount:0,
form: {
send_date: null,
send_user: null,
send_mgroup: null,
recive_user: null,
recive_mgroup: null,
handoverb:[],
},
rules: {
batch: [
{
required: true,
message: "请输入批次号",
trigger: "blur",
},
],
wm: {
required: true,
message: "请选择物料",
trigger: "blur",
},
},
batchOrign:{},
totalCount: 0,
materialOptions: [],
visible: false,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
let that = this;
that.form.type = that.type;
that.form.handle_date = that.form.send_date = that.$TOOL.dateFormat2(new Date());
that.form.send_mgroup = that.form.recive_mgroup = that.mgroupId;
let userInfo = that.$TOOL.data.get("USER_INFO");
that.form.send_user = that.form.recive_user= userInfo.id;
},
methods: {
//
open(mode = "add",data,mtype) {
this.mode = mode;
this.form.mtype = mtype;
this.codeText = data.batch;
this.batchOrign = data;
this.totalCount = data.count;
let obj = { };
obj.wm = data.id;
obj.batch = data.batch+"-1";
obj.count = data.count;
this.saveCount = 0;
this.form.handoverb.push(obj)
this.visible = true;
return this;
},
batchAdd(){
let that = this;
if(that.saveCount>0){
let indexs = that.form.handoverb.length+1;
let count = 0;
that.form.handoverb.forEach(item=>{
count+=item.count;
})
let obj = { };
obj.wm = that.batchOrign.id;
obj.batch = that.codeText+"-"+indexs;
obj.count = that.batchOrign.count - count;
that.saveCount = 0;
that.form.handoverb.push(obj)
}else{
that.$message.warning("已无可分配数量");
}
},
delMaterial(index){
this.form.handoverb.splice(index,1);
this.countChange();
},
countChange(index){
let that = this;
let totalCount = 0;
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
totalCount += item.count;
})
let saveCount = that.batchOrign.count-totalCount;
if(saveCount<0){//数量不能大于总数量
this.form.handoverb[index].count = 0;
let total = 0;
this.form.handoverb.forEach(item=>{
total += item.count;
})
this.form.handoverb[index].count = that.batchOrign.count-total;
that.saveCount = 0;
}else{
that.saveCount = that.batchOrign.count-totalCount;
}
}
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
let total = 0;
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
total += item.count;
})
}
if(total>that.totalCount){
that.$message.error("分配数量不能大于总数量");
}else{
that.form.wm = that.batchOrign.id;
if (that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
that.$API.wpm.handover.submit.req(res.id).then((res1) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}).catch((err) => {
//
that.isSaveing = false;
return err;
});
}
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
console.log('this.form',this.form);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style scoped>
.formTitle {
margin-bottom: 10px;
font-weight: 600;
}
.total-count{
width: 100%;
text-align: right;
height: 50px;
line-height: 50px;
}
</style>

View File

@ -56,23 +56,38 @@
:mgroupName="mgroupName" :mgroupName="mgroupName"
:process = "mgroupProcess" :process = "mgroupProcess"
:deptId="mgroupDept"></inm> :deptId="mgroupDept"></inm>
<!-- 未完成 -->
<inmIn v-else-if="values == '未完成'&&componentsShow"
:mgroup_code="mgroup_code"
:mgroupId="mgroupId"
:mgroupName="mgroupName"
:process = "mgroupProcess"
:deptId="mgroupDept"></inmIn>
<!-- 已完成 -->
<inmOut v-else-if="values == '已完成'&&componentsShow"
:mgroup_code="mgroup_code"
:mgroupId="mgroupId"
:mgroupName="mgroupName"
:process = "mgroupProcess"
:deptId="mgroupDept"></inmOut>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
<script> <script>
import inm from "./inm.vue"; import inm from "./inm.vue";
import inmIn from "./inmIn.vue";
import inmOut from "./inmOut.vue";
import mlogs from "./mlogs.vue"; import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue"; import mtask from "./mtask.vue";
import handover from "./handover.vue"; import handover from "./handover.vue";
export default { export default {
name: "bx", name: "bx",
components: { inm, mlogs, mtask, handover }, components: { inm,inmIn, mlogs, mtask, handover,inmOut },
data() { data() {
return { return {
mgroups:[], mgroups:[],
tableHieght: 200, tableHieght: 200,
options: ["日志", "交接记录", "库存"], options: ["日志", "交接记录","库存", "未完成", "已完成"],
values: "日志", values: "日志",
mgroupName: "", mgroupName: "",
mgroupId: "", mgroupId: "",

419
src/views/wpm_bx/inmIn.vue Normal file
View File

@ -0,0 +1,419 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'" v-if="route_code=='qingxi'">领料</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
<!-- <scScanner :labeltext="'报废扫码'" @scanResult="codeTextChange40"></scScanner> -->
</div>
<div class="right-panel">
<el-select
v-model="query.state"
placeholder="物料状态"
clearable
@change="searchStateChange"
style="width: 250px"
>
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
style="margin-right: 5px"
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"
@selection-change="selectionChange"
>
<el-table-column type="selection"></el-table-column>
<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"
>
<template #default="scope">
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
</template>
</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="count_working"
min-width="80"
></el-table-column>
<el-table-column
label="不合格标记"
prop="defect_name"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100"
>
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</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"
:changebatch="changebatch"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
>
</scrap-dialog>
<showDrawer
ref="showDrawer"
v-if="visibleDrawer"
:wm="wm"
@closed="visibleDrawer = false"
>
</showDrawer>
<!-- 领料 -->
<save-dialog
v-if="dialog.inmRecord"
ref="inmRecordDialog"
:cate = "cate_type"
:process = "processId"
:mgroupId = "mgroupId"
:deptId = "deptId"
@success="handleinmSuccess"
>
</save-dialog>
<handover-dialog
v-if="dialog.handover"
ref="handoverDialog"
:type="type"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.handover = false"
>
</handover-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
import handoverDialog from "./handover_form2.vue";
import saveDialog from "./inm_record.vue";
export default {
props: {
deptId: {
type: String,
default: "",
},
mgroupId: {
type: String,
default: "",
},
mgroupName: {
type: String,
default: "",
},
processId: {
type: String,
default: "",
},
mgroupcode: {
type: String,
default: "",
},
},
components: {
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
printDialog,
handoverDialog
},
name: "wmaterial",
data() {
return {
wmState,
apiObj: null,
params: {
mgroup: "",
},
wmtype:0,
query: {
search: "",
state: null,
},
dialog: {
save: false,
scrap: false,
permission: false,
inmRecord:false,
print_m:false,
handover:false,
},
tableData: [],
selection: [],
stateOptions:[
{ value: 10, name: "合格"},
{ value: 20, name: "不合格"},
{ value: 30, name: "返工"},
],
queryWm: {
search: "",
material: "",
},
codeText2: "",
codeText4: "",
cate_type:'',
materialType: "wm",
changebatch:false,
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
printer_name:localStorage.getItem("printer_name"),
};
},
mounted() {
let that = this;
that.params.mgroup = that.mgroupId;
that.params.tag="todo";
that.$TOOL.data.set('gx_deptID',that.deptId)
that.apiObj = that.$API.wpm.wmaterial.list;
},
methods: {
selectionChange(selection) {
let that = this;
that.selection = selection;
//
if(selection.length>0){
let material = selection[0].material;
selection.forEach((item)=>{
if(item.material!==material){
that.$refs.table.toggleRowSelection(item, false);
that.$message.warning("该批次物料与前面的不一样");
}
})
}
},
//mtype:20
rowClick(row){
this.dialog.handover = true;
this.type = 10;
this.$nextTick(() => {
this.$refs.handoverDialog.open("add",row,20);
});
},
//mtype:30
batchConcat(){
this.changebatch = true;
let handoverb = [];
if(this.selection.length>0){
this.selection.forEach(item=>{
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.count_cando = item.count_cando;
obj.count = item.count_cando;
handoverb.push(obj)
})
}
this.type = 10;
this.dialog.scrap = true;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add",handoverb,30);
});
},
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(type) {
let that = this;
that.cate_type=type;
that.dialog.inmRecord = true;
that.$nextTick(() => {
that.$refs.inmRecordDialog.open("add");
});
},
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
//
tableCheckList(row){
this.wm = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
///
table_add(type) {
this.dialog.scrap = true;
this.type = type;
let handoverb = [];
if(this.selection.length>0){
this.selection.forEach(item=>{
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.count_cando = item.count_cando;
obj.count = item.count_cando;
handoverb.push(obj)
})
}
this.$nextTick(() => {
this.$refs.scrapDialog.open("add",handoverb,10);
});
},
codeTextChange20(codeText2){
let that = this;
that.type = 20;
that.codeText2 = codeText2;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText2,10);
});
},
codeTextChange40(codeText4){
let that = this;
that.type = 40;
that.codeText4 = codeText4;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText4,10);
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//
handleinmSuccess(){
this.$refs.table.refresh();
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
//
printMaterial(row){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
let params = {};
params.tid = row.id;
params.extra_data={count:row.count};
params.label_template_name = '工段物料打印模板';
that.apiObjPrint.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
}else{
that.$message.warning("请先设置打印机");
}
},
},
};
</script>
<style scoped></style>

451
src/views/wpm_bx/inmOut.vue Normal file
View File

@ -0,0 +1,451 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_in')" v-auth="'mio.do'"
v-if="route_code=='chengpingneiwaichujian'||route_code=='chengpneizhifujian'||route_code=='chengpingxinengjiance'||
route_code=='chenpjianchicunjiance'||route_code=='chengpwaiguanfujianyi'||route_code=='chengpwaiguanfujianer'"
>入库</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
<!-- <scScanner :labeltext="'报废扫码'" @scanResult="codeTextChange40"></scScanner> -->
</div>
<div class="right-panel">
<el-select
v-model="query.state"
placeholder="物料状态"
clearable
@change="searchStateChange"
style="width: 250px"
>
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
style="margin-right: 5px"
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"
@selection-change="selectionChange"
>
<el-table-column type="selection"></el-table-column>
<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"
>
<template #default="scope">
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
</template>
</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="count_working"
min-width="80"
></el-table-column>
<el-table-column
label="不合格标记"
prop="defect_name"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100"
>
<template #default="scope">
<el-button
link size="small"
@click="table_Check(scope.row)"
v-auth="'ftestwork.create'"
type="primary"
v-if="scope.row.defect_name == null"
>检验
</el-button>
<el-button
link size="small"
type="warning"
@click="tableCheckList(scope.row)"
v-if="scope.row.defect_name == null"
>检验记录
</el-button>
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</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>
<check-dialog
v-if="dialog.save"
ref="saveDialog"
:mgroup="mgroupId"
:mgroupName="mgroupName"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@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>
<handover-dialog
v-if="dialog.handover"
ref="handoverDialog"
:type="type"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.handover = false"
>
</handover-dialog>
<showDrawer
ref="showDrawer"
v-if="visibleDrawer"
:wm="wm"
@closed="visibleDrawer = false"
>
</showDrawer>
<save-dialog
v-if="dialog.inmRecord"
ref="inmRecordDialog"
:cate = "cate_type"
:process = "processId"
:mgroupId = "mgroupId"
:deptId = "deptId"
@success="handleinmSuccess"
>
</save-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
import handoverDialog from "./handover_form2.vue";
import saveDialog from "./inm_record.vue";
export default {
props: {
deptId: {
type: String,
default: "",
},
mgroupId: {
type: String,
default: "",
},
mgroupName: {
type: String,
default: "",
},
processId: {
type: String,
default: "",
},
mgroupcode: {
type: String,
default: "",
},
},
components: {
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
printDialog,
handoverDialog
},
name: "wmaterial",
data() {
return {
wmState,
apiObj: null,
params: {
mgroup: "",
belong_dept:''
},
wmtype:0,
query: {
search: "",
state: null,
},
dialog: {
save: false,
scrap: false,
permission: false,
inmRecord:false,
print_m:false,
handover:false,
},
tableData: [],
selection: [],
stateOptions:[
{ value: 10, name: "合格"},
{ value: 20, name: "不合格"},
{ value: 30, name: "返工"},
],
queryWm: {
search: "",
material: "",
},
route_code:"",
cate_type:'',
materialType: "wm",
changebatch:false,
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
printer_name:localStorage.getItem("printer_name"),
};
},
mounted() {
let that = this;
let paths = that.$route.path;
let arr = paths.split("/");
that.route_code = arr[2];
that.params.mgroup = that.mgroupId;
that.params.tag = 'done';
that.$TOOL.data.set('gx_deptID',that.deptId);
that.apiObj = that.$API.wpm.wmaterial.list;
// that.$refs.table.refresh();
},
methods: {
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
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(type) {
let that = this;
that.cate_type=type;
that.dialog.inmRecord = true;
that.$nextTick(() => {
that.$refs.inmRecordDialog.open("add");
});
},
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
rowClick(row){
this.dialog.handover = true;
this.type = 10;
this.$nextTick(() => {
this.$refs.handoverDialog.open("add",row,20);
});
},
//
tableCheckList(row){
this.wm = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
//
selectionChange(selection) {
let that = this;
that.selection = selection;
if(selection.length>0){
let material = selection[0].material;
selection.forEach((item)=>{
if(item.material!==material){
that.$refs.table.toggleRowSelection(item, false);
that.$message.warning("该批次物料与前面的不一样");
}
})
}
},
///
table_add(type) {
this.dialog.scrap = true;
this.type = type;
let handoverb = [];
if(this.selection.length>0){
this.selection.forEach(item=>{
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.count_cando = item.count_cando;
obj.count = item.count_cando;
handoverb.push(obj)
})
}
this.$nextTick(() => {
this.$refs.scrapDialog.open("add",handoverb,10);
});
},
codeTextChange20(codeText2){
let that = this;
that.type = 20;
that.codeText2 = codeText2;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText2,10);
});
},
codeTextChange40(codeText4){
let that = this;
that.type = 40;
that.codeText4 = codeText4;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText4,10);
});
},
batchConcat(){
this.changebatch = true;
let handoverb = [];
if(this.selection.length>0){
this.selection.forEach(item=>{
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.count_cando = item.count_cando;
obj.count = item.count_cando;
handoverb.push(obj)
})
}
this.type = 10;
this.dialog.scrap = true;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add",handoverb,30);
});
},
//
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//
handleinmSuccess(){
this.$refs.table.refresh();
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
//
printMaterial(row){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
let params = {};
params.tid = row.id;
params.extra_data={count:row.count};
params.label_template_name = '工段物料打印模板';
that.apiObjPrint.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
}else{
that.$message.warning("请先设置打印机");
}
},
},
};
</script>
<style scoped></style>