初始化仓库
This commit is contained in:
137
pages/basic/cutterBind.vue
Normal file
137
pages/basic/cutterBind.vue
Normal file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.shankCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
|
||||
v-model="installCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
bindRecord
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
shankCode: null,
|
||||
bladeCode: null,
|
||||
installBy: null,
|
||||
},
|
||||
installCode: null,
|
||||
rules: {
|
||||
bladeCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀刃编码!'
|
||||
}]
|
||||
},
|
||||
shankCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
installCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入安装员!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.shankCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarbladeCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.bladeCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
selectinstallBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.installBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarinstallBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.installCode = res.result;
|
||||
_this.selectinstallBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.bladeCode && this.formData.shankCode) {
|
||||
//判断安装员是否填入
|
||||
setTimeout(() => {
|
||||
if (this.formData.installBy) {
|
||||
this.$modal.loading('提交中')
|
||||
bindRecord(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀具安装成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入安装员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
227
pages/basic/cutterBladeEnd.vue
Normal file
227
pages/basic/cutterBladeEnd.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀刃编码" :labelWidth='90' name="cutterBladeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterBladeCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
|
||||
v-model="removeCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
|
||||
v-model="operatorCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
removeBlade
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
code: null,
|
||||
formData: {
|
||||
cutterBladeCode: null,
|
||||
equipmentCode: null,
|
||||
removeBy: null,
|
||||
operator: null
|
||||
},
|
||||
removeCode: null,
|
||||
operatorCode: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
entityOptions: [],
|
||||
materialOptions: [],
|
||||
rules: {
|
||||
equipmentCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入设备编码!'
|
||||
},
|
||||
{
|
||||
pattern: '^[A-Z0-9]+$',
|
||||
errorMessage: '请输入正确格式的设备编码!',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]
|
||||
},
|
||||
cutterBladeCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
//扫描物料编码带出绑定的刀具信息
|
||||
scanBarCode() {
|
||||
if (this.formData.materialCode) {
|
||||
console.log(this.formData.materialCode)
|
||||
this.range = [];
|
||||
//判断是否扫描二维码
|
||||
if (typeof(this.formData.materialCode) === 'string') {
|
||||
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
|
||||
.materialCode).materialName;
|
||||
if (this.formData.materialCode != "") {
|
||||
listEntity({
|
||||
cutterMaterialCode: this.formData.materialCode,
|
||||
cutterMaterialName: this.formData.materialName,
|
||||
}).then((resp) => {
|
||||
this.range = resp.rows;
|
||||
for (var i = 0; i < resp.rows.length; i++) {
|
||||
this.range[i].value = resp.rows[i].id;
|
||||
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
|
||||
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
|
||||
.rows[i].batchNo)
|
||||
}
|
||||
this.entityOptions = resp.rows;
|
||||
});
|
||||
} else {
|
||||
this.entityOptions = [];
|
||||
}
|
||||
} else if (typeof(this.formData.materialCode) === 'object') {
|
||||
if (this.formData.materialCode.id) {
|
||||
this.formData.cutterEntityId = this.formData.materialCode.id;
|
||||
getEntity(this.formData.materialCode.id).then(async res => {
|
||||
this.range.push(res.data);
|
||||
this.entityOptions = this.range;
|
||||
this.formData.cutterEntityCode = this.range[0].entityCode;
|
||||
this.range[0].value = this.range[0].id;
|
||||
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
|
||||
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
|
||||
.range[0].batchNo)
|
||||
})
|
||||
}
|
||||
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
|
||||
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
|
||||
}
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.cutterBladeCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据设备编码获取设备id
|
||||
getEquipmentId() {
|
||||
if (this.formData.equipmentCode) {
|
||||
listEquipment({
|
||||
equipmentCode: this.formData.equipmentCode
|
||||
}).then((resp) => {
|
||||
if (resp.rows.length > 0) {
|
||||
this.formData.equipmentId = resp.rows[0].id;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
scanBarequipmentCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.equipmentCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
selectoperator(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.operator = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
selectremoveBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.removeBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarremoveBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.removeCode = res.result;
|
||||
_this.selectremoveBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBaroperator() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.operatorCode = res.result;
|
||||
_this.selectoperator(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.equipmentCode && this.formData.cutterBladeCode) {
|
||||
//判断安装员是否填入
|
||||
setTimeout(() => {
|
||||
if (this.formData.removeBy) {
|
||||
this.$modal.loading('提交中')
|
||||
removeBlade(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀刃下机成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入拆卸员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
234
pages/basic/cutterBladeStart.vue
Normal file
234
pages/basic/cutterBladeStart.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :model="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀刃编码" :labelWidth='90' name="cutterBladeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterBladeCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
|
||||
v-model="installCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
|
||||
v-model="operatorCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
installBlade
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
code: null,
|
||||
formData: {
|
||||
cutterBladeCode: null,
|
||||
equipmentCode: null,
|
||||
installBy: null,
|
||||
operator: null
|
||||
},
|
||||
installCode: null,
|
||||
operatorCode: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
entityOptions: [],
|
||||
materialOptions: [],
|
||||
rules: {
|
||||
equipmentCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入设备编码!',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
pattern: '^[A-Z0-9]+$',
|
||||
errorMessage: '请输入正确格式的设备编码!',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]
|
||||
},
|
||||
cutterBladeCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀刃编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
//扫描物料编码带出绑定的刀具信息
|
||||
scanBarCode() {
|
||||
if (this.formData.materialCode) {
|
||||
console.log(this.formData.materialCode)
|
||||
this.range = [];
|
||||
//判断是否扫描二维码
|
||||
if (typeof(this.formData.materialCode) === 'string') {
|
||||
// this.formData.materialCode = this.code;
|
||||
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
|
||||
.materialCode).materialName;
|
||||
if (this.formData.materialCode != "") {
|
||||
listEntity({
|
||||
cutterMaterialCode: this.formData.materialCode,
|
||||
cutterMaterialName: this.formData.materialName,
|
||||
}).then((resp) => {
|
||||
this.range = resp.rows;
|
||||
for (var i = 0; i < resp.rows.length; i++) {
|
||||
this.range[i].value = resp.rows[i].id;
|
||||
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
|
||||
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
|
||||
.rows[i].batchNo)
|
||||
}
|
||||
this.entityOptions = resp.rows;
|
||||
});
|
||||
} else {
|
||||
this.entityOptions = [];
|
||||
}
|
||||
} else if (typeof(this.formData.materialCode) === 'object') {
|
||||
if (this.formData.materialCode.id) {
|
||||
this.formData.cutterEntityId = this.formData.materialCode.id;
|
||||
getEntity(this.formData.materialCode.id).then(async res => {
|
||||
this.range.push(res.data);
|
||||
this.entityOptions = this.range;
|
||||
this.formData.cutterEntityCode = this.range[0].entityCode;
|
||||
this.range[0].value = this.range[0].id;
|
||||
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
|
||||
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
|
||||
.range[0].batchNo)
|
||||
})
|
||||
}
|
||||
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
|
||||
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.cutterBladeCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据设备编码获取设备id
|
||||
getEquipmentId() {
|
||||
if (this.formData.equipmentCode) {
|
||||
listEquipment({
|
||||
equipmentCode: this.formData.equipmentCode
|
||||
}).then((resp) => {
|
||||
if (resp.rows.length > 0) {
|
||||
this.formData.equipmentId = resp.rows[0].id;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
scanBarequipmentCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.equipmentCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
selectoperator(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.operator = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
selectinstallBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.installBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarinstallBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.installCode = res.result;
|
||||
_this.selectinstallBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBaroperator() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.operatorCode = res.result;
|
||||
_this.selectoperator(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.equipmentCode && this.formData.cutterBladeCode) {
|
||||
console.log(this.formData);
|
||||
//判断安装员是否填入
|
||||
setTimeout(() => {
|
||||
if (this.formData.installBy) {
|
||||
this.$modal.loading('提交中')
|
||||
installBlade(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀刃上机成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入安装员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
234
pages/basic/cutterEnd.vue
Normal file
234
pages/basic/cutterEnd.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀柄编码" :labelWidth='90' name="cutterShankCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterShankCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
|
||||
v-model="removeCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
|
||||
v-model="operatorCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
removeShank
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
code: null,
|
||||
formData: {
|
||||
cutterShankCode: null,
|
||||
equipmentCode: null,
|
||||
removeBy: null,
|
||||
operator: null
|
||||
},
|
||||
removeCode: null,
|
||||
operatorCode: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
entityOptions: [],
|
||||
materialOptions: [],
|
||||
rules: {
|
||||
equipmentCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入设备编码!'
|
||||
},
|
||||
{
|
||||
pattern: '^[A-Z0-9]+$',
|
||||
errorMessage: '请输入正确格式的设备编码!',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]
|
||||
},
|
||||
cutterShankCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
//扫描物料编码带出绑定的刀具信息
|
||||
scanBarCode() {
|
||||
if (this.formData.materialCode) {
|
||||
console.log(this.formData.materialCode)
|
||||
this.range = [];
|
||||
//判断是否扫描二维码
|
||||
if (typeof(this.formData.materialCode) === 'string') {
|
||||
// this.formData.materialCode = this.code;
|
||||
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
|
||||
.materialCode).materialName;
|
||||
if (this.formData.materialCode != "") {
|
||||
listEntity({
|
||||
cutterMaterialCode: this.formData.materialCode,
|
||||
cutterMaterialName: this.formData.materialName,
|
||||
}).then((resp) => {
|
||||
this.range = resp.rows;
|
||||
for (var i = 0; i < resp.rows.length; i++) {
|
||||
this.range[i].value = resp.rows[i].id;
|
||||
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
|
||||
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
|
||||
.rows[i].batchNo)
|
||||
}
|
||||
this.entityOptions = resp.rows;
|
||||
});
|
||||
} else {
|
||||
this.entityOptions = [];
|
||||
}
|
||||
} else if (typeof(this.formData.materialCode) === 'object') {
|
||||
if (this.formData.materialCode.id) {
|
||||
this.formData.cutterEntityId = this.formData.materialCode.id;
|
||||
getEntity(this.formData.materialCode.id).then(async res => {
|
||||
this.range.push(res.data);
|
||||
this.entityOptions = this.range;
|
||||
this.formData.cutterEntityCode = this.range[0].entityCode;
|
||||
this.range[0].value = this.range[0].id;
|
||||
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
|
||||
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
|
||||
.range[0].batchNo)
|
||||
})
|
||||
}
|
||||
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
|
||||
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.cutterShankCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据设备编码获取设备id
|
||||
getEquipmentId() {
|
||||
if (this.formData.equipmentCode) {
|
||||
listEquipment({
|
||||
equipmentCode: this.formData.equipmentCode
|
||||
}).then((resp) => {
|
||||
if (resp.rows.length > 0) {
|
||||
this.formData.equipmentId = resp.rows[0].id;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
scanBarequipmentCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.equipmentCode = res.result;
|
||||
// _this.getEquipmentId();
|
||||
}
|
||||
});
|
||||
},
|
||||
selectoperator(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.operator = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
selectremoveBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.removeBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarremoveBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.removeCode = res.result;
|
||||
_this.selectremoveBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBaroperator() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.operatorCode = res.result;
|
||||
_this.selectoperator(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.equipmentCode && this.formData.cutterShankCode) {
|
||||
console.log(this.formData);
|
||||
//判断安装员是否填入
|
||||
setTimeout(() => {
|
||||
if (this.formData.removeBy) {
|
||||
this.$modal.loading('提交中')
|
||||
removeShank(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀柄下机成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入拆卸员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
235
pages/basic/cutterStart.vue
Normal file
235
pages/basic/cutterStart.vue
Normal file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :model="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀柄编码" :labelWidth='90' name="cutterShankCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterShankCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
|
||||
v-model="installCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
|
||||
v-model="operatorCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
installShank
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
code: null,
|
||||
formData: {
|
||||
cutterShankCode: null,
|
||||
equipmentCode: null,
|
||||
installBy: null,
|
||||
operator: null
|
||||
},
|
||||
installCode: null,
|
||||
operatorCode: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
entityOptions: [],
|
||||
materialOptions: [],
|
||||
rules: {
|
||||
equipmentCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入设备编码!',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
pattern: '^[A-Z0-9]+$',
|
||||
errorMessage: '请输入正确格式的设备编码!',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]
|
||||
},
|
||||
cutterShankCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
//扫描物料编码带出绑定的刀具信息
|
||||
scanBarCode() {
|
||||
if (this.formData.materialCode) {
|
||||
console.log(this.formData.materialCode)
|
||||
this.range = [];
|
||||
//判断是否扫描二维码
|
||||
if (typeof(this.formData.materialCode) === 'string') {
|
||||
// this.formData.materialCode = this.code;
|
||||
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
|
||||
.materialCode).materialName;
|
||||
if (this.formData.materialCode != "") {
|
||||
listEntity({
|
||||
cutterMaterialCode: this.formData.materialCode,
|
||||
cutterMaterialName: this.formData.materialName,
|
||||
}).then((resp) => {
|
||||
this.range = resp.rows;
|
||||
for (var i = 0; i < resp.rows.length; i++) {
|
||||
this.range[i].value = resp.rows[i].id;
|
||||
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
|
||||
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
|
||||
.rows[i].batchNo)
|
||||
}
|
||||
this.entityOptions = resp.rows;
|
||||
});
|
||||
} else {
|
||||
this.entityOptions = [];
|
||||
}
|
||||
} else if (typeof(this.formData.materialCode) === 'object') {
|
||||
if (this.formData.materialCode.id) {
|
||||
this.formData.cutterEntityId = this.formData.materialCode.id;
|
||||
getEntity(this.formData.materialCode.id).then(async res => {
|
||||
this.range.push(res.data);
|
||||
this.entityOptions = this.range;
|
||||
this.formData.cutterEntityCode = this.range[0].entityCode;
|
||||
this.range[0].value = this.range[0].id;
|
||||
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
|
||||
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
|
||||
.range[0].batchNo)
|
||||
})
|
||||
}
|
||||
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
|
||||
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.cutterShankCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据设备编码获取设备id
|
||||
getEquipmentId() {
|
||||
if (this.formData.equipmentCode) {
|
||||
listEquipment({
|
||||
equipmentCode: this.formData.equipmentCode
|
||||
}).then((resp) => {
|
||||
if (resp.rows.length > 0) {
|
||||
this.formData.equipmentId = resp.rows[0].id;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
scanBarequipmentCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.equipmentCode = res.result;
|
||||
// _this.getEquipmentId();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
selectoperator(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.operator = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
selectinstallBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.installBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarinstallBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.installCode = res.result;
|
||||
_this.selectinstallBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBaroperator() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.operatorCode = res.result;
|
||||
_this.selectoperator(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.equipmentCode && this.formData.cutterShankCode) {
|
||||
console.log(this.formData);
|
||||
//判断安装员是否填入
|
||||
setTimeout(() => {
|
||||
if (this.formData.installBy) {
|
||||
this.$modal.loading('提交中')
|
||||
installShank(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀柄上机成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入安装员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
166
pages/basic/cutterSwitch.vue
Normal file
166
pages/basic/cutterSwitch.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @change="scanbarshankCode"
|
||||
v-model="formData.shankCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="已绑定刀刃编码" :labelWidth='90' name="oldbladeCode">
|
||||
<uni-easyinput disabled v-model="oldbladeCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="切换人" :labelWidth='90' name="updateBy">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarupdateBy" @change="selectEmpCode"
|
||||
v-model="updateBy" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listInstallRecord,
|
||||
unbindRecord,
|
||||
bindRecord
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
shankCode: null,
|
||||
bladeCode: null,
|
||||
},
|
||||
//临时切换人编码
|
||||
updateBy: null,
|
||||
//切换人姓名
|
||||
updateName: null,
|
||||
//拆卸表单
|
||||
unbindForm: {},
|
||||
//安装表单
|
||||
bindForm: {},
|
||||
//旧刀刃编码
|
||||
oldbladeCode: null,
|
||||
rules: {
|
||||
bladeCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀刃编码!'
|
||||
}]
|
||||
},
|
||||
shankCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
selectEmpCode(code) {
|
||||
this.updateName = null;
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.updateName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.shankCode = res.result;
|
||||
_this.formData.scanbarshankCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanbarshankCode() {
|
||||
this.oldbladeCode = null;
|
||||
if (this.formData.shankCode) {
|
||||
listInstallRecord({
|
||||
shankCode: this.formData.shankCode,
|
||||
removeTime: null
|
||||
}).then(async res => {
|
||||
//判断是否存在已绑定且未拆卸的刀具
|
||||
console.log(res);
|
||||
for (var i in res.rows) {
|
||||
if (!res.rows[i].removeTime) {
|
||||
console.log(res.rows[i].bladeCode)
|
||||
this.oldbladeCode = res.rows[i].bladeCode;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBarbladeCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.bladeCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarupdateBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.updateBy = res.result;
|
||||
_this.selectEmpCode(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.bladeCode && this.formData.shankCode) {
|
||||
console.log(this.updateName)
|
||||
if (this.updateName) {
|
||||
this.unbindForm = {
|
||||
shankCode: this.formData.shankCode,
|
||||
bladeCode: this.oldbladeCode,
|
||||
removeBy: this.updateName
|
||||
}
|
||||
//拆卸
|
||||
unbindRecord(this.unbindForm);
|
||||
this.bindForm = this.formData
|
||||
this.bindForm.installBy = this.updateName;
|
||||
//由于bindRecord接口过快,导致切换人没有时间赋值,故设置定时器
|
||||
setTimeout(() => {
|
||||
this.$modal.loading('提交中')
|
||||
bindRecord(this.bindForm).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀具切换成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
}, 500);
|
||||
} else {
|
||||
this.$modal.msg("请输入切换人!")
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
132
pages/basic/cutterUnBind.vue
Normal file
132
pages/basic/cutterUnBind.vue
Normal file
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.shankCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
|
||||
v-model="removeCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listUseRecord,
|
||||
getUseRecord,
|
||||
delUseRecord,
|
||||
addStartUse,
|
||||
updateEndUse,
|
||||
listEntity,
|
||||
listMaterial,
|
||||
listEquipment,
|
||||
getEntity,
|
||||
unbindRecord
|
||||
} from "@/api/basic/cutter.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
shankCode: null,
|
||||
bladeCode: null,
|
||||
removeBy: null,
|
||||
},
|
||||
removeCode: null,
|
||||
rules: {
|
||||
bladeCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀刃编码!'
|
||||
}]
|
||||
},
|
||||
shankCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入刀柄编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.shankCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarbladeCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.bladeCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
selectremoveBy(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.formData.removeBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员,请重新输入!")
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarremoveBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.removeCode = res.result;
|
||||
_this.selectremoveBy(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(async res => {
|
||||
if (this.formData.bladeCode && this.formData.shankCode) {
|
||||
console.log(this.formData);
|
||||
setTimeout(() => {
|
||||
if (this.formData.removeBy) {
|
||||
this.$modal.loading('提交中')
|
||||
unbindRecord(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("刀具拆卸成功!")
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入拆卸员!")
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
207
pages/basic/empEqpEnd.vue
Normal file
207
pages/basic/empEqpEnd.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view>
|
||||
<t-emp />
|
||||
<view class="btns">
|
||||
<button type="primary" class="btn" @click="search">查询</button>
|
||||
<button type="primary" class="btn" @click="endAll" :disabled="searchEqpWithEmp.length===0">全部下机</button>
|
||||
</view>
|
||||
<h2 class="endableEqp">可下机设备</h2>
|
||||
<view class="eqps" v-for="(item, index) in searchEqpWithEmp" :key="index">
|
||||
<view class="info">
|
||||
<view class="item">设备编码:{{ item.eqpCode }}</view>
|
||||
<view class="item">设备名称:{{ item.eqpName }}</view>
|
||||
</view>
|
||||
<button type="primary" class="end" @click="end(index)">下机</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addEnd,
|
||||
listEmpEqpHistory
|
||||
} from '@/api/basic/empEqpHistory.js'
|
||||
|
||||
import {
|
||||
listEmployee
|
||||
} from '@/api/mes/jobIn.js'
|
||||
|
||||
import {
|
||||
getInfo
|
||||
} from '@/api/login.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
empCode: this.$store.state.employee.empCode,
|
||||
empName: this.$store.state.employee.empName,
|
||||
eqpCode: null,
|
||||
eqpName: null,
|
||||
searchEqpWithEmp: [],
|
||||
endEqp: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//根据员工姓名和员工编号来查询已上机但并未下机的设备
|
||||
//注:只用一个字段无法精确查找,可能查找到老员工
|
||||
search() {
|
||||
this.searchEqpWithEmp = [];
|
||||
listEmpEqpHistory({
|
||||
empName: this.empName,
|
||||
empCode: this.empCode
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
for (var i in res.rows) {
|
||||
//判断是否下机
|
||||
if (!res.rows[i].endTime) {
|
||||
this.searchEqpWithEmp.push({
|
||||
eqpCode: res.rows[i].equipmentCode,
|
||||
eqpName: res.rows[i].equipmentTitle
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.searchEqpWithEmp.length === 0) {
|
||||
return uni.showToast({
|
||||
title: '未查询到已上机设备',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$modal.showToast('没有可下机设备')
|
||||
}
|
||||
})
|
||||
},
|
||||
end(index) {
|
||||
this.$modal.loading('操作中')
|
||||
addEnd({
|
||||
empCode: this.empCode,
|
||||
eqpCode: this.searchEqpWithEmp[index].eqpCode
|
||||
}).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("下机成功!")
|
||||
this.search()
|
||||
})
|
||||
},
|
||||
endAll() {
|
||||
// 确认存在可下机设备
|
||||
if (this.searchEqpWithEmp.length === 0) {
|
||||
return uni.showToast({
|
||||
title: '没有可下机设备',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
// 确认操作弹窗
|
||||
uni.showModal({
|
||||
title: '操作确认',
|
||||
content: `确定要下机全部${this.searchEqpWithEmp.length}台设备吗?`,
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
this.$modal.loading('批量下机中...')
|
||||
|
||||
// 创建所有设备的Promise数组
|
||||
const requests = this.searchEqpWithEmp.map(device =>
|
||||
addEnd({
|
||||
empCode: this.empCode, // 使用动态empCode
|
||||
eqpCode: device.eqpCode
|
||||
})
|
||||
)
|
||||
|
||||
// 并发执行所有请求
|
||||
const results = await Promise.all(requests)
|
||||
|
||||
// 检查所有结果
|
||||
const allSuccess = results.every(res => res.code === 200)
|
||||
if (allSuccess) {
|
||||
this.$modal.msgSuccess(`成功下机${results.length}台设备`)
|
||||
this.search() // 刷新列表
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '部分设备下机失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '批量下机操作异常',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.$modal.closeLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
padding: 60rpx 40rpx;
|
||||
color: #000;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.empName {
|
||||
display: inline-block;
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
|
||||
.btns {
|
||||
margin-top: 100rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.btn {
|
||||
width: 300rpx;
|
||||
height: 100rpx;
|
||||
margin: 0;
|
||||
font-size: 40rpx;
|
||||
background-color: deepskyblue;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.endableEqp {
|
||||
margin: 60rpx 0 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.eqps {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding: 20rpx;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #f9f9f9;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 10rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.end {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
width: 200rpx;
|
||||
height: 90rpx;
|
||||
background-color: deepskyblue;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
270
pages/basic/empEqpStart.vue
Normal file
270
pages/basic/empEqpStart.vue
Normal file
@@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<t-emp />
|
||||
<uni-card class="eqpInfo">
|
||||
<uni-row class="eqpCode">
|
||||
<uni-col :span="10">
|
||||
<span>设备编码</span>
|
||||
</uni-col>
|
||||
<uni-col :span="14">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="eqpCode" type="text" />
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row class="eqpName">
|
||||
<uni-col :span="10">
|
||||
<span>设备名称</span>
|
||||
</uni-col>
|
||||
<uni-col :span="14">
|
||||
<span>{{ eqpName }}</span>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<button type="primary" class="searchBtn" @click="searchEqp">查询</button>
|
||||
</uni-card>
|
||||
<view class="jobInfo">
|
||||
<uni-card class="jobs" v-for="(item, index) in searchJobWithEqp" :key="index">
|
||||
<uni-section class="mb-10" :title="jobStatuses[item.jobStatus - 1]"
|
||||
:title-color="jobStatusColor[item.jobStatus - 1]" title-font-size="40rpx" type="line" />
|
||||
<uni-row>
|
||||
<uni-col :span="8">作业编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.jobCode }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">工单编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.pwoCode }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">目标产品编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.tarProCode }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">产品名称:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.tarProName }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">规格一:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.specification1 }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">制程名称:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.opTitle }}</uni-col>
|
||||
</uni-row><uni-row>
|
||||
<uni-col :span="8">目标产量:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.planNum }}</uni-col>
|
||||
</uni-row><uni-row>
|
||||
<uni-col :span="8">未完成:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.unfinishedNum }}</uni-col>
|
||||
</uni-row>
|
||||
</uni-card>
|
||||
</view>
|
||||
<button v-if="isLegal" type="primary" class="confirmStart" @click="submit">确认上机</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addStart,
|
||||
listEmpEqpHistory
|
||||
} from '@/api/basic/empEqpHistory.js'
|
||||
import {
|
||||
listPwoJob
|
||||
} from '@/api/mes/jobReport.js'
|
||||
import {
|
||||
listEmployee
|
||||
} from '@/api/mes/jobIn.js'
|
||||
import {
|
||||
listEquipment
|
||||
} from '@/api/basic/cutter.js'
|
||||
import {
|
||||
getInfo
|
||||
} from '@/api/login'
|
||||
import {
|
||||
getDicts
|
||||
} from '@/api/system/dict/dictData.js'
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userId: null,
|
||||
empName: this.$store.state.employee.empName,
|
||||
empCode: this.$store.state.employee.empCode,
|
||||
eqpCode: null,
|
||||
eqpId: null,
|
||||
eqpName: null,
|
||||
jobStatuses: [],
|
||||
jobStatusColor: [
|
||||
'#FFBA00',
|
||||
'#13CE66',
|
||||
'#1890FF'
|
||||
],
|
||||
searchJobWithEqp: [],
|
||||
isLegal: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 根据设备编码查询设备名称
|
||||
async searchEqp() {
|
||||
this.eqpId = null
|
||||
this.eqpName = null
|
||||
this.isLegal = false
|
||||
if (this.eqpCode) {
|
||||
await listEquipment({
|
||||
equipmentCode: this.eqpCode
|
||||
}).then((res) => {
|
||||
if (res.rows.length > 0) {
|
||||
this.eqpId = res.rows[0].id
|
||||
this.eqpName = res.rows[0].equipmentTitle
|
||||
this.isLegal = true
|
||||
} else {
|
||||
this.eqpName = null
|
||||
this.searchJobWithEqp = null
|
||||
this.$modal.showToast("未查询到设备信息,请检查设备编号")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$modal.showToast("请先输入设备编码")
|
||||
}
|
||||
this.searchJob()
|
||||
},
|
||||
// 根据设备查找关联的作业信息
|
||||
searchJob() {
|
||||
this.searchJobWithEqp = []
|
||||
if (!this.isLegal) {
|
||||
this.eqpName = null
|
||||
} else {
|
||||
this.$modal.loading('查询中')
|
||||
listPwoJob({
|
||||
eqpId: this.eqpId
|
||||
}).then(async res => {
|
||||
this.$modal.closeLoading()
|
||||
for (var i in res.rows) {
|
||||
// 只显示已派工、材料已转入、作业开工3个状态的作业信息
|
||||
let filterNum = res.rows[i].status % 9
|
||||
if (filterNum > 0 && filterNum < 4 && res.rows[i].status != 1) {
|
||||
this.searchJobWithEqp.push({
|
||||
jobCode: res.rows[i].code,
|
||||
pwoCode: res.rows[i].pwoCode,
|
||||
tarProCode: res.rows[i].ptNoTar,
|
||||
tarProName: res.rows[i].ptTitleTar,
|
||||
specification1: res.rows[i].specification1,
|
||||
opTitle: res.rows[i].opTitle,
|
||||
planNum: res.rows[i].targetNum,
|
||||
unfinishedNum: res.rows[i].unFinishQty,
|
||||
jobStatus: filterNum
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.showToast("查询失败")
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: (res) => {
|
||||
this.eqpCode = res.result;
|
||||
},
|
||||
fail: () => {
|
||||
this.$modal.showToast("获取设备编码失败")
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
if (this.eqpCode) {
|
||||
this.$modal.loading('提交中')
|
||||
addStart({
|
||||
empCode: this.empCode,
|
||||
eqpCode: this.eqpCode
|
||||
}).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("上机成功!")
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.showToast("请先输入设备编码")
|
||||
}
|
||||
}
|
||||
},
|
||||
// 根据账号获取员工姓名和账号ID
|
||||
onLoad() {
|
||||
// 获取字典中的作业状态
|
||||
getDicts("mes_job_status").then(res => {
|
||||
for (var i in res.data) {
|
||||
let filterNum = res.data[i].dictValue % 9
|
||||
if (filterNum > 0 && filterNum < 4 && res.data[i].dictValue != 1) {
|
||||
this.jobStatuses.push(res.data[i].dictLabel)
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(this.jobStatuses)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
padding: 6px 12px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - 44px);
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.eqpInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 20vh;
|
||||
margin: 10px 0 0 0 !important;
|
||||
padding: 0;
|
||||
border-radius: 10px;
|
||||
|
||||
.eqpCode,
|
||||
.eqpName,
|
||||
.searchBtn {
|
||||
flex: 1;
|
||||
font-size: 1.5rem;
|
||||
line-height: 2rem;
|
||||
}
|
||||
|
||||
.searchBtn {
|
||||
margin-top: 30rpx;
|
||||
height: 5vh;
|
||||
width: 80%;
|
||||
line-height: 5vh;
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.jobInfo {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
overflow: scroll;
|
||||
padding: 4px 0;
|
||||
|
||||
.jobs {
|
||||
margin: 0 0 2px 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.confirmStart {
|
||||
height: 6vh;
|
||||
width: 90vw;
|
||||
margin-top: 1vh;
|
||||
// height: 6vh;
|
||||
// position: absolute;
|
||||
// bottom: 4px;
|
||||
// left: 5vw;
|
||||
line-height: 6vh;
|
||||
font-size: 2rem;
|
||||
}
|
||||
</style>
|
||||
188
pages/basic/empStaEnd.vue
Normal file
188
pages/basic/empStaEnd.vue
Normal file
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-card class="empInfo">
|
||||
<uni-row>
|
||||
<uni-col :span="12">
|
||||
<span>员工姓名</span>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<span>{{ empName }}</span>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-card>
|
||||
<uni-card class="startedSta">
|
||||
<view class="startedStaTitle">
|
||||
可签退工位
|
||||
</view>
|
||||
<scroll-view scroll-y class="stations">
|
||||
<uni-card class="station" margin="10px 0" v-for="(sta, index) in startedStations" :key="index">
|
||||
<template v-slot:title>
|
||||
<uni-section type="line" :title="'签到时间:'+ sta.startTime" titleFontSize="1rem" />
|
||||
</template>
|
||||
<view class="staInfo">
|
||||
<view class="staTitle">{{sta.stationTitle}}</view>
|
||||
<view class="staCode">{{sta.stationCode}}</view>
|
||||
</view>
|
||||
<button class="checkoutBtn" type="warn" @click="checkOut(sta.logId)">签退</button>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
</uni-card>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listEmployee
|
||||
} from '@/api/mes/jobIn'
|
||||
import {
|
||||
getInfo
|
||||
} from '@/api/login'
|
||||
import {
|
||||
handleSignOut,
|
||||
listStationEmpHistory
|
||||
} from '@/api/basic/empStaHistory.js'
|
||||
import {
|
||||
getBeijingTime
|
||||
} from '@/utils/judge.ts'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userId: null,
|
||||
empName: null,
|
||||
empCode: null,
|
||||
stationCode: null,
|
||||
stationId: null,
|
||||
stationTitle: null,
|
||||
startedStations: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getStartedStation() {
|
||||
this.startedStations = []
|
||||
listStationEmpHistory({
|
||||
empName: this.empName
|
||||
}).then((res) => {
|
||||
const filteredData = res.rows.filter((item) => item.endTime == null)
|
||||
console.log(filteredData)
|
||||
if (filteredData.length > 0) {
|
||||
for (let i in filteredData) {
|
||||
this.startedStations.push({
|
||||
logId: filteredData[i].id,
|
||||
stationTitle: filteredData[i].stationTitle,
|
||||
stationId: filteredData[i].stationId,
|
||||
stationCode: filteredData[i].stationCode,
|
||||
startTime: filteredData[i].startTime
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$modal.showToast("没有可签退工位")
|
||||
}
|
||||
})
|
||||
},
|
||||
checkOut(id) {
|
||||
console.log(id)
|
||||
//根据记录id签退
|
||||
handleSignOut(id).then(() => {
|
||||
uni.showModal({
|
||||
title: `签退成功`,
|
||||
content: `${this.empName}\n${getBeijingTime()}`,
|
||||
showCancel: false
|
||||
})
|
||||
setTimeout(this.getStartedStation(), 1000)
|
||||
}).catch((err) => {
|
||||
uni.showModal({
|
||||
title: `签退失败`,
|
||||
content: err.msg,
|
||||
showCancel: false
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
async onLoad(option) {
|
||||
this.userId = option.userId
|
||||
this.empCode = option.empCode
|
||||
this.empName = option.empName
|
||||
|
||||
if (!this.userId || !this.empCode || !this.empName) {
|
||||
console.log("888")
|
||||
// 根据账号获取员工姓名和账号ID
|
||||
await getInfo().then(res => {
|
||||
this.empName = res.user.nickName
|
||||
this.userId = res.user.userId
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '当前账号无对应人员资料',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
//根据昵称获取对应员工编号
|
||||
await listEmployee({
|
||||
name: this.empName
|
||||
}).then(res => {
|
||||
this.empCode = res.rows[0].empCode
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '当前账号无对应人员资料',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
this.getStartedStation()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
box-sizing: border-box;
|
||||
|
||||
.empInfo span {
|
||||
line-height: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.startedSta {
|
||||
max-height: 80vh;
|
||||
|
||||
.startedStaTitle {
|
||||
border-radius: 10px;
|
||||
line-height: 2rem;
|
||||
font-size: 2rem;
|
||||
text-align: center;
|
||||
margin-bottom: 2vh;
|
||||
}
|
||||
|
||||
.stations {
|
||||
max-height: 80vh;
|
||||
|
||||
::v-deep uni-scroll-view-content {
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.staInfo {
|
||||
height: 8vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
margin-bottom: 1vh;
|
||||
|
||||
.staCode,
|
||||
.staTitle {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.staTitle {
|
||||
line-height: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.staCode {
|
||||
line-height: 1.2rem;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
257
pages/basic/empStaStart.vue
Normal file
257
pages/basic/empStaStart.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-card class="empInfo">
|
||||
<uni-row>
|
||||
<uni-col :span="12">
|
||||
<span>员工姓名</span>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<span>{{ empName }}</span>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-card>
|
||||
<uni-card class="staCode">
|
||||
<view class="card-content">
|
||||
<view class="codeTitle">工位编码</view>
|
||||
<view class="codeContent">
|
||||
<uni-icons class="scanIcon" @click="scanCode" type="icon-saoma" custom-prefix="iconfont"
|
||||
size="150"></uni-icons>
|
||||
<!-- <button class="codeShow">{{ stationCode }}</button> -->
|
||||
<uni-easyinput v-model="stationCode" @change="getStationTitle" focus style="width:70vw;"
|
||||
placeholder="输入/扫描工位编码" />
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
<uni-card class="staName">
|
||||
<view class="card-content">
|
||||
<view class="staTitle">工位名称</view>
|
||||
<view class="staContent">
|
||||
{{ stationTitle }}
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
<button :disabled="!stationTitle" type="primary" class="startBtn" @click="checkIn">签到</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listEmployee
|
||||
} from '@/api/mes/jobIn'
|
||||
import {
|
||||
getInfo
|
||||
} from '@/api/login'
|
||||
import {
|
||||
listStationEmpHistory,
|
||||
addStationEmpHistory
|
||||
} from '@/api/basic/empStaHistory.js'
|
||||
import {
|
||||
listStation
|
||||
} from '@/api/basic/station.js'
|
||||
import {
|
||||
getBeijingTime
|
||||
} from '@/utils/judge.ts'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userId: null,
|
||||
empName: null,
|
||||
empCode: null,
|
||||
// stationCode: "st001-5",
|
||||
stationCode: null,
|
||||
stationId: null,
|
||||
stationTitle: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkIn() {
|
||||
if (this.stationId && this.stationTitle) {
|
||||
addStationEmpHistory({
|
||||
empCode: this.empCode,
|
||||
empName: this.empName,
|
||||
stationId: this.stationId,
|
||||
stationCode: this.stationCode,
|
||||
stationTitle: this.stationTitle
|
||||
}).then((res) => {
|
||||
uni.showModal({
|
||||
title: `签到成功`,
|
||||
content: `${this.empName}\n${getBeijingTime()}`,
|
||||
showCancel: false
|
||||
})
|
||||
}).catch((err) => {
|
||||
uni.showModal({
|
||||
title: `签到失败`,
|
||||
content: `${err.msg}`,
|
||||
showCancel: false
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
scanCode() {
|
||||
const _this = this
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.stationCode = res.result
|
||||
_this.getStationTitle()
|
||||
}
|
||||
})
|
||||
},
|
||||
getStationTitle() {
|
||||
listStation({
|
||||
stationCode: this.stationCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0 && res.rows[0].stationCode === this.stationCode) {
|
||||
this.stationId = res.rows[0].id
|
||||
this.stationTitle = res.rows[0].stationTitle
|
||||
} else if (this.stationCode) {
|
||||
this.$modal.showToast("未查询到该工位")
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.showToast("获取工位名称失败")
|
||||
this.stationTitle = ""
|
||||
})
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.userId = option.userId
|
||||
this.empCode = option.empCode
|
||||
this.empName = option.empName
|
||||
|
||||
if (this.userId && this.empCode && this.empName) {
|
||||
return
|
||||
}
|
||||
// 根据账号获取员工姓名和账号ID
|
||||
getInfo().then(res => {
|
||||
this.empName = res.user.nickName
|
||||
this.userId = res.user.userId
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '当前账号无对应人员资料',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
//根据昵称获取对应员工编号
|
||||
listEmployee({
|
||||
name: this.empName
|
||||
}).then(res => {
|
||||
this.empCode = res.rows[0].empCode
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '当前账号无对应人员资料',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
box-sizing: border-box;
|
||||
|
||||
.empInfo span {
|
||||
line-height: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.staCode {
|
||||
height: 37vh;
|
||||
font-size: 2rem;
|
||||
|
||||
/* 覆盖 uni-card 默认 padding */
|
||||
::v-deep .uni-card__content {
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
/* 继承父容器高度 */
|
||||
}
|
||||
|
||||
.card-content {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.codeTitle {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
font-size: 2rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.codeContent {
|
||||
flex: 5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.scanIcon {
|
||||
flex: 3;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.codeShow {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.staName {
|
||||
height: 35vh;
|
||||
font-size: 2rem;
|
||||
|
||||
/* 覆盖 uni-card 默认 padding */
|
||||
::v-deep .uni-card__content {
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
/* 继承父容器高度 */
|
||||
}
|
||||
|
||||
.card-content {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.staTitle {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
font-size: 2rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.staContent {
|
||||
flex: 5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.startBtn {
|
||||
width: 93vw;
|
||||
margin-top: 1vh;
|
||||
line-height: 7vh;
|
||||
font-size: 3rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
244
pages/basic/searchJobs.vue
Normal file
244
pages/basic/searchJobs.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="status-bar"></view>
|
||||
<t-emp />
|
||||
<view class="jobInfo">
|
||||
<uni-card class="jobs" v-for="(item, index) in searchJobWithEqp" :key="index">
|
||||
<uni-row>
|
||||
<uni-col :span="8">作业编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.code }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">目标产品编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.ptNoTar }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">目标产品名称:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.ptTitleTar }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">设备编码:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.eqpCode }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">计划数量:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.targetNum }}</uni-col>
|
||||
</uni-row>
|
||||
<uni-row>
|
||||
<uni-col :span="8">未完成数量:</uni-col>
|
||||
<uni-col :span="12" :offset="3">{{ item.unFinishQty }}</uni-col>
|
||||
</uni-row>
|
||||
</uni-card>
|
||||
</view>
|
||||
<button type="primary" class="searchBtn" @click="fetchJobList">查询</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPwoJobLike } from '@/api/mes/pwoIn';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
empName: this.$store.state.employee.empName,
|
||||
empCode: this.$store.state.employee.empCode,
|
||||
eqpCode: null,
|
||||
eqpId: null,
|
||||
eqpName: null,
|
||||
startedEqp: [],
|
||||
searchJobWithEqp: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetchJobList() {
|
||||
this.searchJobWithEqp.length = 0;
|
||||
this.$modal.loading('获取作业中');
|
||||
try {
|
||||
const { rows } = await listPwoJobLike({
|
||||
employeeCode: this.empCode
|
||||
});
|
||||
this.searchJobWithEqp = rows;
|
||||
} catch(err) {
|
||||
this.$modal.msg('获取作业失败,请稍后重试');
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
},
|
||||
// 根据员工信息查询上机设备
|
||||
searchStartedEqp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.startedEqp = [];
|
||||
listEmpEqpHistory({
|
||||
empName: this.empName,
|
||||
empCode: this.empCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
for (let i in res.rows) {
|
||||
if (!res.rows[i].endTime) {
|
||||
this.startedEqp.push({
|
||||
eqpCode: res.rows[i].equipmentCode,
|
||||
eqpId: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.startedEqp.length === 0) {
|
||||
this.$modal.closeLoading()
|
||||
uni.showToast({
|
||||
title: '未查询到已上机设备',
|
||||
icon: 'none'
|
||||
});
|
||||
reject(new Error('无设备'));
|
||||
} else {
|
||||
resolve(); // 成功时调用 resolve
|
||||
}
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$modal.closeLoading()
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 根据设备编码查询设备id
|
||||
searchEqp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.startedEqp.length === 0) {
|
||||
this.$modal.closeLoading()
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const promises = this.startedEqp.map((eqp, index) => {
|
||||
return listEquipment({
|
||||
equipmentCode: eqp.eqpCode
|
||||
}).then(res => {
|
||||
this.startedEqp[index].eqpId = res.rows[0].id;
|
||||
}).catch(error => {
|
||||
this.$modal.closeLoading()
|
||||
this.$modal.showToast("查询设备id失败");
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
|
||||
Promise.all(promises)
|
||||
.then(() => resolve())
|
||||
.catch(error => reject(error));
|
||||
});
|
||||
},
|
||||
// 根据设备查找关联的作业信息
|
||||
searchJob() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.searchJobWithEqp = [];
|
||||
if (this.startedEqp.length === 0) {
|
||||
this.$modal.closeLoading()
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const promises = this.startedEqp.map((eqp, index) => {
|
||||
return listPwoJob({
|
||||
eqpId: eqp.eqpId
|
||||
}).then(res => {
|
||||
res.rows.forEach(row => {
|
||||
this.searchJobWithEqp.push({
|
||||
jobCode: row.code,
|
||||
tarProCode: row.ptNoTar,
|
||||
tarProName: row.ptTitleTar,
|
||||
eqpCode: eqp.eqpCode,
|
||||
planNum: row.targetNum,
|
||||
unfinishedNum: row.unFinishQty
|
||||
});
|
||||
});
|
||||
this.$modal.closeLoading()
|
||||
}).catch(error => {
|
||||
this.$modal.closeLoading()
|
||||
this.$modal.showToast("查询作业信息失败");
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
|
||||
Promise.all(promises)
|
||||
.then(() => resolve())
|
||||
.catch(error => reject(error));
|
||||
});
|
||||
},
|
||||
async searchJobWithEmp() {
|
||||
try {
|
||||
this.$modal.loading("查询中")
|
||||
await this.searchStartedEqp()
|
||||
await this.searchEqp()
|
||||
await this.searchJob()
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '查询失败',
|
||||
icon: 'none'
|
||||
});
|
||||
this.$modal.closeLoading()
|
||||
}
|
||||
}
|
||||
},
|
||||
// 根据账号获取员工姓名和账号ID
|
||||
// onLoad() {
|
||||
// getInfo().then(res => {
|
||||
// this.empName = res.user.nickName
|
||||
// }).catch(() => {
|
||||
// uni.showToast({
|
||||
// title: '当前账号无对应人员资料',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// })
|
||||
// //根据昵称获取对应员工编号
|
||||
// listEmployee({
|
||||
// name: this.empName
|
||||
// }).then(res => {
|
||||
// this.empCode = res.rows[0].empCode
|
||||
// }).catch(() => {
|
||||
// uni.showToast({
|
||||
// title: '当前账号无对应人员资料',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.status-bar {
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 6px 12px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - 44px);
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.jobInfo {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
overflow: scroll;
|
||||
padding: 10px 0;
|
||||
|
||||
.jobs {
|
||||
margin: 6px 0 0 !important;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.searchBtn {
|
||||
width: 100%;
|
||||
margin-top: 1vh;
|
||||
line-height: 6vh;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user