初始化仓库

This commit is contained in:
tao
2025-12-18 14:11:48 +08:00
parent e96f277a68
commit 54ec472bd4
1107 changed files with 158756 additions and 0 deletions

137
pages/basic/cutterBind.vue Normal file
View 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>

View 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>

View 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
View 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
View 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>

View 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>

View 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
View 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
View 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
View 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
View 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
View 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>

420
pages/bom/chiefRecords.vue Normal file
View File

@@ -0,0 +1,420 @@
<template>
<view>
<div id="body">
<div class="head">
<table>
<tr>
<td>&emsp;&emsp;:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描设备!"
v-model="machineCode"
@iconClick="iconClick('machineCode')"
/>
<div class="button" @click="clickButton('getSelect')">查询</div>
</td>
</tr>
<tr>
<td>当前状态</td><td>{{head.statusChina}}</td>
</tr>
<tr>
<td>开炉时间</td><td>{{head.openTime}}</td>
</tr>
<tr>
<td>关炉时间</td><td>{{head.closeTime}}</td>
</tr>
</table>
<div>
<div class="button" @click="clickButton('openTrue')">开炉</div>
<div class="button" @click="clickButton('openClose')">关炉</div>
<div class="button" @click="clickButton('openUpdate')" :class="{ 'bgColor-Click': open }">记录</div>
</div>
</div>
<div class="body">
<div class="button" @click="clickButton('getHistory')">查看历史</div>
<table v-show="open">
<tr>
<td>工单编码:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描工单编码!"
v-model="body.pwoCode"
@iconClick="iconClick('pwoCode')"
@change="getPwoCode"
/>
</td>
</tr>
<tr>
<td>物料编码:</td><td><uni-easyinput disabled v-model="body.ptNoTar" placeholder="工单扫完带出" /></td>
</tr>
<tr>
<td>物料名称:</td><td><uni-easyinput disabled v-model="body.ptTitleTar" placeholder="工单扫完带出"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;:</td><td><uni-easyinput v-model="body.parameter1" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;:</td><td><uni-easyinput v-model="body.parameter2" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;:</td><td><uni-easyinput v-model="body.parameter3" placeholder="输入"/></td>
</tr>
</table>
<button v-show="open" type="primary" style="width: 100%;" @click="clickButton('submit')">提交记录</button>
</div>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecord,
addMesFurnaceOperationRecord,
closeFurnace,
addMesFurnaceOperationRecordDetail
} from '@/api/mes/bom.js'
import {listPwoLike} from "@/api/mes/pwoIn.js"
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
machineCode:'',
head:{
updateTime:'',
openTime:'',
statusChina:'',
},
body:{},
open:false,
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'machineCode' ? _self.machineCode = res.result : value;
value === 'pwoCode' ? _self.body.pwoCode = res.result :value;
}
})
},
/**
* 按钮点击事件
* @param {Object} value
*/
clickButton(value){
const _self= this
if(_self.machineCode == '') {
return _self.messageType({
msgType:'warn',
messageText:'请输入设备代码'
})
}
if(_self.head.statusChina === undefined && value !== 'getSelect'){
return _self.messageType({
msgType:'warn',
messageText:'请先查询设备信息'
})
}
_self[value]()
},
/**
* 查询设备最近的记录
*/
async getSelect(){
const _self = this
const query = {
pageNum: 1,
pageSize: 1,
machineCode: _self.machineCode,
orderByColumn: "id",
isAsc: "desc",
}
let rows = (await _self.fnApi('listMesFurnaceOperationRecord',query))[0];
if(rows === undefined) return
_self.open = false;
rows = Object.assign(rows,{statusChina:await getStatus(rows)})
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 开炉事件
*/
async openTrue(){
const _self = this;
const {clearBy,clearTime,closeBy,closeTime,createBy,createTime,machineCode, machineId} = _self.head
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const openBy = uni.getStorageSync('HBusername')
const obj = Object.assign(_self.head,{
openBy,
openTime:beijingTime,
updateTime:beijingTime,
id:null,
status:0
})
await _self.fnApi('addMesFurnaceOperationRecord',obj)
_self.getSelect()
},
/**
* 关炉事件
*/
async openClose(){
const _self = this;
await _self.fnApi('closeFurnace',_self.head.id)
_self.getSelect()
},
/**
* 工单查询事件
* @param {Object} value
*/
async getPwoCode(value){
const _self = this;
const row = (await _self.fnApi('listPwoLike',{pwoCode:_self.body.pwoCode}))[0]
_self.body = Object.assign({},row)
},
/**
* 记录事件
*/
openUpdate(){
const _self = this;
_self.open = !_self.open
},
/**
* 提示信息
* @param {Object|undefined} value
* {msgType,messageText} 参数里面需要包含这两个键
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
addMesFurnaceOperationRecord,
closeFurnace:closeFurnace,
listMesFurnaceOperationRecord,
listPwoLike:listPwoLike,
addMesFurnaceOperationRecordDetail
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value)).rows
return data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 提交方法
*/
async submit(){
const _self = this;
const {id} =_self.head
const {pwoCode,materialCode,ptTitleTar,parameter1,parameter2,parameter3} = _self.body
const obj = {
createBy: null,
createTime: null,
delStatus: "0",
finalProductCode: null,
finalProductName: null,
furnaceOpRecCode: null,
furnaceOpRecId: id,
id:null,
materialCode,
materialName:ptTitleTar,
opType: null,
parameter1,
parameter2,
parameter3,
parameter4: null,
parameter5: null,
parameter6: null,
parameter7: null,
parameter8: null,
pwoCode,
remark: null,
updateBy: null,
updateTime: null,
}
await _self.fnApi('addMesFurnaceOperationRecordDetail',obj)
_self.messageType({
msgType:'success',
messageText:'提交成功'
})
},
/**
* 查看历史
*/
getHistory(){
const _self = this;
const obj = {
type : 'chiefRecords',
value : {id:_self.head.id}
}
//在起始页面跳转到test.vue页面并传递参数
uni.navigateTo({
url: '/pages/bom/history',
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('data', obj)
}
});
}
}
}
</script>
<style lang="scss" scoped>
#body{
margin: 0 auto;
width: 90vw;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
.head{
table{
&>tr:first-child>td:last-child{ //设置table里面的第一个tr的第二个td的宽
width: 71%;
// float: left;
& > * {
float: left;
font-size: $fontSize * 0.75;
}
& >*:first-child{
width: 70%;
}
& >*:last-child {
margin-left: 2%;
width: 25%;
min-height: 35px;
max-height: 50px;
border: 1px solid #a3cccc;
}
}
}
&>div{
display: flex; //设置子元素开启flex布局
justify-content: space-around; //设置子元素横向对齐方式
border-bottom: $fontSize / 10 solid #cbccbf; //设置div下面的框的样式
padding: $fontSize 0 $fontSize/2; //设置其内部子元素的所在位置
}
}
.body{
padding: $fontSize/2 0 0 0 ; //设置内边距
display: flex; //开启flex布局
flex-direction:row-reverse; //设置主轴对齐方向为水平,并且右对齐
flex-wrap: wrap ; //设置换行
&>div{
// width: 4 * $fontSize;
margin:0 $fontSize * 0.9 $fontSize 0;
}
table{
width: 100%;
float: left;
&>tr:first-child>td:last-child{
width: 70%;
}
}
}
.button{
width: 4 * $fontSize;
// aspect-ratio: 2; //设置元素纵横比,宽是高的两倍
border: $fontSize / 10 solid #a3cccc;
border-radius: 15%;
text-align: center;
// line-height: 2 * $fontSize;
}
}
@media (min-width: 100px) and (max-width: 600px) {
.head>table>tr:first-child>td:last-child>*:last-child{
font-size: 15px;
line-height: 35px;
}
}
@media (min-width: 600px) {
.head>table>tr:first-child>td:last-child>*:last-child{
font-size: 30px;
line-height: 50px;
}
}
.bgColor-Click{
background-color: #a3cccc;
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

View File

@@ -0,0 +1,268 @@
<template>
<view>
<div class="head">
<table>
<tr>
<td>&emsp;&emsp;:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描设备!"
v-model="machineCode"
@iconClick="iconClick('machineCode')"
/>
<div class="button" @click="clickButton('getSelect')">查询</div>
</td>
</tr>
<tr>
<td>当前状态</td><td>{{head.statusChina}}</td>
</tr>
<tr>
<td>开炉时间</td><td>{{head.openTime}}</td>
</tr>
<tr>
<td>关炉时间</td><td>{{head.closeTime}}</td>
</tr>
</table>
<div class="button" v-show="open" @click="clickButton('inClick')">清炉</div>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecord,
addMesFurnaceOperationRecord
} from '@/api/mes/bom.js'
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
head:{
statusChina:'',
closeTime:'',
openTime:'',
},
machineCode:'',
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
open:false
}
},
methods: {
/**
* 按钮点击事件
* @param {Object} value
*/
clickButton(value){
const _self= this
_self.open = false;
if(_self.machineCode == '') {
return _self.messageType({
msgType:'warn',
messageText:'请输入设备代码'
})
}
if( _self.head.statusChina === undefined && value !== 'getSelect'){
return _self.messageType({
msgType:'warn',
messageText:'请先查询设备信息'
})
}
_self[value]()
},
/**
* 提示信息
* @param {Object} obj
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecord,
addMesFurnaceOperationRecord,
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value)).rows
return data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 查询设备最近的记录
*/
async getSelect(){
const _self = this
const query = {
pageNum: 1,
pageSize: 1,
machineCode: _self.machineCode,
orderByColumn: "id",
isAsc: "desc",
}
let rows = (await _self.fnApi('listMesFurnaceOperationRecord',query))[0];
if(rows === undefined) return
const statusChina = await getStatus(rows)
rows = Object.assign(rows,{statusChina})
_self.open = statusChina =='关炉' ? true :false;
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 清炉事件
*/
async inClick(){
const _self = this;
const {closeBy,closeTime,createBy,createTime,machineCode, machineId} = _self.head
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const clearBy = uni.getStorageSync('HBusername');
const obj = Object.assign(_self.head,{
clearBy,
clearTime:beijingTime,
updateTime:beijingTime,
id:null,
status:2
})
await _self.fnApi('addMesFurnaceOperationRecord',obj)
_self.getSelect()
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #ffffff;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
view{
width: 96vw;
margin: 0 auto;
&>div{
display: flex;
justify-content:center;
flex-wrap: wrap ; //设置换行
}
.head{
border-bottom: 0.5vw solid #a2adab;
table{
&>tr:first-child>td:last-child{
&>* {
float: left;
}
&>*:first-child{
margin-right: 2%;
width: 75%;
}
&>*:last-child{
width: 20%;
min-height: 35px;
max-height: 50px;
margin:0;
border: 1px solid #a3cccc;
}
}
}
}
table{
width: 100%;
&>tr td:last-child{
width: 71%;
}
}
.button{
width: 4 * $fontSize;
// aspect-ratio: 2; //设置元素纵横比,宽是高的两倍
border: $fontSize / 10 solid #a3cccc;
border-radius: 15%;
text-align: center;
line-height: 2 * $fontSize;
margin: $fontSize /2 0;
}
}
}
@media (min-width: 100px) and (max-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 15px;
line-height: 35px;
}
}
@media (min-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 30px;
line-height: 50px;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

116
pages/bom/history.vue Normal file
View File

@@ -0,0 +1,116 @@
<template>
<view>
<uni-table ref="table" border stripe emptyText="暂无更多数据" >
<uni-tr>
<uni-th align="center">开炉记录编码</uni-th>
<uni-th align="center">工单编码</uni-th>
<uni-th align="center">物料名称</uni-th>
<uni-th align="center">参数1</uni-th>
<uni-th align="center">参数2</uni-th>
<uni-th align="center">参数3</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td align="center">{{ item.furnaceOpRecCode }}</uni-td>
<uni-td align="center">{{ item.pwoCode }}</uni-td>
<uni-td align="center">{{ item.materialName }}</uni-td>
<uni-td align="center">{{ item.parameter1 }}</uni-td>
<uni-td align="center">{{ item.parameter2 }}</uni-td>
<uni-td align="center">{{ item.parameter3 }}</uni-td>
</uni-tr>
</uni-table>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecordDetail,
} from '@/api/mes/bom.js'
import lodingVue from "@/utils/loding/loding.vue";
export default {
onLoad: function (option) { //option为object类型会序列化上个页面传递的参数
const _self = this;
const eventChannel = _self.getOpenerEventChannel();
eventChannel.on('data', function(data) {
console.log(data,_self)
_self[data.type](data.value)
})
},
data() {
return {
tableData:{},
message:{
msgType:'error',
messageText:'接口请求出错'
},
}
},
methods: {
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecordDetail
}
try{
const data = (await objApi[api](value)).rows
_self.$nextTick(()=>{
_self.$refs.popup.open()
})
return data
}catch(e){
//TODO handle the exception
_self.$nextTick(()=>{
_self.$refs.message.open()
})
}finally{
_self.$nextTick(()=>{
_self.$refs.popup.close()
})
}
},
/**
* 炉长记录查询
* @param {Object} value
*/
async chiefRecords(value){
const _self = this;
const {id} = value;
const obj = {
pageNum: 1,
pageSize: 50,
furnaceOpRecId: id,
}
_self.tableData = await _self.fnApi('listMesFurnaceOperationRecordDetail',obj)
},
},
}
</script>
<style lang="scss" scoped>
page{
$fontSize:5vw;
background-color: #ffffff;
font-size: $fontSize;
color: #6a6663;
view {
width: 98vw;
margin: 0 auto;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

View File

@@ -0,0 +1,360 @@
<template>
<view>
<div class="head">
<table>
<tr>
<td>&emsp;&emsp;:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描设备!"
v-model="machineCode"
@iconClick="iconClick('machineCode')"
/>
<div class="button" @click="clickButton('getSelect')">查询</div>
</td>
</tr>
<tr>
<td>当前状态</td><td>{{head.statusChina}}</td>
</tr>
<tr>
<td>开炉时间</td><td>{{head.openTime}}</td>
</tr>
<tr>
<td>关炉时间</td><td>{{head.closeTime}}</td>
</tr>
</table>
<div class="button" @click="clickButton('openUpdate')" :class="{ 'bgColor-Click': open }">记录</div>
</div>
<div class="body">
<div class="button" @click="clickButton('getHistory')">查看历史</div>
<table v-show="open">
<tr>
<td>工单编码:</td>
<td>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描工单编码!"
v-model="body.pwoCode"
@iconClick="iconClick('pwoCode')"
@change="getPwoCode"
/>
</td>
</tr>
<tr>
<td>物料编码:</td><td><uni-easyinput disabled v-model="body.materialCode" placeholder="工单扫完带出" /></td>
</tr>
<tr>
<td>物料名称:</td><td><uni-easyinput disabled v-model="body.materialName" placeholder="工单扫完带出"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;:</td><td><uni-easyinput v-model="body.parameter1" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;:</td><td><uni-easyinput v-model="body.parameter2" placeholder="输入"/></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;:</td><td><uni-easyinput v-model="body.parameter3" placeholder="输入"/></td>
</tr>
</table>
<button v-show="open" type="primary" style="width: 100%;" @click="clickButton('submit')">提交记录</button>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
import {
listMesFurnaceOperationRecord,
listMesFurnaceOperationRecordDetail,
updateMesFurnaceOperationRecordDetail
} from '@/api/mes/bom.js'
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
import {listPwoLike} from "@/api/mes/pwoIn.js"
export default {
components:{
lodingVue
},
data() {
return {
head:{
updateTime:'',
openTime:'',
},
machineCode:'',
body:{},
open:false,
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'machineCode' ? _self.machineCode = res.result : value;
value === 'pwoCode' ? _self.body.pwoCode = res.result :value;
}
})
},
/**
* 按钮点击事件
* @param {Object} value
*/
clickButton(value){
const _self= this
if(_self.machineCode == '') {
return _self.messageType({
msgType:'warn',
messageText:'请输入设备代码'
})
}
if( _self.head.statusChina === undefined && value !== 'getSelect'){
return _self.messageType({
msgType:'warn',
messageText:'请先查询设备信息'
})
}
_self[value]()
},
/**
* 查询设备最近的记录
*/
async getSelect(){
const _self = this
const query = {
pageNum: 1,
pageSize: 1,
machineCode: _self.machineCode,
orderByColumn: "id",
isAsc: "desc",
}
let rows = (await _self.fnApi('listMesFurnaceOperationRecord',query))[0];
if(rows === undefined) return
rows = Object.assign(rows,{statusChina:await getStatus(rows)})
_self.open = false;
_self.head = rows
/**
* 判断当期是清炉|关|开
* @param {Object} arr
*/
function getStatus (arr){
const obj = {
0:'开炉',
1:'关炉',
2:'清炉'
}
return obj[arr.status]
}
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecord,
listMesFurnaceOperationRecordDetail,
updateMesFurnaceOperationRecordDetail,
listPwoLike,
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value)).rows
return data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 提示信息
* @param {Object} obj
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
/**
* 记录事件
*/
async openUpdate(){
const _self = this;
_self.open = !_self.open
const {id} = _self.head
const obj = {
pageNum: 1,
pageSize: 1,
furnaceOpRecId: id,
orderByColumn: "id",
isAsc: "desc",
}
// const data = (await _self.fnApi('listMesFurnaceOperationRecordDetail',obj)[0]
const data = (await _self.fnApi('listMesFurnaceOperationRecordDetail',obj))[0]
_self.body = Object.assign({},data)
},
/**
* 工单查询事件
* @param {Object} value
*/
async getPwoCode(value){
const _self = this;
const row = (await _self.fnApi('listPwoLike',{pwoCode:_self.body.pwoCode}))[0]
_self.body = Object.assign({},_self.body,{
materialCode:row.ptNoTar,
materialName:row.ptTitleTar
})
},
/**
* 提交方法
*/
submit(){
const _self = this;
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
const obj = Object.assign(_self.body,{
updateTime:beijingTime
})
_self.fnApi('updateMesFurnaceOperationRecordDetail',obj)
},
/**
* 查看历史
*/
getHistory(){
const _self = this;
const obj = {
type : 'chiefRecords',
value : {id:_self.head.id}
}
//在起始页面跳转到test.vue页面并传递参数
uni.navigateTo({
url: '/pages/bom/history',
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('data', obj)
}
});
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #ffffff;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
view{
width: 96vw;
margin: 0 auto;
&>div{
display: flex;
flex-direction:row-reverse; //设置主轴对齐方向为水平,并且右对齐
flex-wrap: wrap ; //设置换行
}
.head{
border-bottom: 0.5vw solid #a2adab;
table{
&>tr:first-child>td:last-child{
&>* {
float: left;
}
&>*:first-child{
margin-right: 2%;
width: 75%;
}
&>*:last-child{
width: 20%;
min-height: 35px;
max-height: 50px;
margin:0;
border: 1px solid #a3cccc;
}
}
}
}
table{
width: 100%;
&>tr td:last-child{
width: 71%;
}
}
.button{
width: 4 * $fontSize;
// aspect-ratio: 2; //设置元素纵横比,宽是高的两倍
border: $fontSize / 10 solid #a3cccc;
border-radius: 15%;
text-align: center;
line-height: 2 * $fontSize;
margin: $fontSize /2 0;
}
}
}
@media (min-width: 100px) and (max-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 15px;
line-height: 35px;
}
}
@media (min-width: 600px) {
.head tr:first-child>td:last-child>*:last-child{
font-size: 30px;
line-height: 50px;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

196
pages/bom/recordQuerys.vue Normal file
View File

@@ -0,0 +1,196 @@
<template>
<view>
<div>
<uni-forms ref="form" :modelValue="form" label-width="25%" label-align="right" :rules="rules">
<uni-forms-item label="工单编号:" name="pwoCode" >
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描工单编码!"
v-model="form.pwoCode"
@iconClick="iconClick('pwoCode')"
/>
</uni-forms-item>
<uni-forms-item label='物料编码:' name='materialCode'>
<uni-easyinput v-model="form.materialCode" placeholder="请输入物料编码" />
</uni-forms-item>
<uni-forms-item label="物料名称:" >
<uni-easyinput v-model="form.materialName" disabled placeholder="工单扫完/物料编码输入带出" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="clickSubmit(form)" :disabled="formComputed">查询</button>
</div>
<uni-table ref="table" border stripe emptyText="暂无更多数据" v-show="open">
<uni-tr>
<uni-th align="center">类型</uni-th>
<uni-th align="center">参数1</uni-th>
<uni-th align="center">参数2</uni-th>
<uni-th align="center">参数3</uni-th>
<uni-th align="center">日期</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td align="center">{{ item.opType }}</uni-td>
<uni-td align="center">{{ item.parameter1 }}</uni-td>
<uni-td align="center">{{ item.parameter2 }}</uni-td>
<uni-td align="center">{{ item.parameter3 }}</uni-td>
<uni-td align="center">{{ item.updateTime }}</uni-td>
</uni-tr>
</uni-table>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
import {
hasValue
} from "@/utils/judge"
import {
listMesFurnaceOperationRecordDetail,
} from '@/api/mes/bom.js'
export default {
components:{
lodingVue
},
data() {
return {
/**表单数据 */
form:{
/** 工单编号 */
pwoCode : null,
/** 物料编码 */
materialCode : null,
/** 物料名称 */
materialName : null,
},
/** 校验规则 */
rules:{
pwoCode:{
rules:[
{
required : true,
},
]
},
materialCode:{
rules:[
{
required : true,
},
]
},
},
message:{
msgType:'',
messageText:''
},
tableData:[],
open:false,
}
},
/**
* 计算属性
*/
computed:{
/**
* 判断form值是否符合要求
* 如果符合则可以点击按钮,没有不能点击
*/
formComputed(){
const {pwoCode,materialCode} = this.form
//物料编码或工单编码有值则按钮可以点击
if(hasValue(pwoCode) || hasValue(materialCode)){
//工单编码有值则取消物料编码的必填
if(hasValue(pwoCode)) this.rules.materialCode.rules[0].required = false
//物料编码有值则取消工单编码的必填
if(hasValue(materialCode)) this.rules.pwoCode.rules[0].required = false
return false
}
this.rules.materialCode.rules[0].required = this.rules.pwoCode.rules[0].required = true
return true
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'pwoCode' ? _self.body.pwoCode = res.result :value;
}
})
},
/**
* 接口访问方法
* @param {Object} api 接口名称
* @param {Object} value 带入参数
*/
async fnApi(api,value){
const _self = this;
const objApi = {
listMesFurnaceOperationRecordDetail,
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value)).rows
return data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 查询按钮点击方法
* @param {Object} value
*/
async clickSubmit(form){
const _self= this
const data = await _self.fnApi('listMesFurnaceOperationRecordDetail',form)
_self.form.materialName = data[0].materialName
_self.tableData = data
_self.open = true
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #ffffff;
$fontSize:5vw; //设置变量,以字体为基础大小
font-size: $fontSize;
color: #6a6663;
padding-top: 1vw;
view{
width: 96vw;
margin: 0 auto;
}
}
</style>
<style>
page{
background-color: #ffffff ;
}
</style>

View File

@@ -0,0 +1,43 @@
<template>
<view>
<uni-card class="view-title" :title="title">
<text class="uni-body view-content">{{ content }}</text>
</uni-card>
</view>
</template>
<script>
export default {
data() {
return {
title: '',
content: ''
}
},
onLoad(options) {
this.title = options.title
this.content = options.content
uni.setNavigationBarTitle({
title: options.title
})
}
}
</script>
<style scoped>
page {
background-color: #ffffff;
}
.view-title {
font-weight: bold;
}
.view-content {
font-size: 26rpx;
padding: 12px 5px 0;
color: #333;
line-height: 24px;
font-weight: normal;
}
</style>

View File

@@ -0,0 +1,34 @@
<template>
<view v-if="params.url">
<web-view :webview-styles="webviewStyles" :src="`${params.url}`"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
params: {},
webviewStyles: {
progress: {
color: "#FF3333"
}
}
}
},
props: {
src: {
type: [String],
default: null
}
},
onLoad(event) {
this.params = event
if (event.title) {
uni.setNavigationBarTitle({
title: event.title
})
}
}
}
</script>

277
pages/detail/detail.vue Normal file
View File

@@ -0,0 +1,277 @@
<template>
<view class="page container">
<uni-card is-full>
<text class="uni-h6">可以同时选择日期和时间的选择器</text>
</uni-card>
<uni-section :title="'日期用法:' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" />
</view>
<uni-section :title="'日期时间用法:' + datetimesingle" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="datetimesingle" @change="changeLog" />
</view>
<uni-section :title="'日期范围用法:' + '[' + range + ']'" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="range" type="daterange" @maskClick="maskClick" />
</view>
<uni-section :title="'日期时间范围用法:' + '[' + datetimerange + ']' " type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
</view>
<uni-section :title="'v-model用法' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="single" />
</view>
<uni-section :title="'时间戳用法:' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker returnType="timestamp" v-model="single" @change="changeLog($event)" />
</view>
<uni-section :title="'date 对象用法:' + datetimesingle" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker type="datetime" returnType="date" v-model="datetimesingle" @change="changeLog" />
</view>
<uni-section :title="'插槽用法:' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="single">我是一个插槽点击我</uni-datetime-picker>
</view>
<uni-section :title="'无边框用法:' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="single" :border="false" />
</view>
<uni-section :title="'隐藏清除按钮用法:' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="single" :clearIcon="false" />
</view>
<uni-section :title="'disabled用法' + single" type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="single" disabled />
</view>
</view>
<view class="detail-container">
<!-- 日期选择器 -->
<view class="example-body">
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
</view>
<!-- 数据表格 -->
<view class="data-table">
<view class="table-header">
<text v-for="(col, index) in columns" :key="index" class="header-cell">
{{ col.title }}
</text>
</view>
<view class="table-body">
<view class="table-row" v-for="(item, rowIndex) in tableData" :key="rowIndex">
<text class="body-cell" v-for="(col, colIndex) in columns" :key="colIndex">
{{ item[col.key] }}
</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
selectedDate: new Date().toISOString().slice(0, 10), // 默认当天
originData: null, // 原始数据
statType: '', // 统计类型
columns: [], // 动态表头
tableData: [] // 表格数据
}
},
onLoad(options) {
this.initData(options.data)
this.generateTable()
},
watch: {
datetimesingle(newval) {
console.log("单选:", this.datetimesingle);
},
range(newval) {
console.log("范围选:", this.range);
},
datetimerange(newval) {
console.log("范围选:", this.datetimerange);
},
},
mounted() {
setTimeout(() => {
this.datetimesingle = "2021-5-1";
this.single = "2021-5-1";
}, 1000);
},
methods: {
change(e) {
this.single = e;
console.log("-change事件:", e);
},
}
/*
methods: {
// 初始化接收数据
initData(encodedData) {
try {
const rawData = decodeURIComponent(encodedData)
this.originData = JSON.parse(rawData)
this.statType = this.originData.statType
console.log(rawData)
} catch (e) {
uni.showToast({
title: '数据加载失败',
icon: 'none'
})
}
},
// 日期变化处理
handleDateChange(e) {
this.selectedDate = e.value
this.generateTable()
},
// 生成表格数据
generateTable() {
// 根据类型生成不同列
this.columns = this.getColumns()
// 根据类型生成数据(示例逻辑)
this.tableData = this.statType === 'quality' ?
this.generateQualityData() :
this.generateCommonData()
},
// 获取表头配置
getColumns() {
const baseColumns = [{
title: '日期',
key: 'date'
},
{
title: '类型',
key: 'type'
}
]
switch (this.statType) {
case 'quality':
return [...baseColumns,
{
title: '问题数量',
key: 'issueCount'
},
{
title: '问题类型',
key: 'issueType'
}
]
case 'salary':
return [...baseColumns,
{
title: '计件数量',
key: 'quantity'
},
{
title: '工资金额',
key: 'amount'
}
]
default: // production
return [...baseColumns,
{
title: '报工数量',
key: 'total'
},
{
title: '合格数量',
key: 'passed'
}
]
}
},
// 生成质量数据(示例)
generateQualityData() {
return [{
date: this.selectedDate,
type: '当日统计',
issueCount: this.originData.todayData.failedNum,
issueType: '生产问题'
}, {
date: '本月累计',
type: '月度统计',
issueCount: this.originData.monthData.failedNum,
issueType: '综合问题'
}]
},
generateCommonData() {
return [{
date: this.selectedDate,
type: '当日统计',
issueCount: this.originData.todayData.failedNum,
issueType: '生产问题'
}, {
date: '本月累计',
type: '月度统计',
issueCount: this.originData.monthData.failedNum,
issueType: '综合问题'
}]
}
}*/
}
</script>
<style scoped lang="scss">
.detail-container {
padding: 20rpx;
}
.date-picker {
margin: 20rpx 0;
padding: 20rpx;
background: #fff;
border-radius: 8rpx;
}
.data-table {
border: 1rpx solid #e4e7ed;
border-radius: 8rpx;
overflow: hidden;
}
.table-header,
.table-row {
display: flex;
height: 80rpx;
align-items: center;
}
.header-cell,
.body-cell {
flex: 1;
text-align: center;
padding: 10rpx;
}
.table-header {
background-color: #f5f7fa;
font-weight: bold;
}
.table-row:nth-child(even) {
background-color: #fafafa;
}
.body-cell {
color: #606266;
}
</style>

View File

@@ -0,0 +1,61 @@
<template>
<view class="detail-container">
<view class="date-picker" style="margin: 2vh 0;">
<uni-datetime-picker v-model="dateRange" type="daterange" @change="getDateRange" rangeSeparator="至" />
</view>
<uni-table ref="table" border stripe emptyText="暂无更多数据" @selection-change="selectionChange">
<uni-tr>
<uni-th width="80" align="center">作业单号</uni-th>
<uni-th width="80" align="center">产品编码</uni-th>
<uni-th width="80" align="center">报工数量</uni-th>
<uni-th width="80" align="center">不良数量</uni-th>
<uni-th width="80" align="center">计件单价</uni-th>
<uni-th width="80" align="center">合计</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in originData" :key="index">
<uni-td align="center">{{ item.repNum }}</uni-td>
<uni-td align="center">{{ item.repNum }}</uni-td>
<uni-td align="center">{{ item.failedNum }}</uni-td>
<uni-td align="center">{{ item.salary }}</uni-td>
</uni-tr>
</uni-table>
</view>
</template>
<script>
import {
listReport
} from '@/api/mes/pwoDraw.js'
export default {
data() {
return {
selectedDate: new Date().toISOString().slice(0, 10), // 默认当天
originData: null, // 原始数据
tableData: null, // 表格数据
dateRange: [],
jobReport: []
}
},
onLoad() {},
methods: {
// 初始化接收数据
initData() {
},
// 获取时间范围
getDateRange() {
console.log(this.dateRange)
},
getJobInfo() {
listReport().then(res => {
})
console.log("6")
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,228 @@
<template>
<view class="detail-container">
<view class="date-picker">
<uni-datetime-picker v-model="dateRange" type="daterange" @change="getTime" rangeSeparator="至" />
</view>
<!-- 数据表格 -->
<view class="data-table">
<view class="table-header">
<text v-for="(col, index) in columns" :key="index" class="header-cell">
{{ col.title }}
</text>
</view>
<view class="table-body">
<view class="table-row" v-for="(item, rowIndex) in tableData" :key="rowIndex">
<text class="body-cell" v-for="(col, colIndex) in columns" :key="colIndex">
{{ item[col.key] }}
</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
selectedDate: new Date().toISOString().slice(0, 10), // 默认当天
originData: null, // 原始数据
statType: '', // 统计类型
columns: [], // 动态表头
tableData: [], // 表格数据
dateRange: []
}
},
onLoad(options) {
this.initData(options.data)
this.generateTable()
},
watch: {
datetimesingle(newval) {
console.log("单选:", this.datetimesingle);
},
range(newval) {
console.log("范围选:", this.range);
},
datetimerange(newval) {
console.log("范围选:", this.datetimerange);
},
},
mounted() {
setTimeout(() => {
this.datetimesingle = "2021-5-1";
this.single = "2021-5-1";
}, 1000);
},
methods: {
change(e) {
this.single = e;
console.log("-change事件:", e);
},
},
methods: {
getTime() {
console.log(this.dateRange)
},
// 初始化接收数据
initData(encodedData) {
try {
const rawData = decodeURIComponent(encodedData)
this.originData = JSON.parse(rawData)
this.statType = this.originData.statType
console.log(rawData)
} catch (e) {
uni.showToast({
title: '数据加载失败',
icon: 'none'
})
}
},
// 日期变化处理
handleDateChange(e) {
this.selectedDate = e.value
this.generateTable()
},
// 生成表格数据
generateTable() {
// 根据类型生成不同列
this.columns = this.getColumns()
// 根据类型生成数据(示例逻辑)
this.tableData = this.statType === 'quality' ?
this.generateQualityData() :
this.generateCommonData()
},
// 获取表头配置
getColumns() {
const baseColumns = [{
title: '日期',
key: 'date'
},
{
title: '类型',
key: 'type'
}
]
switch (this.statType) {
case 'quality':
return [...baseColumns,
{
title: '问题数量',
key: 'issueCount'
},
{
title: '问题类型',
key: 'issueType'
}
]
case 'salary':
return [...baseColumns,
{
title: '计件数量',
key: 'quantity'
},
{
title: '工资金额',
key: 'amount'
}
]
default: // production
return [...baseColumns,
{
title: '报工数量',
key: 'total'
},
{
title: '合格数量',
key: 'passed'
}
]
}
},
// 生成质量数据(示例)
generateQualityData() {
return [{
date: this.selectedDate,
type: '当日统计',
issueCount: this.originData.todayData.failedNum,
issueType: '生产问题'
}, {
date: '本月累计',
type: '月度统计',
issueCount: this.originData.monthData.failedNum,
issueType: '综合问题'
}]
},
generateCommonData() {
return [{
date: this.selectedDate,
type: '当日统计',
issueCount: this.originData.todayData.failedNum,
issueType: '生产问题'
}, {
date: '本月累计',
type: '月度统计',
issueCount: this.originData.monthData.failedNum,
issueType: '综合问题'
}]
}
}
}
</script>
<style scoped lang="scss">
.detail-container {
padding: 20rpx;
}
.date-picker {
margin: 20rpx 0;
padding: 20rpx;
background: #fff;
border-radius: 8rpx;
}
.data-table {
border: 1rpx solid #e4e7ed;
border-radius: 8rpx;
overflow: hidden;
}
.table-header,
.table-row {
display: flex;
height: 80rpx;
align-items: center;
}
.header-cell,
.body-cell {
flex: 1;
text-align: center;
padding: 10rpx;
}
.table-header {
background-color: #f5f7fa;
font-weight: bold;
}
.table-row:nth-child(even) {
background-color: #fafafa;
}
.body-cell {
color: #606266;
}
</style>

139
pages/esop/esopProLine.vue Normal file
View File

@@ -0,0 +1,139 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产线编码" :labelWidth='90' name="productLineCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.productLineCode"
type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="状态" :labelWidth='90' name="issuedState">
<u-switch v-model="check" @change="favClick" activeColor="#5AC725"
style="float: left;"></u-switch>
<view style="float: left;margin: 5px;">{{status}}</view>
<!-- <view class="uni-padding-wrap uni-common-mt">
<uni-fav :checked="check" circle='true' bg-color="#dd524d" bg-color-checked="#67C23A" fg-color="#ffffff" fg-color-checked="#ffffff" star="false" :content-text="contentText" @click="favClick" />
</view> -->
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
updatePwo,
listProLine,
listPwo
} from "@/api/esop/esop.js";
export default {
mounted() {
},
data() {
return {
formData: {
pwoCode: null,
productLineCode: null,
proLineId: null,
issuedState: 0
},
check: false,
contentText: {
contentDefault: '待发',
contentFav: '已下发'
},
status: '待发',
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入生产工单!'
}]
},
productLineCode: {
rules: [{
required: true,
errorMessage: '请输入产线编码!'
}]
},
}
}
},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.productLineCode = res.result;
}
});
},
//切换状态
favClick(e) {
// this.check = !this.check;
// console.log(this.check + " " + e);
this.$forceUpdate();
if (e == false) {
this.status = '待发'
this.formData.issuedState = 0
} else {
this.status = '下发'
this.formData.issuedState = 1
}
},
submit() {
this.$refs["form"].validate().then(valid => {
if (this.formData.productLineCode) {
let obj = {
productLineCode: this.formData.productLineCode
}
listProLine(obj).then(res => {
this.formData.proLineId = res.rows[0].id;
let pwoCode = {
pwoCode: this.formData.pwoCode
}
listPwo(pwoCode).then(res => {
this.formData.id = res.rows[0].id;
this.$modal.loading('提交中')
updatePwo(this.formData).then(response => {
this.$modal.closeLoading();
this.$modal.msgSuccess("下发成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
})
})
}
});
}
},
}
</script>
<style>
</style>

109
pages/esop/esopPwo.vue Normal file
View File

@@ -0,0 +1,109 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="工位编码" :labelWidth='90' name="stationCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.stationCode"
type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.pwoJobCode"
type="text" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listStation,
listPwoJob,
addCustomizeEsop
} from "@/api/esop/esop.js";
export default {
mounted() {
},
data() {
return {
formData: {
pwoJobCode: null,
stationCode: null,
},
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
stationCode: {
rules: [{
required: true,
errorMessage: '请输入工位编码!'
}]
},
}
}
},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.stationCode = res.result;
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
}
});
},
submit() {
this.$refs["form"].validate().then(valid => {
if (this.formData.stationCode) {
let obj = {
stationCode: this.formData.stationCode
}
listStation(obj).then(res => {
this.formData.stationId = res.rows[0].id;
let pwoJobCd = {
code: this.formData.pwoJobCode
}
listPwoJob(pwoJobCd).then(res => {
this.formData.pwoJobId = res.rows[0].id;
this.$modal.loading('提交中')
addCustomizeEsop(this.formData).then(response => {
this.$modal.closeLoading();
this.$modal.msgSuccess("提交成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
})
})
}
});
}
},
}
</script>
<style>
</style>

791
pages/index - 副本.vue Normal file
View File

@@ -0,0 +1,791 @@
<template>
<view class="content">
<scroll-view class="data_body" scroll-y style="height:100%">
<view class="view_item">
<view class="progress_circle">
<view v-for="(item,index) in CircleData" :key="index" :class="['progress_block','block_'+index]">
<view class="name">{{item.series[0].name}}</view>
<!-- <view class="value">{{item.series[0].value}}</view> -->
<view class="charts-box arcbar" style="height: 180rpx;width: 60%;">
<qiun-data-charts type="arcbar" :chartData="item" :canvas2d="canvas2d"
:canvasId="'four_a_'+index" :resshow="delayload"
:opts="{title:{name:item.series[0].precent,color:item.series[0].color,fontSize:15},subtitle:{name:'',color:'#666666',fontSize:12},extra:{arcbar:{backgroundColor:item.series[0].backgroundColor}}}" />
</view>
<view class="planet">
<view class="planet_shadow"></view>
<view class="crater1"></view>
<view class="crater2"></view>
<view class="crater3"></view>
<view class="crater4"></view>
</view>
<view class="star" :class="['star'+index]"></view>
<view class="star pink" :class="['star'+index]"></view>
<view class="star blue" :class="['star'+index]"></view>
<view class="star yellow" :class="['star'+index]"></view>
</view>
</view>
</view>
<view class="split_line"></view>
<view class="friend_operate">
<view class="title">工单状态分布
</view>
<view v-if="delayload" class="charts-box" style="">
<qiun-data-charts type="ring" canvasId="four_b" :canvas2d="canvas2d" :resshow="delayload"
:opts="{legend:{position: 'bottom'},title:{name: '',},subtitle: {name: ''},extra:{ring:{customRadius:'55'}}}"
:chartData="ProductRateData" style="height: 350px;" />
</view>
</view>
<view class="split_line"></view>
<!--概览-->
<view class="friend_operate">
<text-block :content="CardData"></text-block>
</view>
<view class="friend_operate">
<view class="title">本周报工产量</view>
<view v-if="delayload" class="charts-box" style="height: 300px;">
<qiun-data-charts type="line" canvasId="four_c" :canvas2d="canvas2d" :resshow="delayload"
:chartData="TrendData" />
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import CircleData from "./json/user-server/1.json"
import {
listPwo,
listPo,
listReport,
reportRate
} from '@/api/mes/pwoDraw.js'
import {
getWeekReport,
getPwoStatus,
getProduceReport,
} from '@/api/mes/jobIn.js'
export default {
mounted() {
uni.showLoading();
//获取饼图数据
this.getStatus();
this.getReport();
this.getNum();
this.getRate();
setTimeout(() => {
this.delayload = true;
uni.hideLoading();
}, 1000)
},
data() {
return {
value: new Date(),
CircleData: CircleData,
ProductRateData: {},
TrendData: [],
CardData: [],
isRank: true,
canvas2d: this.$config.ISCANVAS2D,
delayload: false, //延时加载图表,否则会出现图表加载完后定位错乱
//饼图数据
status1: 0,
status2: 0,
status3: 0,
status4: 0,
status5: 0,
status6: 0,
status7: 0,
status8: 0,
status9: 0,
status10: 0,
status11: 0,
status12: 0,
status13: 0,
//卡片数据
dayAddedPo: 0,
dayAddedPwo: 0,
dayAddedReport: 0,
dayAvgQltyRate: 0,
//折线图数据
data: [
0, 0, 0, 0, 0, 0, 0,
],
finishValue: 0,
defectValue: 0,
}
},
methods: {
reset() {
this.status1 = 0;
this.status2 = 0;
this.status3 = 0;
this.status4 = 0;
this.status5 = 0;
this.status6 = 0;
this.status7 = 0;
this.status8 = 0;
this.status9 = 0;
this.status10 = 0;
this.status11 = 0;
this.status12 = 0;
this.status13 = 0;
this.dayAddedPo = 0;
this.dayAddedPwo = 0;
this.dayAddedReport = 0;
this.data = [0, 0, 0, 0, 0, 0, 0];
},
getTime() {
var year = this.value.getFullYear() // 年
var month = this.value.getMonth() + 1 < 10 ? "0" + (this.value.getMonth() + 1) : this.value.getMonth() + 1;
var day = this.value.getDate() < 10 ? "0" + this.value.getDate() : this.value.getDate();
var currentTime = year + '-' + month + '-' + day;
return currentTime;
},
async getStatus() {
this.reset();
await getPwoStatus().then((resp) => {
let data = resp.data;
this.status1 = data.status1 ? data.status1 : 0;
this.status2 = data.status2 ? data.status2 : 0;
this.status3 = data.status3 ? data.status3 : 0;
this.status4 = data.status4 ? data.status4 : 0;
this.status5 = data.status5 ? data.status5 : 0;
this.status6 = data.status6 ? data.status6 : 0;
this.status7 = data.status7 ? data.status7 : 0;
this.status8 = data.status8 ? data.status8 : 0;
this.status9 = data.status9 ? data.status9 : 0;
this.status10 = data.status10 ? data.status10 : 0;
this.status11 = data.status11 ? data.status11 : 0;
this.status12 = data.status12 ? data.status12 : 0;
this.status13 = data.status13 ? data.status13 : 0;
});
this.getBarData();
},
getBarData() {
this.ProductRateData = {
"series": [{
"name": "计划中",
"data": this.status1,
"color": "#2fc25b"
},
{
"name": "已生成作业",
"data": this.status2,
"color": "#facc14"
},
{
"name": "已投料",
"data": this.status3,
"color": "#f04864"
},
{
"name": "已领料",
"data": this.status4,
"color": "#8543e0"
},
{
"name": "已开工",
"data": this.status5,
"color": "#51c2d5"
},
{
"name": "暂停",
"data": this.status6,
"color": "#C8AB7E"
}, {
"name": "已完成",
"data": this.status7,
"color": "#81A1C6"
}, {
"name": "已领料",
"data": this.status8,
"color": "#C185BB"
}, {
"name": "结案",
"data": this.status9,
"color": "#4BA2FB"
}, {
"name": "取消",
"data": this.status1,
"color": "#98AFA7"
}, {
"name": "待入库",
"data": this.status10,
"color": "#9DD86E"
}, {
"name": "待转出",
"data": this.status11,
"color": "#DE68C4"
}, {
"name": "已转出",
"data": this.status12,
"color": "#BF2A39"
}, {
"name": "其他",
"data": this.status13,
"color": "#266186"
},
]
}
console.log(this.ProductRateData)
},
async getReport() {
await getWeekReport().then(async res => {
var now = new Date();
var today = now.getDay();
//获取当前时间所在的周一的日期
const startOfWeek = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() - (today === 0 ? 6 : today - 1)
);
// 当前周的结束日
const endOfWeek = new Date(
startOfWeek.getTime() + 7 * 24 * 60 * 60 * 1000
);
//将所有属于当前周的数据都存入新的数组里
const dataThisWeek = res.data
.filter((item) => {
const date = new Date(item.createTime);
return date >= startOfWeek && date < endOfWeek;
})
.map((item) => {
// 获取星期几,值为 0周日到 6周六
const dayOfWeek = new Date(item.createTime).getDay();
// 将数字转换为中文星期表示
const dayOfWeekStr = [0, 1, 2, 3, 4, 5, 6][dayOfWeek];
// 将星期几加入原始数据中
return {
...item,
dayOfWeek: dayOfWeekStr
};
});
for (var i = 0; i < dataThisWeek.length; i++) {
switch (dataThisWeek[i].dayOfWeek) {
case 0:
this.data[6] += dataThisWeek[i].reportNumber;
break;
case 1:
this.data[0] += dataThisWeek[i].reportNumber;
break;
case 2:
this.data[1] += dataThisWeek[i].reportNumber;
break;
case 3:
this.data[2] += dataThisWeek[i].reportNumber;
break;
case 4:
this.data[3] += dataThisWeek[i].reportNumber;
break;
case 5:
this.data[4] += dataThisWeek[i].reportNumber;
break;
case 6:
this.data[5] += dataThisWeek[i].reportNumber;
break;
default:
this.reset();
break;
}
}
});
this.getLineData();
},
getLineData() {
// 获取坐标轴刻度最大值
const maxVal = Number(Math.max(...this.data));
this.TrendData = {
"categories": [
"周一",
"周二",
"周三",
"周四",
"周五",
"周六",
"周日"
],
"series": [{
"name": "报工产量",
"data": this.data,
"type": "line",
"style": "curve",
"addPoint": true,
"color": "#DF297D",
"unit": ""
}],
"yAxis": {
"calibration": true,
"position": "left",
"min": 0,
"max": maxVal,
"title": "产量",
"titleFontSize": 12,
"unit": "",
"tofix": 0
},
"targetAdd": "9%"
}
},
async getNum() {
this.reset();
getProduceReport().then((resp) => {
let data = resp.data;
this.dayAddedPo = data.todayAddedPo;
this.dayAddedPwo = data.todayAddedPwo;
this.dayAddedReport = data.todayAddedReport;
});
const currentDate = new Date();
let endTime = this.getTime(currentDate);
//获取过去30天
const oldDate = new Date();
oldDate.setDate(currentDate.getDate() - 30);
let startTime = this.getTime(oldDate);
await reportRate({
mesPwoReportType: '2',
queryStartTime: startTime,
queryEndTime: endTime,
}).then((result) => {
console.log(result);
this.dayAvgQltyRate = result.data;
});
// //列出订单数量
// listPo().then(res => {
// for (var i = 0; i < res.rows.length; i++) {
// if (this.getTime() == (res.rows[i].createTime === undefined ? '' : res.rows[i]
// .createTime.slice(0, 10))) {
// this.dayAddedPo++;
// }
// }
// });
// //列出报工数量
// listReport().then(res => {
// for (var i = 0; i < res.rows.length; i++) {
// if (this.getTime() == (res.rows[i].createTime === undefined ? '' : res.rows[i]
// .createTime.slice(0, 10))) {
// this.dayAddedReport++;
// }
// }
// });
this.getCardData();
},
getCardData() {
//卡片赋值
this.CardData = [{
"kind": 4,
"background": ["#0081ff", "#1cbbb4"],
"content": [{
"text": "当日新增生产订单",
"value": "",
"colortext": "#fff",
"colorvalue": "",
"size": "24rpx"
},
{
"text": "",
"value": this.dayAddedPo,
"colortext": "",
"colorvalue": "#fff",
"size": "44rpx"
},
]
},
{
"kind": 4,
"background": ["#0081ff", "#1cbbb4"],
"content": [{
"text": "当日新增生产工单",
"value": "",
"colortext": "#fff",
"colorvalue": "",
"size": "24rpx"
},
{
"text": "",
"value": this.dayAddedPwo,
"colortext": "",
"colorvalue": "#fff",
"size": "44rpx"
},
]
},
{
"kind": 4,
"background": ["#0081ff", "#1cbbb4"],
"content": [{
"text": "当日报工次数",
"value": "",
"colortext": "#fff",
"colorvalue": "",
"size": "24rpx"
},
{
"text": "",
"value": this.dayAddedReport,
"colortext": "",
"colorvalue": "#fff",
"size": "44rpx"
},
]
}, {
"kind": 4,
"background": ["#0081ff", "#1cbbb4"],
"content": [{
"text": "当日平均质量合格率",
"value": "",
"colortext": "#fff",
"colorvalue": "",
"size": "24rpx"
},
{
"text": "",
"value": this.dayAvgQltyRate,
"colortext": "",
"colorvalue": "#fff",
"size": "44rpx"
},
]
}
]
},
async getRate() {
this.finishValue = 0;
this.defectValue = 0;
//当前日期
// const currentDate = this.getTime();
let endTime = this.getTime();
const oldDate = this.value;
oldDate.setDate(this.value.getDate() - 30);
const year = oldDate.getFullYear();
const month = String(oldDate.getMonth() + 1).padStart(2, '0');
const day = String(oldDate.getDate()).padStart(2, '0');
let startTime = `${year}-${month}-${day}`;
await reportRate({
mesPwoReportType: '3',
queryStartTime: startTime,
queryEndTime: endTime,
}).then((result) => {
this.finishValue = result.data;
});
await reportRate({
mesPwoReportType: '2',
queryStartTime: startTime,
queryEndTime: endTime,
}).then((result) => {
this.defectValue = result.data;
});
this.getCircleData();
},
getCircleData() {
const data1 = this.finishValue.toFixed(0) * 0.01;
const data2 = this.defectValue.toFixed(0) * 0.01;
this.CircleData = [{
"series": [{
"color": "#fff",
"data": data1,
"precent": this.finishValue.toFixed(0) + "%",
"index": 0,
"legendShape": "circle",
"name": "工单完成率",
"pointShape": "circle",
"show": true,
"type": "arcbar",
// "value": "12786",
"backgroundColor": "#00AEF9"
}]
},
{
"series": [{
"color": "#fff",
"data": data2,
"precent": this.defectValue.toFixed(0) + "%",
"index": 0,
"legendShape": "circle",
"name": "工单良品率",
"pointShape": "circle",
"show": true,
"type": "arcbar",
// "value": "1096",
"backgroundColor": "#F55676"
}]
}
]
console.log(this.CircleData)
}
}
}
</script>
<style scoped lang="scss">
.content {
padding-top: 10rpx;
}
.data_body {
height: 100%;
text-align: center;
color: #333333;
background-repeat: repeat;
background-color: #ffffff;
.friend_operate {
padding: 30rpx 20rpx;
.title {
text-align: left;
margin-bottom: 30rpx;
font-size: 40rpx;
}
}
.view_item {
padding: 30rpx 20rpx;
padding-top: 30px;
.title {
text-align: left;
margin-bottom: 30rpx;
font-size: 40rpx;
}
}
.progress_circle {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
// height: 450rpx;
.progress_block {
width: 45%;
border-radius: 20rpx;
height: 180rpx;
position: relative;
overflow: hidden;
.name {
color: #fff;
font-size: 24rpx;
position: absolute;
top: 20rpx;
left: 10rpx;
max-width: 144rpx;
}
.value {
color: #fff;
font-size: 40rpx;
position: absolute;
top: 64rpx;
left: 10rpx;
max-width: 144rpx;
}
.circle {
position: absolute;
right: 8rpx;
top: 16rpx;
}
.arcbar {
position: absolute;
right: -4rpx;
top: 8rpx;
}
}
.block_0 {
background-color: #0FC3FF;
}
.block_1 {
background-color: #FF6B8B;
}
.block_2 {
background-color: #FFCB1D;
}
.block_3 {
background-color: #3BDCAA;
}
}
}
.planet {
width: 60px;
height: 60px;
border-radius: 50%;
background: #333;
position: absolute;
left: -13px;
bottom: -26px;
overflow: hidden;
opacity: 0.5;
z-index: 0;
}
.planet_shadow {
position: absolute;
border-radius: 50%;
height: 100%;
width: 100%;
top: -40%;
right: -10%;
border: 35px solid rgba(0, 0, 0, .15);
}
.crater1,
.crater2,
.crater3,
.crater4 {
position: absolute;
border-radius: 50%;
background: rgba(0, 0, 0, .3);
box-shadow: inset 3px 3px 0 rgba(0, 0, 0, .2);
}
.crater1 {
width: 20px;
height: 20px;
left: 25%;
top: 20%;
}
.crater2 {
width: 10px;
height: 10px;
left: 50%;
top: 60%;
}
.crater3 {
width: 15px;
height: 15px;
left: 30%;
top: 65%;
}
.crater4 {
width: 15px;
height: 15px;
left: 60%;
top: 35%;
}
.star {
display: block;
width: 5px;
height: 5px;
border-radius: 50%;
background: #FFF;
top: 10px;
left: 50px;
position: relative;
transform-origin: 100% 0;
box-shadow: 0 0 5px 5px rgba(255, 255, 255, .3);
opacity: 0;
z-index: 2;
}
.star0 {
animation: star-ani 4s infinite ease-out;
}
.star1 {
animation: star-ani 5s infinite ease-out;
}
.star2 {
animation: star-ani 6s infinite ease-out;
}
.star3 {
animation: star-ani 7s infinite ease-out;
}
.star:after {
content: '';
display: block;
top: 20px;
left: 60px;
border: 0px solid #fff;
border-width: 0px 90px 2px 90px;
border-color: transparent transparent transparent rgba(255, 255, 255, .3);
transform: rotate(-45deg) translate3d(1px, 3px, 0);
box-shadow: 0 0 1px 0 rgba(255, 255, 255, .1);
transform-origin: 0% 100%;
animation: shooting-ani 100s infinite ease-out;
}
.pink {
top: 10px;
left: 60px;
background: #ff5a99;
animation-delay: 5s;
-webkit-animation-delay: 5s;
-moz-animation-delay: 5s;
}
.pink:after {
border-color: transparent transparent transparent #ff5a99;
animation-delay: 5s;
-webkit-animation-delay: 5s;
-moz-animation-delay: 5s;
}
.blue {
top: 15px;
left: 70px;
background: cyan;
animation-delay: 7s;
-webkit-animation-delay: 7s;
-moz-animation-delay: 7s;
}
.blue:after {
border-color: 'transpareanimation-delay: 12s';
-webkit-animation-delay: 7s;
-moz-animation-delay: 7s;
animation-delay: 7s;
}
.yellow {
top: 0px;
left: 80px;
background: #ffcd5c;
animation-delay: 5.8s;
}
.yellow:after {
border-color: transparent transparent transparent #ffcd5c;
animation-delay: 5.8s;
}
@keyframes star-ani {
0% {
opacity: 0;
transform: scale(0) rotate(0) translate3d(0, 0, 0);
-webkit-transform: scale(0) rotate(0) translate3d(0, 0, 0);
-moz-transform: scale(0) rotate(0) translate3d(0, 0, 0);
}
50% {
opacity: 0.5;
transform: scale(1) rotate(0) translate3d(-20px, 20px, 0);
-webkit-transform: scale(1) rotate(0) translate3d(-20px, 20px, 0);
-moz-transform: scale(1) rotate(0) translate3d(-20px, 20px, 0);
}
100% {
opacity: 0;
transform: scale(1) rotate(0) translate3d(-30px, 30px, 0);
-webkit-transform: scale(1) rotate(0) translate3d(-30px, 30px, 0);
-moz-transform: scale(1) rotate(0) translate3d(-30px, 30px, 0);
}
}
</style>

488
pages/index.vue Normal file
View File

@@ -0,0 +1,488 @@
<template>
<view class="container">
<view class="status-bar"></view>
<t-emp />
<uni-row class="dataStatics">
<uni-col :span="24">
<u-subsection :list="list" mode="button" :current="current" @change="handleChangeTab" />
<uni-card class="statCard proStatics" margin="0" padding="8px 0" :border="true" v-show="current === 0">
<uni-section title="生产统计" type="circle" titleFontSize="18px" titleColor="#1e5799">
<uni-row>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="today.repNum" bold separator="," use-easing />
<text class="statLabel">当日报工</text>
</uni-col>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="month.repNum" bold separator="," use-easing />
<text class="statLabel">当月报工</text>
</uni-col>
</uni-row>
</uni-section>
</uni-card>
<uni-card class="statCard quaStatics" margin="0" padding="8px 0" :border="true" v-show="current === 1">
<uni-section title="质量统计" type="circle" titleFontSize="18px" titleColor="#1e5799">
<template v-slot:right class="card-actions-item">
<text class="card-actions-item-text" @click="toDetail('quality')">查看明细</text>
<uni-icons type="right"></uni-icons>
</template>
<uni-row>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="today.failedNum" bold separator="," use-easing />
<text class="statLabel">当日不合格</text>
</uni-col>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="month.failedNum" bold separator="," use-easing />
<text class="statLabel">当月不合格</text>
</uni-col>
</uni-row>
</uni-section>
</uni-card>
<uni-card class="statCard salStatics" margin="0" padding="8px 0" :border="true" v-show="current === 2">
<uni-section title="工资统计" type="circle" titleFontSize="18px" titleColor="#1e5799">
<template v-slot:right class="card-actions-item">
<text class="card-actions-item-text" @click="toDetail('salary')">查看明细</text>
<uni-icons type="right"></uni-icons>
</template>
<uni-row>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="today.salary" bold separator="," use-easing />
<text class="statLabel">当日工资</text>
</uni-col>
<uni-col :span="12" class="staticNumber">
<u-count-to :endVal="month.salary" bold separator="," use-easing />
<text class="statLabel">当月工资</text>
</uni-col>
</uni-row>
</uni-section>
</uni-card>
</uni-col>
</uni-row>
<uni-row class="jobInfo" :gutter="20">
<uni-col :span="24">
<uni-card class="eqpInfo" margin="0" padding="8px 0" :border="true">
<uni-section title="所在设备" type="line" titleFontSize="20px" titleColor="#1e5799">
<view class="eqpName">{{ eqpName }}</view>
<view class="card-actions">
<view class="card-actions-item" @click="eqpCheckIn">
<uni-icons type="icon-qiandao" size="14" color="#9d9d9d" custom-prefix="iconfont"></uni-icons>
<text class="card-actions-item-text">签到</text>
</view>
<view class="card-actions-item" @click="eqpCheckOut">
<uni-icons type="icon-qiantui" size="14" color="#9d9d9d" custom-prefix="iconfont"></uni-icons>
<text class="card-actions-item-text">签退</text>
</view>
</view>
</uni-section>
</uni-card>
</uni-col>
<uni-col :span="24">
<uni-card class="staInfo" margin="0" padding="8px 0" :border="true">
<uni-section title="所在工位" type="line" titleFontSize="20px" titleColor="#1e5799">
<view class="staName">{{ stationTitle }}</view>
<view class="card-actions">
<view class="card-actions-item" @click="staCheckIn">
<uni-icons type="icon-qiandao" size="14" color="#9d9d9d" custom-prefix="iconfont"></uni-icons>
<text class="card-actions-item-text">签到</text>
</view>
<view class="card-actions-item" @click="staCheckOut">
<uni-icons type="icon-qiantui" size="14" color="#9d9d9d" custom-prefix="iconfont"></uni-icons>
<text class="card-actions-item-text">签退</text>
</view>
</view>
</uni-section>
</uni-card>
</uni-col>
</uni-row>
</view>
</template>
<script>
import { listEmpEqpHistory } from '@/api/basic/empEqpHistory.js';
import { listEmployee } from '@/api/mes/jobIn.js';
import { getInfo } from '@/api/login.js';
import { getDepartment } from '@/api/basic/department.js';
import { listReport } from '@/api/mes/pwoDraw.js';
import { listStationEmpHistory } from '@/api/basic/empStaHistory.js';
import { getBeijingTime } from '@/utils/judge.ts';
export default {
data() {
return {
userId: null,
empCode: null,
empName: this.$store.state.employee.empName,
eqpId: null,
eqpCode: null,
eqpName: '/',
deptId: null,
deptName: this.$store.state.employee.deptName,
stationTitle: '/',
today: {
repNum: 0,
failedNum: 0,
salary: 0,
reportInfo: [],
jobs: []
},
month: {
repNum: 0,
failedNum: 0,
salary: 0,
reportInfo: [],
jobs: []
},
timeRange: [],
list: ['生产统计', '质量统计', '工资统计'],
current: 0
};
},
methods: {
eqpCheckIn() {
this.$tab.navigateTo(`/pages/basic/empEqpStart?userId=${this.userId}&empCode=${this.empCode}&empName=${this.empName}`);
},
eqpCheckOut() {
this.$tab.navigateTo(`/pages/basic/empEqpEnd?userId=${this.userId}&empCode=${this.empCode}&empName=${this.empName}`);
},
staCheckIn() {
this.$tab.navigateTo(`/pages/basic/empStaStart?userId=${this.userId}&empCode=${this.empCode}&empName=${this.empName}`);
},
staCheckOut() {
this.$tab.navigateTo(`/pages/basic/empStaEnd?userId=${this.userId}&empCode=${this.empCode}&empName=${this.empName}`);
},
getEqpAndSta() {
// 查询人员上机历史
listEmpEqpHistory({
empName: this.empName,
empCode: this.empCode
}).then((res) => {
this.eqpCode = null;
this.eqpName = '/';
if (res.rows.length > 0) {
const item = res.rows.find((item) => !item.endTime);
if (item) {
this.eqpCode = item.equipmentCode;
this.eqpName = item.equipmentTitle;
}
}
});
// 查询工位签到历史
listStationEmpHistory({
empName: this.empName
}).then((res) => {
const filteredData = res.rows.filter((item) => item.endTime == null);
console.log(filteredData);
if (filteredData.length > 0) {
this.stationTitle = filteredData[0].stationTitle;
} else {
this.stationTitle = '/';
}
});
},
async getUserInfo() {
// 根据账号获取员工姓名和账号ID
await getInfo()
.then((res) => {
this.empName = res.user.nickName;
this.userId = res.user.userId;
})
.catch(() => {
uni.showToast({
title: '当前账号无对应人员资料',
icon: 'none'
});
});
// 根据昵称获取对应员工编号
await listEmployee({
empName: this.empName
})
.then((res) => {
this.empCode = res.rows[0].empCode;
this.deptId = res.rows[0].deptId;
// 根据部门id查询部门名称
getDepartment(this.deptId)
.then((res) => {
this.deptName = res.data.departmentTitle;
})
.catch(() => {
uni.showToast({
title: '未查询到所属部门',
icon: 'none'
});
});
})
.catch(() => {
uni.showToast({
title: '当前账号无对应人员资料',
icon: 'none'
});
});
},
getTodayRange() {
const now = new Date();
// 获取日期
const year = String(now.getFullYear());
const month = String(now.getMonth() + 1).padStart(2, '0');
const date = String(now.getDate()).padStart(2, '0');
const nextDate = String(now.getDate() + 1).padStart(2, '0');
this.timeRange = [];
this.timeRange.push(`${year}-${month}-${date} 00:00:00`);
this.timeRange.push(`${year}-${month}-${nextDate} 00:00:00`);
},
getMonthRange() {
const now = new Date();
// 获取日期
const year = String(now.getFullYear());
const month = String(now.getMonth() + 1).padStart(2, '0');
const nextMonth = String(now.getMonth() + 2).padStart(2, '0');
this.timeRange = [];
this.timeRange.push(`${year}-${month}-01 00:00:00`);
this.timeRange.push(`${year}-${nextMonth}-01 00:00:00`);
},
async getTodayInfo() {
this.getTodayRange();
await listReport({
'timeRange[0]': this.timeRange[0],
'timeRange[1]': this.timeRange[1],
createByName: this.empName
})
.then((res) => {
if (res.rows.length !== 0) {
for (var i in res.rows) {
this.today.reportInfo.push({
repNum: res.rows[i].reportNumber,
type: res.rows[i].type,
pwoJobCode: res.rows[i].pwoJobCode,
ptNoTar: res.rows[i].ptNoTar,
failedNum: 0
// 数据未添加完毕,子页面还需要:工序、工序数量、计价单价
});
}
}
})
.catch(() => {
uni.showToast({
title: '获取日报工信息失败',
icon: 'none'
});
});
for (const item of this.today.reportInfo) {
// 当日报工数
this.today.repNum += item.repNum;
// 当日质量问题
if (item.type !== '合格品') {
this.today.failedNum++;
}
}
this.today.reportInfo.failedNum = this.today.failedNum;
},
async getMonthInfo() {
this.getMonthRange();
await listReport({
createByName: this.empName,
'timeRange[0]': this.timeRange[0],
'timeRange[1]': this.timeRange[1]
})
.then((res) => {
if (res.rows.length > 0) {
for (var i in res.rows) {
this.month.reportInfo.push({
repNum: res.rows[i].reportNumber,
type: res.rows[i].type,
pwoJobCode: res.rows[i].pwoJobCode,
ptNoTar: res.rows[i].ptNoTar,
failedNum: 0
// 数据未添加完毕,子页面还需要:工序、工序数量、计价单价
});
}
}
})
.catch(() => {
uni.showToast({
title: '获取月报工信息失败',
icon: 'none'
});
});
for (const item of this.month.reportInfo) {
// 当月报工数
this.month.repNum += item.repNum;
// 当月质量问题
if (item.type !== '合格品') {
this.month.failedNum++;
}
// 月工资
}
this.month.reportInfo.failedNum = this.month.failedNum;
},
// 计算薪资
calSal() {},
// 跳转到明细页面
toDetail(type) {
this.$modal.msg('功能开发中...');
return;
const params = {
today: {
repNum: this.today.repNum,
failedNum: this.today.failedNum,
salary: this.today.salary
},
month: {
repNum: this.month.repNum,
failedNum: this.month.failedNum,
salary: this.month.salary
}
};
uni.navigateTo({
url: `/pages/detail/${type}Detail?data=${encodeURIComponent(JSON.stringify(params))}`
});
},
handleChangeTab(tab) {
this.current = tab;
}
},
async onShow() {
// await this.getUserInfo();
await this.getEqpAndSta();
await this.getTodayInfo();
await this.getMonthInfo();
}
};
</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 {
margin: 0 !important;
.uni-col {
padding: 0 !important;
}
.uni-col + .uni-col {
margin-top: 15px;
}
.eqpInfo,
.staInfo {
border-radius: 12px !important;
.eqpName,
.staName {
font-size: 22px !important;
text-align: center;
margin: 15px 0;
font-weight: 500;
color: #444;
min-height: 30px;
line-height: 1.4;
}
.card-actions {
border-top: 1px #d9d9d9 solid;
display: flex;
justify-content: space-around;
gap: 10px;
padding-top: 10px;
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex: 1;
}
.card-actions-item + .card-actions-item {
border-left: 2px solid #d9d9d9;
}
.card-actions-item-text {
font-size: 14px;
color: #666;
margin-left: 5px;
}
}
}
}
.dataStatics {
background: transparent !important;
box-shadow: none !important;
margin: 10px 0 15px !important;
.statCard {
border-radius: 0 0 12px 12px !important;
background: #fff !important;
height: 100%;
display: flex;
flex-direction: column;
margin: 0 5px;
.staticNumber {
display: flex;
flex-direction: column;
align-items: center;
.u-count-num {
font-size: 40px !important;
margin: 10px 0;
}
}
.detailBtn {
background: #409eff;
color: white;
border: none;
height: 45px;
font-size: 18px;
border-radius: 8px;
margin-top: 15px;
line-height: 45px;
transition: background 0.3s;
&:active {
background: #3a8ee6;
}
}
}
}
.u-subsection--button {
padding-left: 0 !important;
padding-right: 0 !important;
}
/* 全局uni-section标题加粗 */
::v-deep .uni-section__content-title {
font-weight: bold !important;
}
::v-deep .uni-section-header__slot-right {
display: flex;
}
</style>

68
pages/json/finance/1.json Normal file
View File

@@ -0,0 +1,68 @@
{
"expend":{
"categories": [
"1月",
"2月",
"2月",
"4月",
"5月"
],
"series": [
{
"name": "支出情况",
"data": [1201,2501.5,985,1760,2013.85],
"type": "line",
"style": "curve",
"color": "#4ECDB6",
"unit":""
}
],
"yAxis":[
{"calibration":true,"position":"left","title":"单位/元","titleFontSize":12,"unit":"","tofix":0,"min":0,"disableGrid":true}
]
},
"income":{
"categories": [
"1月",
"2月",
"2月",
"4月",
"5月"
],
"series": [
{
"name": "收入情况",
"data": [1601,1840.5,1900,1760,1500.85],
"type": "line",
"style": "curve",
"color": "#4ECDB6",
"unit":""
}
],
"yAxis":[
{"calibration":true,"position":"left","title":"单位/元","titleFontSize":12,"unit":"","tofix":0,"min":0,"disableGrid":true}
]
},
"remaining":{
"categories": [
"1月",
"2月",
"2月",
"4月",
"5月"
],
"series": [
{
"name": "结余情况",
"data": [815,712.5,378,450,600.85],
"type": "line",
"style": "curve",
"color": "#4ECDB6",
"unit":""
}
],
"yAxis":[
{"calibration":true,"position":"left","title":"单位/元","titleFontSize":12,"unit":"","tofix":0,"min":0,"disableGrid":true}
]
}
}

33
pages/json/finance/2.json Normal file
View File

@@ -0,0 +1,33 @@
{
"series": [
{
"data":[
{
"name": "住房相关",
"value": 3200,
"color":"#4DCCB3"
},
{
"name": "食品酒水",
"value": 1020,
"color":"#5A77EC"
},
{
"name": "娱乐休闲",
"value": 500,
"color":"#4E94EC"
},
{
"name": "交流通讯",
"value": 214.5,
"color":"#4FD4EB"
},
{
"name": "其他",
"value": 320.13,
"color":"#B5ED21"
}
]
}
]
}

26
pages/json/school/1.json Normal file
View File

@@ -0,0 +1,26 @@
[
{
"name":"课题研究",
"num":500,
"width":"",
"background":"#FFBE68"
},
{
"name":"论文发布",
"num":300,
"width":"",
"background":"#0FEBE1"
},
{
"name":"实践研究",
"num":455,
"width":"",
"background":"#BF8DFC"
},
{
"name":"评教",
"num":601,
"width":"",
"background":"#FF859C"
}
]

28
pages/json/school/2.json Normal file
View File

@@ -0,0 +1,28 @@
{
"series": [
{
"data":[
{
"name": "本科",
"value": 168,
"color":"#FFBF31"
},
{
"name": "大专",
"value": 144,
"color":"#3CEFC4"
},
{
"name": "博士",
"value": 123,
"color":"#FFA9B3"
},
{
"name": "硕士",
"value": 96,
"color":"#3CBBFF"
}
]
}
]
}

27
pages/json/school/3.json Normal file
View File

@@ -0,0 +1,27 @@
{
"categories":["语文","数学","英语","物理","化学","生物"],
"series":[
{
"name":"一班",
"area":[123.45,234,192.5,245],
"color":"#1890ff",
"data":[90,110,165,195,187,172],
"index":0,
"legendShape":"circle",
"pointShape":"",
"show": true,
"type": "radar"
},
{
"name":"二班",
"area":[192.5,234,261.55,245],
"color":"#2fc25b",
"data":[190,210,105,35,27,102],
"index":0,
"legendShape":"circle",
"pointShape":"",
"show": true,
"type": "radar"
}
]
}

29
pages/json/school/4.json Normal file
View File

@@ -0,0 +1,29 @@
{
"categories": [
"1",
"2",
"2",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"
],
"series": [
{
"name": "图书借阅人数",
"data": [6,8,9,8.2,7.5,9,10.3,8,12,6.2,7.2,4.5],
"type": "line",
"style": "curve",
"color": "#A800FB",
"unit":""
}
],
"yAxis":[
{"calibration":true,"position":"left","title":"单位/千","titleFontSize":12,"unit":"","tofix":0,"min":0,"max":20,"disableGrid":true}
]
}

80
pages/json/sport/1.json Normal file
View File

@@ -0,0 +1,80 @@
{
"series": [{
"name": "激活放松",
"color": "#FDEC9F",
"data": [
["17:24", 75],
["17:26", 83],
["17:28", 88],
["17:30", 92]
]
},
{
"name": "动态热身",
"color": "#FBCD2B",
"data": [
["17:30", 92],
["17:32", 96],
["17:34", 94],
["17:36", 93.5],
["17:38", 94.6],
["17:40", 98]
]
},
{
"name": "糖分消耗",
"color": "#FC9E83",
"data": [
["17:40", 98],
["17:42", 100],
["17:44", 104],
["17:46", 113],
["17:48", 142]
]
},
{
"name": "脂肪燃烧",
"color": "#EF6DCF",
"data": [
["17:48", 142],
["17:50", 130],
["17:52", 134],
["17:54", 150],
["17:56", 148],
["17:58", 142],
["18:00", 132],
["18:02", 136],
["18:04", 136.5]
]
},
{
"name": "心肺训练",
"color": "#BC38E5",
"data": [
["18:04", 136.5],
["18:06", 140],
["18:08", 135],
["18:10", 130],
["18:12", 124],
["18:14", 120],
["18:16", 118],
["18:18", 116.5],
["18:20", 112]
]
}, {
"name": "极限锻炼",
"color": "#8908FA",
"data": [
["18:20", 112],
["18:22", 123],
["18:24", 130],
["18:26", 138],
["18:28", 116],
["18:30", 123],
["18:32", 128],
["18:34", 126],
["18:36", 137]
]
}
]
}

38
pages/json/sport/2.json Normal file
View File

@@ -0,0 +1,38 @@
{
"series": [
{
"data": [
{
"name": "激活放松",
"value": 5,
"color": "#FDEC9F"
},
{
"name": "动态热身",
"value": 13,
"color": "#FBCD2B"
},
{
"name": "糖分消耗",
"value": 8,
"color": "#FC9E83"
},
{
"name": "脂肪燃烧",
"value": 24,
"color": "#EF6DCF"
},
{
"name": "心肺训练",
"value": 7,
"color": "#BC38E5"
},
{
"name": "极限锻炼",
"value": 16,
"color": "#8908FA"
}
]
}
]
}

22
pages/json/sport/3.json Normal file
View File

@@ -0,0 +1,22 @@
{
"categories": [
"1",
"2",
"3",
"4",
"5"
],
"series": [
{
"name": "公里配速",
"data": [
5.09,
6.18,
6.38,
7.15,
9.05
],
"color":"#FFD597"
}
]
}

174
pages/json/sport/4.json Normal file
View File

@@ -0,0 +1,174 @@
{
"series": [
{
"name": "速度",
"color": "#1C9862",
"index":0,
"data": [
[
"17:24",
0
],
[
"17:26",
1
],
[
"17:28",
1.2
],
[
"17:30",
1.6
],
[
"17:32",
1.8
],
[
"17:34",
2
],
[
"17:36",
4
],
[
"17:38",
6.5
],
[
"17:40",
10
],
[
"17:42",
13.4
],
[
"17:44",
13
],
[
"17:46",
12.6
],
[
"17:48",
12.2
],
[
"17:50",
14
],
[
"17:52",
16.8
],
[
"17:54",
20
],
[
"17:56",
25
],
[
"17:58",
23
],
[
"18:00",
16
]
]
},
{
"name": "心率",
"index":1,
"color": "#FBCD2B",
"data": [
[
"17:24",
72
],
[
"17:26",
73
],
[
"17:28",
73.5
],
[
"17:30",
74
],
[
"17:32",
76.5
],
[
"17:34",
78
],
[
"17:36",
80
],
[
"17:38",
76.3
],
[
"17:40",
75
],
[
"17:42",
86
],
[
"17:44",
84
],
[
"17:46",
90
],
[
"17:48",
100
],
[
"17:50",
112
],
[
"17:52",
125
],
[
"17:54",
117
],
[
"17:56",
110
],
[
"17:58",
108
],
[
"18:00",
104
]
]
}
],
"yAxis":[
{"calibration":true,"position":"left","title":"","titleFontSize":12,"unit":"","tofix":0,"min":0,"max":25,"disableGrid":true},
{"calibration":true,"position":"right","title":"","titleFontSize":12,"unit":"","tofix":0,"min":0,"disableGrid":true}
]
}

View File

@@ -0,0 +1,21 @@
[
{
"expect": "",
"now": "",
"name": "时间进度",
"value": "60.12"
},
{
"expect": "30000",
"now": "36000",
"dataType": "1",
"name": "会员拉新",
"value": "120"
},
{
"expect": "",
"now": "",
"name": "扫码渗透率",
"value": "35"
}
]

View File

@@ -0,0 +1,34 @@
[
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"1800","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"日均新增目标","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"1960","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"当日新增会员","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"36050","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"本月新增会员","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"3%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"日均环比","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
}
]

View File

@@ -0,0 +1,74 @@
{
"categories": [
"1月11",
"1月12",
"1月11",
"1月14",
"1月15"
],
"series": [{
"name": "新增会员数",
"data": [{
"value": 5,
"color": "#24ABFD"
},
{
"value": -3,
"color": "#24ABFD"
},
{
"value": 3.5,
"color": "#24ABFD"
},
{
"value": 10,
"color": "#24ABFD"
},
{
"value": 2.8,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"unit": "",
"textNoShow": true
},
{
"name": "当日达成率",
"data": [
101,
91,
97,
131,
109
],
"type": "line",
"addPoint": true,
"color": "#DF297D",
"unit": "%",
"index": 1
},
{
"name": "日均达成率",
"data": [
102,
92,
96,
115,
105
],
"type": "line",
"color": "#24ABFD",
"unit": "%",
"index": 1
}
],
"yAxis": [{
"max": 20,
"min": 0
}, {
"max": 200,
"min": 0
}]
}

View File

@@ -0,0 +1,26 @@
[
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"42%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"当日扫码率","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"37%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"累计扫码率","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":2,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"环比增长","value":"3.2%","colortext":"#fff","colorvalue":"#fff","size":"24rpx"},
{"text":"同比增长","value":"1.1%","colortext":"#fff","colorvalue":"#fff","size":"24rpx"}
]
}
]

View File

@@ -0,0 +1,57 @@
{
"categories": [
"1月11",
"1月12",
"1月13",
"1月14",
"1月15"
],
"series": [{
"name": "当天扫码率",
"data": [
39,
34,
36,
45,
38
],
"type": "line",
"addPoint": true,
"color": "#24ABFD",
"unit": "%"
},
{
"name": "累计扫码率",
"data": [
32,
30,
31,
37,
35
],
"type": "line",
"addPoint": true,
"color": "#DF297D",
"unit": "%"
},
{
"name": "目标扫码率",
"data": [
40,
40,
40,
40,
40
],
"type": "line",
"color": "#FF9900",
"textNoShow": true,
"unit": ""
}
],
"yAxis": [{
"max": 60,
"min": 0
}]
}

View File

@@ -0,0 +1,12 @@
[
{
"kind":3,
"background":["#B678FD","#4A64F9"],
"content":[
{"text":"","value":"38%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"小程序购买活跃会员占比","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"同比","value":"2.5%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"环比","value":"3.2%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
}
]

View File

@@ -0,0 +1,89 @@
{
"categories": [
"1月11",
"1月12",
"1月11",
"1月14",
"1月15"
],
"series": [{
"name": "新增会员数",
"data": [{
"value": 5,
"color": "#24ABFD"
},
{
"value": -3,
"color": "#24ABFD"
},
{
"value": 3.5,
"color": "#24ABFD"
},
{
"value": 10,
"color": "#24ABFD"
},
{
"value": 2.8,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"unit": "",
"textNoShow": true
},
{
"name": "当日达成率",
"data": [
101,
91,
97,
131,
109
],
"type": "line",
"addPoint": true,
"color": "#DF297D",
"unit": "%",
"index": 1
},
{
"name": "日均达成率",
"data": [
102,
92,
96,
115,
105
],
"type": "line",
"style": "curve",
"color": "#ff9900",
"unit": "%",
"index": 1
},
{
"name": "日均达成率",
"data": [
102,
92,
96,
115,
105
],
"type": "area",
"color": "#ff9900",
"unit": "%",
"index": 1
}
],
"yAxis": [{
"max": 20,
"min": 0
}, {
"max": 200,
"min": 0
}]
}

View File

@@ -0,0 +1,22 @@
[
{
"expect": "",
"now": "",
"name": "时间进度",
"value": "50.88"
},
{
"expect": "54800",
"now": "51000",
"dataType": "1",
"name": "新开会员",
"value": "93.07"
},
{
"expect": "30000",
"now": "25600",
"dataType": "1",
"name": "新增消费会员",
"value": "85.33"
}
]

View File

@@ -0,0 +1,35 @@
[
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"扫一扫","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"63%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"81.5%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-81.3%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"85%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"二维码识别","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"13%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"2%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-0.8%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"80%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"最近使用","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"21%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"1%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-0.8%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"80%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
}
]

View File

@@ -0,0 +1,35 @@
[
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"会员销售占比","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"80%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"81.5%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-81.3%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"85%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"会员客流占比","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"79%","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"2%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-0.8%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"80%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":5,
"background":["#F77E89","#F7953B"],
"content":[
{"text":"会员客单价","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"79元","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"环比","value":"1%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"同比","value":"-0.8%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"},
{"text":"平均参考水平","value":"80%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
}
]

View File

@@ -0,0 +1,61 @@
{
"categories": [
"1周",
"2周",
"3周",
"4周",
"5周"
],
"series": [{
"name": "同比增长率",
"data": [{
"value": 5,
"color": "#24ABFD"
},
{
"value": -3,
"color": "#24ABFD"
},
{
"value": 3.5,
"color": "#24ABFD"
},
{
"value": 10,
"color": "#24ABFD"
},
{
"value": 2.8,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"index": 1,
"unit": "%"
},
{
"name": "消费金额",
"data": [
1850,
1660,
1760,
2360,
1970
],
"type": "line",
"addPoint": true,
"color": "#DF297D",
"unit": ""
}
],
"target": 1800,
"yAxis": [{
"max": 3000,
"min": 0
}, {
"max": 20,
"min": 0
}],
"targetAdd": "9%"
}

View File

@@ -0,0 +1,88 @@
{
"headers":[
{
"label": "最近活跃时间",
"key": "col1"
}, {
"label": "人数",
"key": "col2"
}, {
"label": "人数占比",
"key": "col3"
}, {
"label": "活跃会员环比",
"key": "col4"
}, {
"label": "活跃消费人数占比",
"key": "col5"
}
],
"contents":[
{
"col1": "0-30天",
"col2": "15350",
"col3": "45",
"col4": "9.5",
"col5": "29"
}, {
"col1": "30-60天",
"col2": "15350",
"col3": "13",
"col4": "-2.5",
"col5": "-25"
}, {
"col1": "60-90天",
"col2": "15371",
"col3": "15",
"col4": "-5.2",
"col5": "63"
}, {
"col1": "90-120天",
"col2": "12340",
"col3": "12",
"col4": "2.9",
"col5": "-12"
}, {
"col1": "120-180天",
"col2": "12360",
"col3": "17",
"col4": "3.5",
"col5": "11"
}
],
"sortCol":[
{
"key": "col1",
"isNumber": false
}, {
"key": "col2",
"isNumber": true
},
{
"key": "col3",
"isNumber": true
},
{
"key": "col4",
"isNumber": true
},
{
"key": "col5",
"isNumber": true
}
],
"computedCol":["col2","col3","col4","col5"],
"formatCol":[{
"key": "col3",
"template": "#col3#%",
"bottomComputedFormat": true
}, {
"key": "col4",
"template": "#col4#%",
"bottomComputedFormat": true
}, {
"key": "col5",
"template": "#col5#%",
"bottomComputedFormat": true
}]
}

View File

@@ -0,0 +1,25 @@
[{
"series": [{
"color": "#24ABFD",
"data": 0.18,
"index": 0,
"legendShape": "circle",
"name": "当前脱落率",
"pointShape": "circle",
"show": true,
"type": "arcbar"
}]
},
{
"series": [{
"color": "#F04864",
"data": 0.25,
"index": 0,
"legendShape": "circle",
"name": "脱落率警示线",
"pointShape": "circle",
"show": true,
"type": "arcbar"
}]
}
]

View File

@@ -0,0 +1,36 @@
{
"categories": [
"高血压",
"糖尿病",
"痛风",
"血脂",
"尿酸"
],
"series": [{
"name": "今周脱落率",
"data": [{
"value": 6,
"color": "#24ABFD"
},
{
"value": 3.2,
"color": "#24ABFD"
},
{
"value": 5.5,
"color": "#24ABFD"
},
{
"value": 8,
"color": "#24ABFD"
},
{
"value": 6,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"unit": "%"
}]
}

View File

@@ -0,0 +1,26 @@
[{
"series": [{
"color": "#24ABFD",
"data": 0.75,
"index": 0,
"legendShape": "circle",
"name": "当前脱落率",
"pointShape": "circle",
"show": true,
"type": "arcbar"
}]
},
{
"series": [{
"color": "#F04864",
"data": 0.33,
"index": 0,
"legendShape": "circle",
"name": "脱落率警示线",
"pointShape": "circle",
"show": true,
"type": "arcbar"
}]
}
]

View File

@@ -0,0 +1,32 @@
[{
"series": [{
"color": "#fff",
"data": 1,
"precent": "100%",
"index": 0,
"legendShape": "circle",
"name": "工单完成率",
"pointShape": "circle",
"show": true,
"type": "arcbar",
"value": "12786",
"backgroundColor": "#00AEF9"
}]
},
{
"series": [{
"color": "#fff",
"data": 1,
"precent": "100%",
"index": 0,
"legendShape": "circle",
"name": "工单良品率",
"pointShape": "circle",
"show": true,
"type": "arcbar",
"value": "1096",
"backgroundColor": "#F55676"
}]
}
]

View File

@@ -0,0 +1,29 @@
{
"series": [
{
"name": "任务栏最近使用",
"data": 500,
"color":"#2fc25b"
},
{
"name": "最近使用小程序列表",
"data": 623,
"color":"#facc14"
},
{
"name": "手机系统",
"data": 123,
"color":"#f04864"
},
{
"name": "任务栏我的小程序",
"data": 96,
"color":"#8543e0"
},
{
"name": "其他",
"data": 423,
"color":"#51c2d5"
}
]
}

View File

@@ -0,0 +1,36 @@
{
"categories": [
"周一",
"周二",
"周三",
"周四",
"周五",
"周六",
"周日"
],
"series": [
{
"name": "老会员",
"data": [
1850,
1660,
1760,
2360,
1560,
1970,
2570
],
"type": "line",
"style": "curve",
"addPoint": true,
"color": "#DF297D",
"unit":""
},
{
"name": "新会员",
"data": [
450,
260,
360,
560,
460,

View File

@@ -0,0 +1,32 @@
[
{
"kind":4,
"background":["#0081ff","#1cbbb4"],
"content":[
{"text":"已评价数","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"161","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"增长","value":"","colortext":"#fff","colorvalue":"","size":"20rpx"},
{"text":"up","value":"325","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":4,
"background":["#0081ff","#1cbbb4"],
"content":[
{"text":"平均分","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"82","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"增长","value":"","colortext":"#fff","colorvalue":"","size":"20rpx"},
{"text":"up","value":"0.7","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
},
{
"kind":4,
"background":["#0081ff","#1cbbb4"],
"content":[
{"text":"好评率","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"},
{"text":"","value":"161","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"增长","value":"","colortext":"#fff","colorvalue":"","size":"20rpx"},
{"text":"down","value":"1.2%","colortext":"#fff","colorvalue":"#fff","size":"20rpx"}
]
}
]

View File

@@ -0,0 +1,32 @@
[
{
"name":"华东",
"num":50000,
"width":"",
"background":"#FFBE68"
},
{
"name":"华南",
"num":30000,
"width":"",
"background":"#0FEBE1"
},
{
"name":"华北",
"num":45500,
"width":"",
"background":"#BF8DFC"
},
{
"name":"西北",
"num":60120,
"width":"",
"background":"#FF859C"
},
{
"name":"西南",
"num":26020,
"width":"",
"background":"#51ADCF"
}
]

22
pages/json/wechat/1.json Normal file
View File

@@ -0,0 +1,22 @@
[
{
"expect": "",
"now": "",
"name": "时间进度",
"value": "37.88"
},
{
"expect": "224.64",
"now": "53.96",
"dataType": "1",
"name": "微好友拉新",
"value": "24.02"
},
{
"expect": "80.17",
"now": "18.82",
"dataType": "1",
"name": "微客群拉新",
"value": "23.48"
}
]

50
pages/json/wechat/2.json Normal file
View File

@@ -0,0 +1,50 @@
[
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"5860","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"新增微好友","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"3605","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"新增小程序会员","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"5860","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"删除/拉黑的微好友","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"605","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"单聊总数","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"641","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"发送消息数","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
},
{
"kind":1,
"background":["#3EB2F5","#9374F7"],
"content":[
{"text":"","value":"35分钟","colortext":"","colorvalue":"#fff","size":"44rpx"},
{"text":"平均首次回复时长","value":"","colortext":"#fff","colorvalue":"","size":"24rpx"}
]
}
]

33
pages/json/wechat/3.json Normal file
View File

@@ -0,0 +1,33 @@
[{
"categories": [{
"value": 0.2,
"color": "#1890ff"
},
{
"value": 0.8,
"color": "#1890ff"
}
],
"series": [{
"name": "新增小程序会员占比",
"data": 0.21,
"color": "#24ABFD"
}]
},
{
"categories": [{
"value": 0.2,
"color": "#1890ff"
},
{
"value": 0.8,
"color": "#1890ff"
}
],
"series": [{
"name": "已回复单聊占比",
"data": 0.65,
"color": "#24ABFD"
}]
}
]

82
pages/json/wechat/4.json Normal file
View File

@@ -0,0 +1,82 @@
{
"categories": [
"1月11",
"1月12",
"1月13",
"1月14",
"1月15",
"1月16",
"1月17"
],
"series": [{
"name": "新增微好友数",
"data": [{
"value": 1800,
"color": "#24ABFD"
},
{
"value": 1300,
"color": "#24ABFD"
},
{
"value": 1580,
"color": "#24ABFD"
},
{
"value": 1600,
"color": "#24ABFD"
},
{
"value": 1600,
"color": "#24ABFD"
},
{
"value": 1600,
"color": "#24ABFD"
},
{
"value": 1300,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"unit": ""
},
{
"name": "新增小程序会员数",
"data": [{
"value": 1580,
"color": "#6BC588"
},
{
"value": 850,
"color": "#6BC588"
},
{
"value": 1100,
"color": "#6BC588"
},
{
"value": 1400,
"color": "#6BC588"
},
{
"value": 1200,
"color": "#6BC588"
},
{
"value": 980,
"color": "#6BC588"
},
{
"value": 560,
"color": "#6BC588"
}
],
"type": "column",
"color": "#6BC588",
"unit": ""
}
]
}

92
pages/json/wechat/5.json Normal file
View File

@@ -0,0 +1,92 @@
{
"categories": [
"1月11",
"1月12",
"1月13",
"1月14",
"1月15",
"1月16",
"1月17"
],
"series": [{
"name": "新增微好友数",
"data": [{
"value": 1400,
"color": "#24ABFD"
},
{
"value": 1300,
"color": "#24ABFD"
},
{
"value": 1000,
"color": "#24ABFD"
},
{
"value": 1500,
"color": "#24ABFD"
},
{
"value": 1580,
"color": "#24ABFD"
},
{
"value": 1700,
"color": "#24ABFD"
},
{
"value": 1500,
"color": "#24ABFD"
}
],
"type": "column",
"color": "#24ABFD",
"unit": ""
},
{
"name": "新增小程序会员数",
"data": [{
"value": 400,
"color": "#FB8F82"
},
{
"value": 700,
"color": "#FB8F82"
},
{
"value": 500,
"color": "#FB8F82"
},
{
"value": 300,
"color": "#FB8F82"
},
{
"value": 400,
"color": "#FB8F82"
},
{
"value": 350,
"color": "#FB8F82"
},
{
"value": 400,
"color": "#FB8F82"
}
],
"type": "column",
"color": "#FB8F82",
"unit": ""
}
],
"yAxis": [{
"calibration": true,
"position": "left",
"title": "",
"titleFontSize": 12,
"unit": "",
"tofix": 0,
"min": 0,
"max": 2500
}]
}

57
pages/json/wechat/6.json Normal file
View File

@@ -0,0 +1,57 @@
{
"headers":[
{
"label": "活动名称",
"key": "col1"
}, {
"label": "员工总任务",
"key": "col2"
}, {
"label": "员工完成数",
"key": "col3"
}, {
"label": "完成率",
"key": "col4"
}
],
"contents":[
{
"col1": "周末秒杀",
"col2": "450",
"col3": "420",
"col4": "99%"
}, {
"col1": "摇号活动",
"col2": "430",
"col3": "1390",
"col4": "90%"
}, {
"col1": "早间问候",
"col2": "450",
"col3": "430",
"col4": "95%"
}, {
"col1": "汇总",
"col2": "1330",
"col3": "1240",
"col4": "93%"
}
],
"sortCol":[
{
"key": "col1",
"isNumber": false
}, {
"key": "col2",
"isNumber": true
},
{
"key": "col3",
"isNumber": true
},
{
"key": "col4",
"isNumber": true
}
]
}

528
pages/login.vue Normal file
View File

@@ -0,0 +1,528 @@
<template>
<view class="normal-login-container">
<view class="logo-content align-center justify-center flex">
<image class="image" style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
</image>
<text class="title">MES移动端登录</text>
</view>
<view class="login-form-content">
<view class="input-item flex align-center">
<view class="iconfont icon-user icon"></view>
<input v-model="loginForm.username" @confirm="handleLogin" class="input" type="text" placeholder="请输入账号"
maxlength="30" />
</view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view>
<input v-model="loginForm.password" @confirm="handleLogin" type="password" class="input" placeholder="请输入密码"
maxlength="20" />
</view>
<view class="input-item flex align-center" style="margin: 20px auto 0;" v-if="captchaEnabled">
<view class="iconfont icon-code icon"></view>
<input v-model="loginForm.code" @confirm="handleLogin" type="number" class="input" placeholder="请输入验证码"
maxlength="4" />
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
</view>
<!-- <u-cell-group :border="false">
<u-cell :title="typeTitle" @click="show=!show" :isLink="true" arrow-direction="down"></u-cell>
<u-picker :show="show" :columns="columns" :closeOnClickOverlay="true" @cancel="typeCancel"
@confirm="typeConfirm" @close="typeClose"></u-picker>
</u-cell-group> -->
<view class="flex align-center">
<!-- <checkbox-group @change="checkboxChange">
<checkbox id="chkRem" type="checkbox" :checked='rememberPsw' @tap="rememberPsw =! rememberPsw" color="#09CC86"/>
记住账号密码
</checkbox-group> -->
<uni-data-checkbox multiple v-model="value" :localdata="range" @change="checkboxChange"></uni-data-checkbox>
</view>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleBaseUrl">
<view class="menu-item-box">
<view class="iconfont icon-refresh menu-icon"></view>
<text>配置服务器地址</text>
</view>
</view>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="input" message="成功消息" :duration="2000" :before-close="true" @close="close"
@confirm="confirm">
<uni-row>
<uni-col>
<uni-easyinput type="text" v-model="baseUrl" placeholder="请输入服务器地址" />
</uni-col>
<!-- <uni-col>
<uni-easyinput type="text" v-model="baseUrl" placeholder="请输入MES服务器地址" />
</uni-col>
<uni-col>
<uni-easyinput type="text" v-model="wmsUrl" placeholder="请输入WMS服务器地址" />
</uni-col> -->
</uni-row>
</uni-popup-dialog>
</uni-popup>
<!-- <view class="xieyi text-center">
<text class="text-grey1">登录即代表同意</text>
<text @click="handleUserAgrement" class="text-blue">用户协议</text>
<text @click="handlePrivacy" class="text-blue">隐私协议</text>
</view> -->
<uni-fab ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
:direction="direction" @trigger="trigger" @fabClick="fabClick" />
<view> <span class="version">版本 {{version}}</span></view>
</view>
</template>
<script>
import {getToken} from '@/utils/auth'
import {getCodeImg} from '@/api/login'
import {version} from "vue"
export default {
data() {
return {
typeTitle: '常规功能',
show: false,
columns: [
['常规功能', 'ESOP', 'IPC']
],
version: "",
value: [0],
range: [{
"value": 0,
"text": "记住账号密码"
}],
baseUrl: uni.getStorageSync('base_url'),
// wmsUrl: uni.getStorageSync('wms_url'),
codeUrl: "",
captchaEnabled: true,
globalConfig: getApp().globalData.config,
loginForm: {
username: "",
password: "",
code: "",
uuid: '',
},
rememberPsw: true,
title: 'uni-fab',
directionStr: '垂直',
horizontal: 'right',
vertical: 'bottom',
direction: 'horizontal',
pattern: {
icon: 'list',
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF',
iconColor: '#fff'
},
is_color_type: false,
content: [{
iconPath: '/static/images/esop.png',
selectedIconPath: '/static/images/esop.png',
text: 'ESOP',
active: false
},
{
iconPath: '/static/images/ipc.png',
selectedIconPath: '/static/images/ipc.png',
text: 'IPC',
active: false
}
]
}
},
mounted() {
this.version = uni.getAppBaseInfo(version).appVersion;
//缓存的账号
const HBusername = uni.getStorageSync('HBusername');
//缓存的密码
const HBpassword = uni.getStorageSync('HBpassword');
// console.log("缓存的账号:" + HBusername)
// console.log("缓存的密码:" + HBpassword)
//有缓存就赋值给文本没有就清空
if (HBusername && HBpassword) {
this.loginForm.username = HBusername;
this.loginForm.password = HBpassword;
} else {
this.loginForm.username = '';
this.loginForm.password = '';
}
},
created() {
this.getCode()
},
onLoad() {
//检测更新
// const type = uni.getSystemInfoSync().platform
// console.log(type, '机型')
// // #ifdef APP-PLUS
// plus.screen.lockOrientation('default');
// // #endif
},
// 页面关闭时清除横屏正方向
// onUnload() {
// // #ifdef APP-PLUS
// plus.screen.lockOrientation('portrait-primary');
// // #endif
// },
methods: {
trigger(e) {
const _this = this;
console.log(e)
_this.content[e.index].active = !e.item.active
uni.showModal({
title: '提示',
content: `您确定进入${e.item.text}页面吗?`,
success: function(res) {
if (res.confirm) {
if (e.index == 0) {
_this.$tab.reLaunch('/pages/work/esop')
} else if (e.index == 1) {
console.log(2)
_this.$tab.reLaunch('/pages/work/ipc')
}
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
fabClick() {
// uni.showToast({
// // title: '点击了悬浮按钮',
// icon: 'none'
// })
},
// 隐私协议
handlePrivacy() {
let site = this.globalConfig.appInfo.agreements[0]
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
},
// 用户协议
handleUserAgrement() {
let site = this.globalConfig.appInfo.agreements[1]
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
},
// 获取图形验证码
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
if (this.captchaEnabled) {
this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid
}
})
},
// 登录方法
async handleLogin() {
if (this.loginForm.username === "") {
this.$modal.msgError("请输入您的账号")
} else if (this.loginForm.password === "") {
this.$modal.msgError("请输入您的密码")
} else if (this.loginForm.code === "" && this.captchaEnabled) {
this.$modal.msgError("请输入验证码")
} else {
this.$modal.loading("登录中,请耐心等待...")
this.pwdLogin()
}
},
// 密码登录
async pwdLogin() {
this.$store.dispatch('Login', this.loginForm).then(() => {
this.$modal.closeLoading()
this.loginSuccess()
}).catch(() => {
if (this.captchaEnabled) {
this.getCode()
}
})
},
// 登录成功后,处理函数
async loginSuccess(result) {
// 设置用户信息
if (this.rememberPsw) {
uni.setStorageSync('HBusername', this.loginForm.username);
uni.setStorageSync('HBpassword', this.loginForm.password);
} else { //销毁缓存
uni.removeStorageSync('HBusername');
uni.removeStorageSync('HBpassword');
}
await this.$store.dispatch('GetInfo')
await this.$store.dispatch('GetEmpInfo')
this.$tab.reLaunch('/pages/index')
},
handleBaseUrl() {
this.$refs.popup.open()
},
close() {
this.$refs.popup.close()
},
confirm() {
// 输入框的值
uni.setStorageSync('base_url', this.baseUrl)
// uni.setStorageSync('wms_url',this.wmsUrl)
console.log(uni.getStorageSync('base_url'));
// console.log(uni.getStorageSync('wms_url'));
// TODO 做一些其他的事情,手动执行 close 才会关闭对话框
// ...
this.$refs.popup.close()
},
//复选框
checkboxChange: function(e) {
if (e.detail.value.length == 1) {
//获取缓存的账号 赋值
uni.getStorageSync('HBusername', this.loginForm.username);
uni.getStorageSync('HBpassword', this.loginForm.password);
} else { //销毁
uni.removeStorageSync('HBusername');
uni.removeStorageSync('HBpassword');
}
},
typeCancel() {
this.show = false;
},
typeConfirm(e) {
console.log(this.baseUrl.slice(0, -1) + '3')
this.typeTitle = e.value[0];
this.show = false;
},
typeClose() {
this.show = false;
}
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.normal-login-container {
width: 100%;
.logo-content {
width: 100%;
font-size: 21px;
text-align: center;
padding-top: 15%;
image {
border-radius: 4px;
}
.title {
margin-left: 10px;
}
}
.login-form-content {
// text-align: center;
margin: 20px auto;
margin-top: 15%;
width: 80%;
.input-item {
margin: 20px auto;
background-color: #f5f6f7;
height: 45px;
border-radius: 20px;
.icon {
font-size: 38rpx;
margin-left: 10px;
color: #999;
}
.input {
width: 100%;
font-size: 14px;
line-height: 20px;
text-align: left;
padding-left: 15px;
}
}
.login-btn {
margin-top: 15px;
height: 45px;
}
.xieyi {
color: #333;
margin-top: 20px;
}
}
.easyinput {
width: 100%;
}
}
.login-code-img {
height: 45px;
}
.version {
position: fixed;
text-align: center;
bottom: 30rpx;
left: 0;
right: 0;
}
@media screen and (min-width: 600px) and (orientation:landscape) {
::v-deep .uni-data-checklist .checklist-group .checklist-box .checkbox__inner {
width: 30px;
height: 30px;
}
::v-deep .uni-data-checklist .checklist-group .checklist-box .checkbox__inner .checkbox__inner-icon {
height: 20px;
width: 10px;
left: 9px;
}
::v-deep .uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text {
font-size: 24px
}
.title {
font-size: 45px
}
.image {
width: 200px !important;
height: 200px !important;
}
.normal-login-container {
width: 100%;
.logo-content {
width: 100%;
font-size: 21px;
text-align: center;
padding-top: 10%;
image {
border-radius: 4px;
}
.title {
margin-left: 10px;
}
}
.login-form-content {
// text-align: center;
margin: 20px auto;
// margin-top: 15%;
width: 80%;
.input-item {
margin: 20px auto;
background-color: #f5f6f7;
height: 80px;
border-radius: 20px;
.icon {
font-size: 40px;
margin-left: 10px;
color: #999;
}
.input {
width: 100%;
font-size: 30px;
line-height: 40px;
text-align: left;
padding-left: 15px;
}
}
.login-btn {
margin-top: 15px;
height: 80px;
font-size: 40px;
}
.xieyi {
color: #333;
margin-top: 20px;
}
}
.easyinput {
width: 100%;
}
.menu-item-box {
font-size: 30px
}
.menu-icon {
font-size: 40px;
}
.version {
font-size: 30px;
}
::v-deep .uni-popup-dialog {
width: 800px;
}
::v-deep .uni-dialog-title-text {
font-size: 30px;
}
::v-deep .uni-easyinput__content-input {
width: 700px;
font-size: 30px
}
::v-deep .content-clear-icon {
font-size: 40px !important;
}
::v-deep .uni-dialog-button-text {
font-size: 30px;
}
::v-deep .uni-dialog-button {
height: 70px;
}
// .uni-fab__content .uni-fab__content--right .uni-fab__content--other-platform{
// width: 300px;
// height: 80px;
// }
// uni-fab__content uni-fab__content--right uni-fab__content--other-platform
// .uni-fab__item-image{
// width: 80px;
// height: 50px;
// }
// .uni-fab__item{
// width: 100px;
// height: 50px;
// }
// .uni-fab__item-text{
// font-size: 24px;
// margin-right: 15px;
// }
}
.login-code-img {
height: 80px;
}
}
</style>

View File

@@ -0,0 +1,179 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoJobCode" type="text"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="当前设备" :labelWidth='90' name="equipmentCode">
<uni-easyinput disabled v-model="formData.equipmentCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
</uni-col>
<uni-col :span="24">
<uni-forms-item label="切换设备" :labelWidth='90' name="newEquipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.newEquipmentCode"
type="text"/>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" style="position: absolute;bottom: 0">提交</u-button>
</view>
</template>
<script>
import {
getPwoJob,
updatePwoJob,
getEquipment,
listEquipment
} from "@/api/mes/jobReport.js";
export default {
mounted() {
// this.test()
},
data() {
return {
formData: {
pwoJobCode: null,
equipmentCode: null,
newEquipmentCode: null,
eqpId: null
},
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码'
}]
},
newEquipmentCode: {
rules: [{
required: true,
errorMessage: '请输入要切换的设备编号'
},
],
}
}
}
},
methods: {
test() {
let ip = null;
uni.setStorageSync('appversion', plus.runtime.version)
// IP地址
let Context = plus.android.importClass('android.content.Context')
let main = plus.android.runtimeMainActivity()
let cm = main.getSystemService(Context.CONNECTIVITY_SERVICE)
plus.android.importClass(cm)
let linkProperties = cm.getLinkProperties(cm.getActiveNetwork())
let linkAddrs = plus.android.invoke(linkProperties, 'getLinkAddresses')
plus.android.importClass(linkAddrs)
for (var i = 0; i < linkAddrs.size(); i++) {
let inetAddr = plus.android.invoke(linkAddrs.get(i), 'getAddress')
ip = plus.android.invoke(inetAddr, 'getHostAddress')
}
// let baseUrl = uni.getStorageSync("base_url").slice(0, 20)
console.log(ip)
uni.request({
url: 'http://' + ip + ':8080/api/1.0/alarm/success_start',
success: (res) => {
console.log(res);
}
});
},
scanBarCode() {
if (this.formData.pwoJobCode) {
let obj = Number(this.formData.pwoJobCode.slice(4));
console.log(Number(this.formData.pwoJobCode.slice(4)));
getPwoJob(obj).then(async res => {
console.log(res);
if (res) {
let eqpId = res.data.eqpId;
//判断扫描的作业编码是否绑定设备
if (eqpId && eqpId != 0) {
this.formData.eqpId = eqpId;
getEquipment(eqpId).then(async res => {
this.formData.equipmentCode = res.data.equipmentCode;
});
} else {
this.$modal.msg("该作业编码未绑定设备!");
}
} else {
this.formData.equipmentCode = "无";
}
});
}
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.newEquipmentCode = res.result;
}
});
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定使用该设备上工吗?',
success: function(res) {
if (res.confirm) {
let query = {
equipmentCode: _this.formData.newEquipmentCode
}
//根据设备编码来获取设备id
listEquipment(query).then(async res => {
let eqpId1 = res.rows[0].id;
let data = {
id: _this.formData.pwoJobCode.slice(4),
eqpId: res.rows[0].id
}
_this.$modal.loading('提交中')
updatePwoJob(data).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("作业上机成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,423 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="上机转入单" :open="true">
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" disabled type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="工位编码" :labelWidth='90' name="stationCode">
<uni-easyinput suffixIcon="scan" type="text" v-model="stationCode"
@iconClick="scanBarStationCode" @input="scanStationCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" :disabled=flag ref="equipmentCode" @iconClick="scanBar1"
type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
<uni-forms-item v-show="show" :labelWidth='90' style="text-align: center;" name="">
<button type="primary" size="mini" style=" text-align: center;font-size: 18px;"
@click="eqpBind">绑定</button>
</uni-forms-item>
<uni-forms-item label="选择状态" :labelWidth='90'>
<u-radio-group v-model="radiovalue1" placement="row">
<u-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name"
:name="item.name">
</u-radio>
</u-radio-group>
</uni-forms-item>
<uni-forms-item :label="radiovalue1+'时间'" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="value1" />
</view>
</uni-forms-item>
<uni-forms-item label="操作人编码" :labelWidth='90' name="operateByCode">
<uni-easyinput suffixIcon="scan" @confirm="scanBarOperateBy" @iconClick="scanBar2" type="text"
v-model="operateByCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="操作人" :labelWidth='90' name="operateBy">
<uni-easyinput disabled type="text" v-model="operateBy"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="上机转入单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList" :key="index"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<!-- <uni-badge :text="index+1" type="primary"><u-tag text="未核销" size="large" type="error" plain
plainFill></u-tag></uni-badge> -->
<!-- <div><u-tag text="未核销" size="mini" type="error" plain plainFill></u-tag></div> -->
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标仓库" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标库位" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="可转入数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.availableNum'">
<uni-easyinput type="text" disabled v-model="item.availableNum"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
<uni-easyinput type="text" v-model="item.number"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<view style="text-align: center;margin: 10px 0;" v-show="jobInForm.mesPwoJobCvDetailList.length>0">
<button type="primary" size="mini" style=" text-align: center;font-size: 18px;"
@click="byDetailAdd">照单领</button>
</view>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
handleConvert,
getEquipment,
addConversion,
listEmpEqpHistory,
listEmployee,
listConversion,
pwoStart,
pwoStop
} from "@/api/mes/jobIn.js";
import {
updatePwoJob,
listEquipment,
getPwoJob,
listPwoJob
} from "@/api/mes/jobReport.js"
import {
listStation,
addCustomizeEsop
} from "@/api/esop/esop.js";
export default {
data() {
return {
value1: null,
radiolist1: [{
name: '开工',
disabled: false
},
{
name: '暂停',
disabled: false
}
],
radiovalue1: '开工',
stationCode: null,
jobInForm: {
mesPwoJobCvDetailList: [],
},
stationId: null,
number: null,
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
// materialName: [{
// required: false,
// errorMessage: '请输入物料名称!'
// }],
// number: [{
// required: true,
// errorMessage: '请输入转移数量!'
// }],
// equipmentCode: {
// rules: [{
// pattern: '^[A-Z0-9]+$',
// errorMessage: '请输入正确格式的设备编码!',
// trigger: 'blur',
// }]
// }
}
}
},
mounted() {
listEquipment().then(response => {
this.equipmentList = response.rows
});
},
methods: {
//照单领
byDetailAdd() {
if (this.jobInForm.mesPwoJobCvDetailList.length > 0) {
for (var i in this.jobInForm.mesPwoJobCvDetailList) {
this.jobInForm.mesPwoJobCvDetailList[i].number = this.jobInForm.mesPwoJobCvDetailList[i]
.availableNum;
}
}
},
deleteDetail(index) {
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
reset(code) {
this.jobInForm = {
pwoJobCode: code,
mesPwoJobCvDetailList: [],
};
this.equipmentCode = null;
this.operateBy = null;
this.operateByCode = null;
},
eqpBind() {
let id = Number(this.jobInForm.pwoJobCode.substring(4));
//判断是否有该设备
if (this.equipmentCode != "" && this.equipmentCode) {
let query = {
equipmentCode: this.equipmentCode
}
listEquipment(query).then(async res => {
if (res.rows.length != 0) {
//绑定设备
let data = {
id: this.jobInForm.pwoJobCode.slice(4),
eqpId: res.rows[0].id
}
this.$modal.loading('提交中')
updatePwoJob(data).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("绑定成功!");
this.show = false;
this.flag = true;
this.scanJobCode(this.jobInForm.pwoJobCode);
})
} else {
this.$modal.msg("未查询到该设备编码!");
}
});
} else {
this.$modal.msg("请输入设备编码!");
}
},
scanJobCode(code) {
if (code) {
this.reset(code);
// let id = Number(code.substring(4));
listPwoJob({
code: code
}).then(async res => {
if (res.rows.length != 0) {
if (!res.rows[0].eqpId) {
//未绑定设备,设备编码框可用,绑定按钮显示
this.$modal.msg("该作业未绑定设备,请绑定设备!");
this.flag = false;
this.show = true;
} else {
//已绑定设备,
handleConvert(res.rows[0].id).then(async response => {
this.equipmentCode = this.equipmentList.find(item => item.id ==
response.jobInfo.eqpId).equipmentCode; //赋值设备编码
listEmpEqpHistory({
equipmentCode: this.equipmentCode
}).then(async res => {
if (res.rows.length != 0) {
//取上机且未下机的人员
if (res.rows[res.rows.length -
1].startTime && !res.rows[res.rows
.length -
1].endTime) {
this.operateBy = res.rows[res.rows
.length -
1].empName;
this.operateByCode = res.rows[res.rows
.length - 1].empCode;
}
}
});
this.jobInForm.pwoJobId = response.jobInfo.id;
this.jobInForm.powJobCode = response.jobInfo.code;
this.jobInForm.pwoId = response.jobInfo.pwoId;
this.jobInForm.pwoCode = response.jobInfo.pwoCode;
this.jobInForm.type = 2;
if (response.materials != null && response.materials.length >
0) {
for (let i in response.materials) {
let obj = {};
obj.materialCode = response.materials[i].cPtNo;
obj.materialName = response.materials[i].cTitle;
obj.materialBatch = response.materials[i].batchNo;
obj.whCodeDest = "op-" + response.jobInfo.opCode;
obj.availableNum = response.materials[i].availableNum;
obj.locCodeDest = this.equipmentCode + "-01";
obj.number = null;
this.jobInForm.mesPwoJobCvDetailList.push(obj);
}
} else {
this.$modal.msg("未查询到可转入的原材料!");
}
});
}
}
});
}
},
scanBarOperateBy() {
let obj = {
empCode: this.operateByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.operateBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
},
//工位编码
scanBarStationCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.stationCode = res.result;
_this.scanStationCode(_this.stationCode);
}
});
},
scanStationCode(code) {
let obj = {
stationCode: code
}
listStation(obj).then(res => {
if (res.rows.length > 0) {
this.stationId = res.rows[0].id
} else {
this.$modal.msg("未查询到该工位无法同步ESOP")
}
});
},
jobInSubmit() {
//判断是否输入工位并进行同步esop
if (this.stationCode && this.stationCode != '' && this.stationId && this.stationId != '') {
addCustomizeEsop({
pwoJobId: this.jobInForm.pwoJobId,
stationId: this.stationId,
stationCode: this.stationCode,
pwoJobCode: this.jobInForm.pwoJobCode
}).then(resp => {
this.$modal.msgSuccess("ESOP同步成功!");
});
}
//判断是否输入时间
if (this.value1 && this.value1 != '') {
switch (this.radiovalue1) {
case '开工':
pwoStart(this.jobInForm.pwoJobId, this.value1).then(res => {
this.$modal.msgSuccess("作业开工成功!");
});
break;
case '暂停':
pwoStop(this.jobInForm.pwoJobId, this.value1).then(res => {
this.$modal.msgSuccess("作业暂停成功!");
});
break;
}
}
this.jobInForm.operateBy = this.operateBy;
this.$refs["jobInForm"].validate().then(valid => {
//作业转入
this.$modal.loading('提交中')
addConversion(this.jobInForm).then(response => {
this.$modal.closeLoading();
this.$modal.msgSuccess("转入成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
}
}
</script>
<style>
</style>

436
pages/mes/jobCv/jobIn.vue Normal file
View File

@@ -0,0 +1,436 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="上机转入单" :open="true">
<uni-forms-item label="作业编码" :labelWidth="90" name="pwoJobCode">
<!-- <utils-input prefixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode" @focus="focus" :focus='true' @click="focus" @input="handleInput" :key="input.boolean"></utils-input> -->
<uni-easyinput
prefixIcon="scan"
@iconClick="scanBar"
type="text"
@confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"
@click="focus"
@input="handleInput"
:key="input.boolean"
></uni-easyinput>
<!-- <uni-easyinput type="text" prefixIcon="scan"
ref="saleCode"
class="Number"
placeholder="请扫描销售单号!"
placeholderStyle="color:black"
v-model="getCode.saleCode"
@iconClick="iconClick('number')"
@input="getNumberCode"
:focus='open'
clearable
/> -->
</uni-forms-item>
<uni-forms-item label="工单" :labelWidth="90" name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="工位编码" :labelWidth="90" name="stationCode">
<uni-easyinput suffixIcon="scan" type="text" v-model="stationCode" @iconClick="scanBarStationCode" @input="scanStationCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth="90" name="equipmentCode">
<uni-easyinput suffixIcon="scan" :disabled="flag" ref="equipmentCode" @iconClick="scanBar1" type="text" v-model="equipmentCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item v-show="show" :labelWidth="90" style="text-align: center" name="">
<button type="primary" size="mini" style="text-align: center; font-size: 18px" @click="eqpBind">绑定</button>
</uni-forms-item>
<uni-forms-item label="选择状态" :labelWidth="90">
<u-radio-group v-model="radiovalue1" placement="row">
<u-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name"></u-radio>
</u-radio-group>
</uni-forms-item>
<uni-forms-item :label="radiovalue1 + '时间'" :labelWidth="90">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="value1" />
</view>
</uni-forms-item>
<uni-forms-item label="操作人编码" :labelWidth="90" name="operateByCode">
<uni-easyinput suffixIcon="scan" @confirm="scanBarOperateBy" @iconClick="scanBar2" type="text" v-model="operateByCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="操作人" :labelWidth="90" name="operateBy">
<uni-easyinput disabled type="text" v-model="operateBy"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移单类型" :labelWidth="90" name="type">
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth="90" name="remark">
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="上机转入单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item
:rightOptions="rightOptions"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
:key="index"
@click="(data) => clickDetail(index, data)"
@change="swipChange"
>
<!-- <uni-badge :text="index+1" type="primary"><u-tag text="未核销" size="large" type="error" plain
plainFill></u-tag></uni-badge> -->
<!-- <div><u-tag text="未核销" size="mini" type="error" plain plainFill></u-tag></div> -->
<uni-forms-item label="物料编码" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标仓库" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标库位" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="可转入数量" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.availableNum'">
<uni-easyinput type="text" disabled v-model="item.availableNum"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移数量" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.number'">
<uni-easyinput type="text" v-model="item.number"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<view style="text-align: center; margin: 10px 0" v-show="jobInForm.mesPwoJobCvDetailList.length > 0">
<button type="primary" size="mini" style="text-align: center; font-size: 18px" @click="byDetailAdd">照单领</button>
</view>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import { handleConvert, getEquipment, addConversion, listEmpEqpHistory, listEmployee, listConversion, pwoStart, pwoStop } from '@/api/mes/jobIn.js';
import { updatePwoJob, listEquipment, getPwoJob, listPwoJob } from '@/api/mes/jobReport.js';
import { listStation, addCustomizeEsop } from '@/api/esop/esop.js';
import { listPwoLike } from '@/api/mes/pwoIn.js';
import utilsInput from '@/utils/uniapp/utilsInput.vue';
export default {
components: {
utilsInput
},
data() {
return {
input: {
boolean: 0,
inputValue: ''
},
value1: null,
radiolist1: [
{
name: '开工',
disabled: false
},
{
name: '暂停',
disabled: false
}
],
radiovalue1: '开工',
stationCode: null,
jobInForm: {
mesPwoJobCvDetailList: []
},
stationId: null,
number: null,
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [
{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}
],
rules: {
pwoJobCode: {
rules: [
{
required: true,
errorMessage: '请输入作业编码!'
}
]
}
// materialName: [{
// required: false,
// errorMessage: '请输入物料名称!'
// }],
// number: [{
// required: true,
// errorMessage: '请输入转移数量!'
// }],
// equipmentCode: {
// rules: [{
// pattern: '^[A-Z0-9]+$',
// errorMessage: '请输入正确格式的设备编码!',
// trigger: 'blur',
// }]
// }
}
};
},
mounted() {
listEquipment().then((response) => {
this.equipmentList = response.rows;
});
},
methods: {
//照单领
byDetailAdd() {
if (this.jobInForm.mesPwoJobCvDetailList.length > 0) {
for (var i in this.jobInForm.mesPwoJobCvDetailList) {
this.jobInForm.mesPwoJobCvDetailList[i].number = this.jobInForm.mesPwoJobCvDetailList[i].availableNum;
}
}
},
deleteDetail(index) {
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
},
clickDetail(itemIndex, { position, index }) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
reset(code) {
this.jobInForm = {
pwoJobCode: code,
mesPwoJobCvDetailList: []
};
this.equipmentCode = null;
this.operateBy = null;
this.operateByCode = null;
},
eqpBind() {
let id = Number(this.jobInForm.pwoJobCode.substring(4));
//判断是否有该设备
if (this.equipmentCode != '' && this.equipmentCode) {
let query = {
equipmentCode: this.equipmentCode
};
listEquipment(query).then(async (res) => {
if (res.rows.length != 0) {
//绑定设备
let data = {
id: this.jobInForm.pwoJobCode.slice(4),
eqpId: res.rows[0].id
};
this.$modal.loading('提交中');
updatePwoJob(data).then((res) => {
this.$modal.closeLoading();
this.$modal.msgSuccess('绑定成功!');
this.show = false;
this.flag = true;
this.scanJobCode(this.jobInForm.pwoJobCode);
});
} else {
this.$modal.msg('未查询到该设备编码!');
}
});
} else {
this.$modal.msg('请输入设备编码!');
}
},
scanJobCode(code) {
if (code) {
this.reset(code);
// let id = Number(code.substring(4));
listPwoJob({
code: code
}).then(async (res) => {
if (res.rows.length != 0) {
if (!res.rows[0].eqpId) {
//未绑定设备,设备编码框可用,绑定按钮显示
this.$modal.msg('该作业未绑定设备,请绑定设备!');
this.flag = false;
this.show = true;
} else {
//已绑定设备,
handleConvert(res.rows[0].id).then(async (response) => {
this.equipmentCode = this.equipmentList.find((item) => item.id == response.jobInfo.eqpId).equipmentCode; //赋值设备编码
listEmpEqpHistory({
equipmentCode: this.equipmentCode
}).then(async (res) => {
if (res.rows.length != 0) {
//取上机且未下机的人员
if (res.rows[res.rows.length - 1].startTime && !res.rows[res.rows.length - 1].endTime) {
this.operateBy = res.rows[res.rows.length - 1].empName;
this.operateByCode = res.rows[res.rows.length - 1].empCode;
}
}
});
this.jobInForm.pwoJobId = response.jobInfo.id;
this.jobInForm.powJobCode = response.jobInfo.code;
this.jobInForm.pwoId = response.jobInfo.pwoId;
this.jobInForm.pwoCode = response.jobInfo.pwoCode;
this.jobInForm.type = 2;
if (response.materials != null && response.materials.length > 0) {
for (let i in response.materials) {
let obj = {};
(obj.type = response.materials[i].type),
(obj.materialBatchNo = response.materials[i].batchNo),
(obj.productionVersion = response.materials[i].productionVersion),
(obj.materialCode = response.materials[i].cPtNo);
obj.materialName = response.materials[i].cTitle;
obj.materialBatch = response.materials[i].batchNo;
obj.whCodeDest = 'op-' + response.jobInfo.opCode;
obj.availableNum = response.materials[i].availableNum;
obj.locCodeDest = this.equipmentCode + '-01';
obj.number = null;
this.jobInForm.mesPwoJobCvDetailList.push(obj);
}
} else {
this.$modal.msg('未查询到可转入的原材料!');
}
});
}
}
});
}
},
scanBarOperateBy() {
let obj = {
empCode: this.operateByCode
};
listEmployee(obj).then(async (res) => {
if (res.rows.length != 0) {
this.operateBy = res.rows[0].name;
} else {
this.$modal.msg('未查询到该人员信息!');
}
});
},
//工位编码
scanBarStationCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function (res) {
_this.stationCode = res.result;
_this.scanStationCode(_this.stationCode);
}
});
},
scanStationCode(code) {
let obj = {
stationCode: code
};
listStation(obj).then((res) => {
if (res.rows.length > 0) {
this.stationId = res.rows[0].id;
} else {
this.$modal.msg('未查询到该工位无法同步ESOP');
}
});
},
jobInSubmit() {
//判断是否输入工位并进行同步esop
if (this.stationCode && this.stationCode != '' && this.stationId && this.stationId != '') {
addCustomizeEsop({
pwoJobId: this.jobInForm.pwoJobId,
stationId: this.stationId,
stationCode: this.stationCode,
pwoJobCode: this.jobInForm.pwoJobCode
}).then((resp) => {
this.$modal.msgSuccess('ESOP同步成功!');
});
}
//判断是否输入时间
if (this.value1 && this.value1 != '') {
switch (this.radiovalue1) {
case '开工':
pwoStart(this.jobInForm.pwoJobId, this.value1).then((res) => {
this.$modal.msgSuccess('作业开工成功!');
});
break;
case '暂停':
pwoStop(this.jobInForm.pwoJobId, this.value1).then((res) => {
this.$modal.msgSuccess('作业暂停成功!');
});
break;
}
}
this.jobInForm.operateBy = this.operateBy;
this.$refs['jobInForm'].validate().then((valid) => {
//作业转入
this.$modal.loading('提交中');
addConversion(this.jobInForm).then((response) => {
this.$modal.closeLoading();
this.$modal.msgSuccess('转入成功!');
setTimeout(() => {
this.$tab.switchTab('/pages/work/index');
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function (res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function (res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function (res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
/**
* 隐藏软键盘
*/
focus() {
uni.hideKeyboard();
},
/**
* 不让手动输入
* @param {Object} value
*/
handleInput(value) {
const { inputValue } = this.input;
if (value.length - inputValue.length == 1 || inputValue.length - value.length == 1) {
this.$modal.msg('请扫描');
this.jobInForm.pwoJobCode = null;
this.input.inputValue = value;
this.input.boolean = this.input.boolean == 0 ? 10 : 0;
return;
}
this.input.inputValue = value;
}
}
};
</script>
<style></style>

View File

@@ -0,0 +1,86 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="物料件号" :labelWidth='90' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pieceNo" type="text" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addPiece
} from "@/api/mes/jobReport.js";
export default {
mounted() {
},
data() {
return {
formData: {
pieceNo: null,
},
rules: {
pieceNo: {
rules: [{
required: true,
errorMessage: '请输入件号!'
}]
},
}
}
},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
_this.scanBarCode(_this.formData.pieceNo);
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定转入吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData.pieceNo);
_this.$modal.loading('提交中')
addPiece(_this.formData.pieceNo).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("件号转入成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,83 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="物料件号" :labelWidth='90' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pieceNo" type="text" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
pieceReport
} from "@/api/mes/jobReport.js";
export default {
mounted() {
},
data() {
return {
formData: {
pieceNo: null,
},
rules: {
pieceNo: {
rules: [{
required: true,
errorMessage: '请输入件号!'
}]
},
}
}
},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定报工吗?',
success: function(res) {
if (res.confirm) {
_this.$modal.loading('提交中')
pieceReport(_this.formData.pieceNo, {}).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("件号报工成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,355 @@
<template>
<view>
<div class="head">
<table>
<tr>
<td colspan='2'>
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描作业!"
v-model="machineCode"
@iconClick="iconClick('machineCode')"
@change="changeInput('machineCode',$event)"
/>
</td>
</tr>
<tr>
<td>作业编码{{form.pwoJobCode}}</td>
</tr>
<tr>
<td>&emsp;&emsp;{{form.opTitle}}</td>
</tr>
<tr>
<td>物料编码{{form.pwoCode}}</td>
</tr>
<tr>
<td>物料名称{{form.ptTitleTar}}</td>
</tr>
</table>
<div @click="clickButton('qualified')" :class="{bgColor:bgColor === 'qualified'}">合格</div>
<div @click="clickButton('bad')" :class="{bgColor:bgColor === 'bad'}">不良</div>
<div @click="clickButton('scrap')" :class="{bgColor:bgColor === 'scrap'}">报废</div>
<view class="uni-px-5 uni-pb-5" v-show="bgColor === 'bad'">
<uni-data-checkbox mode="button" v-model="form.reason" :localdata="reason.bad"></uni-data-checkbox>
</view>
<view class="uni-px-5 uni-pb-5" v-show="bgColor === 'scrap'">
<uni-data-checkbox mode="button" v-model="form.reason" :localdata="reason.scrap"></uni-data-checkbox>
</view>
</div>
<div class="body">
<uni-easyinput type="text" prefixIcon="scan"
placeholder="请扫描件号!"
v-model="pieceNo"
@iconClick="iconClick('pieceNo')"
@change="changeInput('pieceNo',$event)"
/>
<uni-table ref="table" border stripe>
<uni-tr>
<uni-th align="center">序号</uni-th>
<uni-th style="width: 80%"align="center">件号</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in pieceNoList" :key="index">
<uni-td align="center">{{ index+1 }}</uni-td>
<uni-td align="center"> {{item}} </uni-td>
</uni-tr>
</uni-table>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
</view>
</template>
<script>
import {
listPwoJob
} from '@/api/mes/jobReport.js'
import {
getDicts
} from '@/api/system/dict/dictData.js'
import {
addReport,listEquipment
} from '@/api/mes/jobReport.js'
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
//页面加载生命周期
onLoad: async function (option) { //option为object类型会序列化上个页面传递的参数
const _self = this;
if(option.status) _self.state = true
},
data() {
return {
machineCode: null , //扫描作业
isPieceIn: true, //判断哪个路由进来
form:{
}, //头部展示数据
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
bgColor: null,//决定按钮颜色
reason:{},//不良以及报废原因
pieceNo:null,//件号
pieceNoList:new Set(), //table展示数据
listEquipment:[],//设备信息
}
},
/**
* vue生命周期
* 当组件挂载后触发
*/
async mounted() {
const _self = this;
const data = await Promise.all([
//获取不良品原因
_self.getApi('getDicts','mes_job_report_defect'),
//报废品
_self.getApi('getDicts','mes_job_report_scrap'),
_self.getApi('listEquipment')
])
const [bad,scrap,listEquipment] = data
bad.forEach(item=>{
item.text = item.dictLabel,
item.value = item.dictValue
});
scrap.forEach(item=>{
item.text = item.dictLabel,
item.value = item.dictValue
})
_self.listEquipment = listEquipment
_self.reason = Object.assign({},{bad,scrap})
},
methods: {
/**
* 扫码方法
* @param {string} value {'equipment' || }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
const obj = {
machineCode:getMachineCode,
pieceNo:getPieceNo,
}
_self.obj(value)(res.result)
}
})
},
/**
* input框change事件
* @param {string} key
* @param {Object} value
*/
changeInput(key,value){
if(value === null || value === '') return
const _self = this;
const obj = {
machineCode : 'getMachineCode',
pieceNo: 'getPieceNo',
}
_self[obj[key]](value)
},
/**
* 扫描作业方法
* @param {Object} value
*/
async getMachineCode(value){
if(value === null) return
const _self = this;
//清空数据
_self.bgColo =null;
_self.pieceNoList = new Set();
const rows = await _self.getApi('listPwoJob',{code:value})
if(rows.length != 0){
const {code : pwoJobCode,opTitle,pwoCode,ptTitleTar,ptNoTar,opCode,batchNo,eqpId} = rows[0]
_self.form = Object.assign({},{
pwoJobCode,opTitle,pwoCode,ptTitleTar,ptNoTar,opCode,batchNo,
isPieceIn:_self.state
})
//获取设备信息,并选择该作业的设备
const listEquipment = _self.listEquipment
for(let i in listEquipment){
if(listEquipment[i].id === eqpId)return _self.form.machineId = listEquipment[i].equipmentCode
}
}
},
/**
* 扫描件号方法
* @param {Object} value
*/
async getPieceNo(value){
const _self = this;
_self.pieceNo = null
if(_self.form.reason === null && _self.form.type != '合格品'){
_self.messageType({
msgType:'warn',
messageText:'请选择一个问题'
})
return
}
const pieceNoList = _self.pieceNoList
if(pieceNoList.has(value)){
_self.messageType({
msgType:'error',
messageText:'该件号已被扫描'
})
return
}
_self.submit(value).then(res=>{
if(res != undefined) return pieceNoList.add(value)
}).finally(()=>{
})
},
/**
* 按钮点击方法
* @param {Object} key
* @param {Object} evnet
*/
clickButton(key){
const _self = this;
_self.clickState(key)
},
/**
* 产品状态按钮点击事件
* @param {Object} key
*/
clickState(key){
const _self = this;
_self.bgColor = key
const obj = {
qualified:'合格品',
bad:'不良品',
scrap:'报废'
}
_self.form.reason = null
_self.form.type = obj[key]
},
/**
* 件号扫描后提交事件
* @param {Object} value 当前扫描的值
*/
async submit(pieceNo){
const _self = this;
// 获取当前北京时间的时间戳(单位为毫秒)
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
var endTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
//获取账户名
const createByName = uni.getStorageSync('HBusername');
const reportNumber = 1;
const way = "人工报工";
const form = Object.assign(_self.form,{
endTime,createByName,reportNumber,way,pieceNo
})
return await _self.getApi('addReport',form)
},
/**
* 接口调用管理方法
* 所有向后端发送的请求全部从这里调用
* @param {Object} api api接口
* @param {Object} value 带入的参数
*/
async getApi(api,value){
const _self = this;
const objApi = {
listPwoJob,
getDicts,
addReport,
listEquipment
}
try{
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = await objApi[api](value)
if(api === 'addReport'){
return data
}
return data.rows ? data.rows : data.data
}catch(e){
_self.messageType({
msgType:'error',
messageText:'接口请求出错'
})
}finally{
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 提示信息
* @param {Object} obj
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #ffffff;
color: #585858;
font-size: 4vw;
}
view {
width: 95vw;
margin: 0 auto;
}
.head {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
table{
width: 100%;
}
&>div{
border: 1vw solid #21cfff;
border-radius: 20%;
width: 20vw;
text-align:center;
line-height: 8vw;
}
}
.body{
margin-top: 1vw;
&>* {
margin-top: 2vw;
}
.td{
text-align:center;
}
}
.bgColor {
background-color: #c4ffd0;
}
</style>

View File

@@ -0,0 +1,111 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode" type="text"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">关闭工单</u-button>
</view>
</template>
<script>
import {
getPwo,
listPwo,
pwoAtificialClose
} from "@/api/mes/pwoDraw.js";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
export default {
mounted() {
},
data() {
return {
formData: {
pwoCode: null,
},
id: null,
value: 0,
range: [],
status: null,
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入生产工单!'
}]
},
}
}
},
methods: {
scanBarCode() {
const _this = this;
if (_this.formData.pwoCode) {
let obj = {
pwoCode: _this.formData.pwoCode
}
listPwo(obj).then(res => {
if (res.rows.length > 0) {
_this.id = res.rows[0].id;
_this.status = res.rows[0].status;
} else {
_this.$modal.msg("未找到该工单!")
}
})
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定关闭该生产工单吗?',
success: function(res) {
if (res.confirm) {
//判断工单是否能关闭
if (_this.status >= 7) {
_this.$modal.msg("该工单无法关闭!")
} else {
_this.$modal.loading('提交中')
pwoAtificialClose('"' + _this.id + '"').then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("工单关闭成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

208
pages/mes/jobCv/pwoDraw.vue Normal file
View File

@@ -0,0 +1,208 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="领料转移单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<view class="uni-flex uni-row">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoCode"></uni-easyinput>
</view>
</uni-forms-item>
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
<uni-data-select v-model="jobInForm.type" :localdata="typeOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="领料转移单明细" :labelWidth='90' :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput type="text" disabled v-model="item.materialBatchNo"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="生产车间" :labelWidth='90' :rules="rules.workshopCode"
:name="'mesPwoJobCvDetailList.'+ index +'.workshopCode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarworkshopCode(index)" type="text"
v-model="item.workshopCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标仓库" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标库位" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移数量" :labelWidth='90' :rules="rules.number"
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
<u-number-box button-size="36" inputWidth="120" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
getDrawMat,
addConversion
} from "@/api/mes/pwoDraw.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
export default {
onLoad: function(option) {
console.log(option);
if (option) {
this.jobInForm.pwoCode = option.pwoCode;
this.jobInForm.type = option.type
this.jobInForm.mesPwoJobCvDetailList = JSON.parse(decodeURIComponent(option.mesPwoJobCvDetailList));
this.isPwoRoute = true;
}
getDicts("mes_conv_type").then(res => {
this.typeOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
},
data() {
return {
isPwoRoute: false,
typeOptions: [],
jobInForm: {
pwoCode: "",
mesPwoJobCvDetailList: [],
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
pwoCode: [{
rules: [{
required: true,
errorMessage: '请输入工单!'
}]
}],
type: [{
rules: [{
required: true,
errorMessage: '请输入转移单类型!',
}]
}],
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: true,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
workshopCode: [{
required: true,
errorMessage: '请输入生产车间!'
}]
}
}
},
methods: {
deleteDetail(index) {
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
submit() {},
reset(code) {
this.jobInForm = {
pwoCode: code,
mesPwoJobCvDetailList: [],
};
},
scanJobCode(code) {
if (code) {
getDrawMat(code).then(res => {
this.reset(code);
this.jobInForm.type = 1;
for (let i = 0; i < res.rows.length; i++) {
let obj = {};
obj.materialCode = res.rows[i].materialCode;
obj.materialName = res.rows[i].materialName;
obj.materialBatchNo = res.rows[i].materialBatchNo;
this.jobInForm.mesPwoJobCvDetailList.push(obj);
}
})
}
},
jobInSubmit() {
this.$refs["jobInForm"].validate().then(valid => {
this.$modal.loading('提交中')
addConversion(this.jobInForm).then(response => {
this.$modal.closeLoading();
this.$modal.msgSuccess("工单领料成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoCode);
}
});
},
scanBarworkshopCode(index) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.mesPwoJobCvDetailList[index].workshopCode = res.result;
}
});
}
}
}
</script>
<style>
</style>

152
pages/mes/jobCv/pwoIn.vue Normal file
View File

@@ -0,0 +1,152 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="完工转移单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="完工转移单明细" :open="true">
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
<u-button type="primary" @click="submit">确认</u-button> -->
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<!-- <uni-forms-item label="目标仓库" :name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标库位" :name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item> -->
<uni-forms-item label="转移数量" :labelWidth='90' :rules="rules.number"
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
getInMat,
addConversion
} from "@/api/mes/pwoIn.js";
export default {
data() {
return {
jobInForm: {
mesPwoJobCvDetailList: [],
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: true,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
}
}
},
methods: {
addDetail() {
this.jobInForm.mesPwoJobCvDetailList.push({});
},
deleteDetail(index) {
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
submit() {},
reset(code) {
this.jobInForm = {
pwoCode: code,
mesPwoJobCvDetailList: [],
};
},
scanJobCode(code) {
if (code) {
getInMat(code).then(res => {
this.reset(code);
console.log(res);
this.jobInForm.type = 3;
for (let i = 0; i < res.rows.length; i++) {
let obj = {};
obj.materialCode = res.rows[i].materialCode;
obj.materialName = res.rows[i].materialName;
obj.number = res.rows[i].number;
this.jobInForm.mesPwoJobCvDetailList.push(obj);
}
})
}
},
jobInSubmit() {
this.$refs["jobInForm"].validate().then(valid => {
this.$modal.loading('提交中')
addConversion(this.jobInForm).then(response => {
this.$modal.closeLoading();
this.$modal.msgSuccess("工单领料成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoCode);
}
});
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,441 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode" type="text"
@confirm="scanBarCode" />
</uni-forms-item>
<uni-forms-item label="状态" :labelWidth='90'>
<uni-tag :text="pwotag(status)" type="warning"></uni-tag>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<uni-row style="margin-top: 20px;" :gutter="10">
<uni-col :span="8" style="text-align: center;">
<u-button type="warning" @click="selectPwoStock(formData.pwoCode)">物料核销</u-button>
</uni-col>
<uni-col :span="8" style="text-align: center;">
<u-button type="success" @click="submitIn" :disabled="disabledIn">入库</u-button>
</uni-col>
<uni-col :span="8" style="text-align: center;">
<u-button type="primary" @click="submitClose" :disabled="disabledClose">关闭工单</u-button>
</uni-col>
</uni-row>
</uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom" v-for="(item,index) in pwoJobList" :key="index">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>生产工单作业编码</strong> : {{item.code}}</view>
<view><strong>制程编码</strong> : {{item.opCode}}</view>
<view><strong>制程名称</strong> : {{item.opTitle}}</view>
<view><strong>开工状态</strong> :
<uni-tag :text="jobtag(item.status)" type="success"></uni-tag>
</view>
<view><strong>目标产量</strong> : {{item.targetNum}}</view>
<view><strong>已完成数量</strong> : {{item.finishQty}}</view>
<view><strong>合格总数</strong> : {{item.totalOutput}}</view>
<view><strong>不良总数</strong> : {{item.totalDefect}}</view>
<view><strong>报废总数</strong> : {{item.totalScrap}}</view>
<view><strong>损耗总数</strong> : {{item.totalLoss}}</view>
<uni-row>
<uni-col :span="18">
<view><strong>在制数量</strong> : {{item.makingNum}}</view>
<view><strong>结存数量</strong> : {{item.surplusNum}}</view>
</uni-col>
<uni-col :span="6"> <u-button type="primary" @click="report(item.code)"
v-show="item.status<5">报工</u-button></uni-col>
</uni-row>
</view>
</view>
</view>
</view>
</view>
<u-popup :show="show" @close="close" @open="getMaterialStock" :closeable="true">
<view class="cu-card article ">
<view class="cu-item shadow borderBottom" v-for="(item,index) in materialStockList" :key="index">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料</strong> : {{item.materialCode+':'+item.materialName}}</view>
<view><strong>批号</strong> : {{item.batchNo}}</view>
<view><strong>类型</strong> :
<uni-tag :text="typetag(item.type)" :type="colortag(item.type)"></uni-tag>
</view>
<view><strong>数量</strong> : {{item.number}}</view>
<view><strong>仓库</strong> :
<picker @change="val => {warehouseConfirm(val,item);}" :value="tyindex"
:range="range" range-key="warehouseName">
<view>选择:{{item.whName}}</view>
</picker>
</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
getPwo,
listPwo,
pwoAtificialClose,
handleIn,
listCirculateBalance,
listSimpleCirculateBalance
} from "@/api/mes/pwoDraw.js";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
import {
listStock
} from "@/api/mes/pwoIn.js";
export default {
mounted() {
listWarehouse().then(async res => {
this.range = res.rows
// for (var i = 0; i < res.rows.length; i++) {
// this.range[0][i].value = res.rows[i].warehouseCode;
// this.range[0][i].text = res.rows[i].warehouseName;
// }
})
},
data() {
return {
tyindex: null,
index: 0,
show: false,
materialStockList: [],
wmsOpTransferOutStockList: [],
disabledIn: false,
disabledClose: false,
formData: {
pwoCode: null,
},
id: null,
value: null,
range: [],
status: null,
pwoJobList: [],
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入生产工单!'
}]
},
}
}
},
methods: {
typeCancel() {
this.warehouseshow = false;
},
typeConfirm(e, item) {
item.warehouseName = this.range[e.detail.value].warehouseName;
item.warehouseCode = this.range[e.detail.value].warehouseCode;
this.tyindex = e.detail.value
},
typeClose() {
this.warehouseshow = false;
},
close() {
this.show = false;
},
/** 获取物料信息 */
getMaterialStock(ids) {
// 清空物料库存信息
this.materialStockList = [];
listStock({
pwoBelongCode: this.formData.pwoCode
}).then((resp) => {
this.materialStockList = this.materialStockList.concat(resp.rows);
});
},
stockConvertion(code) {
this.selectPwoStock(code)
},
selectPwoStock(pwoCode) {
listStock({
pwoBelongCode: pwoCode
}).then((res) => {
if (res.rows.length > 0) {
this.wmsOpTransferOutStockList = res.rows.map(obj => {
return {
stockId: obj.id,
materialCode: obj.materialCode,
materialName: obj.materialName,
batchNo: obj.batchNo,
lotNo: obj.lotNo,
pieceNo: obj.pieceNo,
storageLocationCode: obj.storageLocationCode,
type: obj.type,
num: obj.number
}
});
console.log(this.wmsOpTransferOutStockList)
if (this.wmsOpTransferOutStockList && this.wmsOpTransferOutStockList != []) {
uni.navigateTo({
url: '/pages/mes/jobCv/stockConvertion?wmsOpTransferOutStockList=' +
encodeURIComponent(
JSON.stringify(this.wmsOpTransferOutStockList))
});
}
} else {
this.$modal.msg("未查询到该工单工序消耗信息!")
}
});
},
colortag(type) {
switch (Number(type)) {
case 1:
return 'success';
break;
case 2:
return 'warning';
break;
case 3:
return 'error';
break;
case 4:
return 'primary';
break;
default:
return '无';
break;
}
},
typetag(type) {
switch (Number(type)) {
case 1:
return '合格品';
break;
case 2:
return '不良品';
break;
case 3:
return '报废品';
break;
case 4:
return '待退料';
break;
default:
return '无';
break;
}
},
jobtag(status) {
switch (Number(status)) {
case 1:
return '计划中';
break;
case 2:
return '材料转入';
break;
case 3:
return '作业开工';
break;
case 4:
return '作业暂停';
break;
case 5:
return '作业完工';
break;
case 6:
return '完成品转出';
break;
case 7:
return '取消';
break;
default:
return '无';
break;
}
},
pwotag(status) {
switch (Number(status)) {
case 1:
return '计划中';
break;
case 2:
return '已生成作业';
break;
case 3:
return '已投料';
break;
case 4:
return '已领料';
break;
case 5:
return '已开工';
break;
case 6:
return '暂停';
break;
case 7:
return '已完成';
break;
case 8:
return '结案';
break;
case 9:
return '取消';
break;
case 10:
return '待入库';
break;
case 11:
return '待转出';
break;
case 12:
return '已转出';
break;
case 13:
return '其他';
break;
default:
return '无';
break;
}
},
scanBarCode() {
const _this = this;
_this.disabledClose = false;
_this.disabledIn = false;
if (_this.formData.pwoCode) {
let obj = {
pwoCode: _this.formData.pwoCode
}
listPwo(obj).then(res => {
if (res.rows.length > 0) {
_this.id = res.rows[0].id;
_this.status = res.rows[0].status;
if (_this.status >= 7) {
_this.disabledClose = true;
} else if (_this.status != 10) {
_this.disabledIn = true;
}
} else {
_this.$modal.msg("未找到该工单!")
}
});
_this.$modal.loading('提交中')
listSimpleCirculateBalance(obj).then((response) => {
_this.pwoJobList = response.rows;
}).finally(()=>{
_this.$modal.closeLoading();
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
submitClose() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定关闭该生产工单吗?',
success: function(res) {
if (res.confirm) {
//判断工单是否能关闭
if (_this.status >= 7) {
_this.$modal.msg("该工单无法关闭!")
} else {
_this.$modal.loading('提交中')
pwoAtificialClose('"' + _this.id + '"').then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("工单关闭成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
report(code) {
uni.navigateTo({
url: '/pages/mes/jobReport/onceReport?code=' + code
});
},
async submitIn() {
this.materialStockList = [];
this.$modal.loading('提交中')
await listStock({
pwoBelongCode: this.formData.pwoCode
}).then((resp) => {
this.$modal.closeLoading();
this.materialStockList = this.materialStockList.concat(resp.rows);
uni.navigateTo({
url: '/pages/mes/jobCv/pwoWarehousing?pwoCode=' + this.formData.pwoCode +
'&materialStockList=' + encodeURIComponent(JSON.stringify(
this.materialStockList))
});
});
// const _this = this;
// this.$refs.form.validate().then(res => {
// uni.showModal({
// title: '提示',
// content: '您确定入库该生产工单吗?',
// success: function(res) {
// if (res.confirm) {
// if (_this.status != 10) {
// console.log(_this.status);
// _this.$modal.msg("该工单不是‘待入库’状态,请重新输入!")
// } else {
// _this.formData.warehouseCode = _this.value
// console.log(_this.formData)
// handleIn(Number(_this.formData.pwoCode.slice(4)), _this.formData
// .warehouseCode).then(res => {
// _this.$modal.msgSuccess("入库成功!");
// setTimeout(() => {
// _this.$tab.switchTab("/pages/work/index");
// }, 500);
// });
// }
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// });
},
}
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card>.cu-item {
margin: 13px 0;
}
</style>

View File

@@ -0,0 +1,271 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="formData" ref="form" :rules="rules">
<uni-collapse-item title="工单入库单" :open="true">
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
<uni-easyinput suffixIcon="scan" v-model="formData.pwoCode" @iconClick="scanBar" type="text"
@confirm="scanBarCode"></uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<!-- <u-divider text="工单入库单明细"></u-divider> -->
<!-- <uni-collapse-item title="工单入库单明细" :open="true"> -->
<view :key="item.id" v-for="(item, index) in materialStockList" style="over-flowe">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'. materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth="90">
<uni-tag :text="typetag(item.type)" :type="colortag(item.type)"
@click="showConfirm(index)"></uni-tag>
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90' :rules="rules.number"
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth="90">
<!-- <view class="item" catchtap="hidekeyborad">
<picker @change="val => {typeConfirm(val,item);}" :value="tyindex" :range="range"
range-key="label">
<uni-easyinput type="text" v-model="item.whName" @focus="focus" />
</picker>
</view> -->
<uni-data-select v-model="item.whCode" :localdata="range"></uni-data-select>
</uni-forms-item>
</view>
<!-- </uni-collapse-item> -->
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">入库</u-button>
</view>
</template>
<script>
import {
getPwo,
listPwo,
handleIn
} from "@/api/mes/pwoDraw.js";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
import {
listStock
} from "@/api/mes/pwoIn.js";
export default {
onLoad: function(option) {
console.log(option);
if (option) {
this.formData.pwoCode = option.pwoCode;
this.materialStockList = JSON.parse(decodeURIComponent(option.materialStockList));
this.status = 10;
this.isSearchRoute = true;
this.scanBarCode()
}
},
mounted() {
listWarehouse().then(async res => {
// this.range = [res.rows]
console.log(this.range)
// res.rows.map(item => {
// item.label = item.warehouseCode + ':' + item.warehouseName;
// return item
// })
this.range = res.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode,
diasble: false
}
});
})
},
data() {
return {
whName: null,
flag: false,
isSearchRoute: false,
selectedWarehouseName: [],
materialStockList: [],
formData: {
pwoCode: null,
},
tyindex: null,
value: 0,
range: [],
status: null,
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入生产工单'
}]
},
}
}
},
methods: {
focus() {
console.log('key')
if (this.flag) {
return
} else {
console.log('key')
// plus.key.hideSoftKeybord()
uni.hideKeyboard()
}
},
typetag(type) {
switch (Number(type)) {
case 1:
return '合格品';
break;
case 2:
return '不良品';
break;
case 3:
return '报废品';
break;
case 4:
return '待退料';
break;
default:
return '无';
break;
}
},
colortag(type) {
switch (Number(type)) {
case 1:
return 'success';
break;
case 2:
return 'warning';
break;
case 3:
return 'error';
break;
case 4:
return 'primary';
break;
default:
return '无';
break;
}
},
change(e) {
console.log("e:", e);
},
scanBarCode() {
console.log(this.formData.pwoCode);
const _this = this;
console.log(_this.formData.pwoCode);
if (_this.formData.pwoCode) {
let obj = {
pwoCode: _this.formData.pwoCode
}
console.log(1);
listPwo(obj).then(async res => {
console.log(res.rows[0].id);
_this.pwoId = res.rows[0].id;
_this.status = res.rows[0].status;
})
}
/** 获取物料信息 */
// 清空物料库存信息
this.materialStockList = [];
console.log(this.formData.pwoCode);
listStock({
pwoBelongCode: this.formData.pwoCode
}).then((resp) => {
console.log(3);
this.materialStockList = this.materialStockList.concat(resp.rows);
});
},
typeConfirm(e, item) {
this.tyindex = null;
console.log(item)
item.whName = this.range[e.detail.value].warehouseName;
item.whCode = this.range[e.detail.value].warehouseCode;
this.tyindex = e.detail.value
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定入库该生产工单吗?',
success: function(res) {
if (res.confirm) {
if (_this.status != 10) {
console.log(_this.status);
_this.$modal.msg("该工单不是‘待入库’状态,请重新输入!")
} else {
// _this.formData.warehouseCode = _this.value;
let stockWhList = _this.materialStockList.map((obj) => {
return {
id: obj.id,
whCode: obj.whCode,
};
});
_this.$modal.loading('提交中')
handleIn(_this.pwoId, '1', stockWhList).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("入库成功!");
if (_this.isSearchRoute = true) {
setTimeout(() => {
_this.$tab.navigateBack();
}, 500);
} else {
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
}
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
upLoadSelect /deep/ .uni-select__selector-scroll {
overflow: hidden;
height: 1500px; //调整为合适的高度即可
}
</style>

View File

@@ -0,0 +1,102 @@
<template>
<view class="cu-card article ">
<uni-row>
<uni-col :span="6">
<u-button type="success" @click="restore">还原</u-button>
</uni-col>
</uni-row>
<view class="cu-item shadow borderBottom" v-for="(item,index) in wmsOpTransferOutStockList" :key="index">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{item.materialCode}}</view>
<view><strong>物料名称</strong> : {{item.materialName}}</view>
<view><strong>批号</strong> : {{item.batchNo}}</view>
<view><strong>件号</strong> : {{item.pieceNo}}</view>
<view><strong>库位</strong> : {{item.storageLocationCode}}</view>
<view><uni-row>
<uni-col :span="3">
<strong>数量</strong> :
</uni-col>
<uni-col :span="21"> <u-number-box v-model="item.num" @change="valChange"
inputWidth="120"></u-number-box></uni-col>
</uni-row>
</view>
<view><strong>单位</strong> : {{item.unitId}}</view>
<uni-row>
<uni-col :span="18">
<view><strong>备注</strong> : {{item.remark}}</view>
</uni-col>
<uni-col :span="6">
<u-button size="small" type="error" icon="trash"
@click="deleteList(index)">删除</u-button></uni-col>
</uni-row>
</view>
</view>
</view>
</view>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
customizeConvert
} from "@/api/mes/pwoIn.js";
export default {
onLoad: function(option) {
console.log(option);
this.wmsOpTransferOutStockList = JSON.parse(decodeURIComponent(
option.wmsOpTransferOutStockList));
this.formerWmsOpTransferOutStockList = JSON.parse(decodeURIComponent(
option.wmsOpTransferOutStockList));
},
data() {
return {
wmsOpTransferOutStockList: [],
formerWmsOpTransferOutStockList: []
}
},
methods: {
deleteList(i) {
this.formerWmsOpTransferOutStockList = [...this.formerWmsOpTransferOutStockList];
this.wmsOpTransferOutStockList.splice(i, 1);
console.log(this.wmsOpTransferOutStockList);
},
restore() {
this.wmsOpTransferOutStockList = this.formerWmsOpTransferOutStockList;
},
submit() {
const _this = this;
uni.showModal({
title: '提示',
content: '您确定核销吗?',
success: function(res) {
if (res.confirm) {
let requestData = {
wmsOpTransferOutStockList: _this.wmsOpTransferOutStockList
}
console.log(_this.wmsOpTransferOutStockList);
_this.$modal.loading('提交中')
customizeConvert(requestData).then((response) => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("核销成功!");
setTimeout(() => {
_this.$tab.navigateBack();
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
},
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
</style>

View File

@@ -0,0 +1,281 @@
<template>
<view id="view">
<div>
<table>
<tr>
<td>&emsp;&emsp;</td><td>{{from.body.pwoCode}}</td>
</tr>
<tr>
<td>物料编码</td><td>{{from.body.ptNoTar}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{from.body.ptTitleTar}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{from.body.specification1}}</td>
</tr>
<tr>
<td>物料图号</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.drawingid}}</td>
</tr>
<tr>
<td>客户名称</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.ks_name}}</td>
</tr>
<tr>
<td>是否冲孔</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.zdy5}}</td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;:</td><td>{{from.body.num}}</td>
</tr>
<tr>
<td>&emsp;&emsp;:</td><td>
<!-- <uni-easyinput type="text" v-model="from.body.deptCode" /> -->
<uni-data-select
v-model="from.body.deptCode"
:localdata="department"
></uni-data-select>
</td>
</tr>
<tr>
<td>接受仓库:</td><td>
<!-- <uni-easyinput type="text" v-model="from.body.whCode" /> -->
<uni-data-select
v-model="from.body.whCode"
:localdata="listWarehouse"
></uni-data-select>
</td>
</tr>
</table>
<p>物料转移单明细信息</p>
</div>
<scroll-view scroll-y="true" class="scroll" >
<view v-for="(item,index) in from.list" :key="index">
<table>
<tr>
<td>物料编码</td><td>{{item.materialCode}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{item.materialName}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{item.specification1}}</td>
</tr>
<tr>
<td>物料类型</td><td>{{item.typeText}}</td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;:</td><td>{{item.inNumber}}</td>
</tr>
<tr>
<td>入库数量</td><td><uni-easyinput type="number" v-model="item.number" @input="inputInNumber($event,item)" :key="item.number+item.materialCode"/></td>
</tr>
</table>
</view>
</scroll-view>
<button id="button" type="primary" @click="submit" :disabled="!getOpen">提交</button>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
addConversion
} from "@/api/mes/pwoIn.js";
export default {
data() {
return {
from:{
body:{
},
list:{}
},
department:[],
listWarehouse:[],
message:{
msgType:'warn',
messageText:'请先查询设备信息'
},
}
},
/**
* 挂载前执行
*/
beforeMount() {
//把查询页面查询到的数据放入进来
//处理详情数据
const {body, list} = this.$store.state.pwo.data
const typeObj = {
1:'合格品',
2:'不良品',
3:'报废品'
}
for(let i in list){
list[i].inNumber = list[i].number
list[i].typeText =typeObj[list[i].type]
}
this.from = Object.assign({},{body,list})
console.log(this.from)
this.from.body.dynamicField1 = JSON.parse(this.from.body.dynamicField1)
//接收完后清空vuex里面的数据清空
this.$store.commit('updatData',{})
//处理部门数据
const department = this.$store.state.pwo.department
for(let i in department){
const item = department[i]
item.value = item.departmentCode
item.text = item.departmentCode + "-" + item.departmentTitle
}
this.department = department
//处理仓库数据
const listWarehouse = this.$store.state.pwo.listWarehouse
for(let i in listWarehouse){
const item = listWarehouse[i]
item.value = item.warehouseCode
item.text = item.warehouseCode + '-' + item.warehouseName
}
this.listWarehouse = listWarehouse
},
mounted() {
//获取屏幕宽高
updateCss(resSize())
},
computed:{
getOpen(){
return Boolean(this.from.list.length)
}
},
methods: {
/**
* 提交按钮点击事件
*/
async submit(){
try{
const {body,list} = this.from;
const { pwoCode ,id ,status,deptCode, whCode} = body
const data = {
deptCode,
whCode,
type:"3",
delStatus:"0",
genRedraw: false,
mesPwoJobCvDetailList:list,
dynamicField1:JSON.stringify(body.dynamicField1),
pwoCode:pwoCode,
pwoId:id,
status,
}
addConversion(data).then(res => {
if(res.code === 200){
this.messageType({
msgType:'success',
messageText:'提交成功'
})
setTimeout(function() {
uni.navigateBack({
delta: 1
});
}, 2100); // 3000毫秒 = 3秒
}
})
}catch(e){
this.messageType({
msgType:'error',
messageText:'提交失败,失败原因‘' + e +''
})
}
},
/**
* 提示信息
* @param {Object|undefined} value
* {msgType,messageText} 参数里面需要包含这两个键
*/
messageType(obj){
const _self = this;
let message ={}
if(obj === undefined){
message = {
msgType:'error',
messageText:'请填写设备代码'
}
}else{
message = {
msgType:obj.msgType,
messageText:obj.messageText
}
}
_self.message = Object.assign({},message)
return _self.$refs.message.open()
},
/**
* 入库数量输入事件
* @param {number} value,输入的值
* @param {Object} item,当前的明细信息
*/
inputInNumber(value,item){
const { number } = item
if(number > value){
item.inNumber = number
}
}
}
}
/**
* 获取屏幕宽高
*/
function resSize(){
let width = 0;
let height = 0;
uni.getSystemInfo({
success: function (res) {
width = res.windowWidth; // 窗口宽度
height = res.windowHeight; // 窗口高度
}
});
return {width,height}
}
/**
* 设置元素高度
* @param {Object} size
*/
function updateCss(size){
document.querySelector("#view>div").style.height = size.height * 0.35 + 'px'
document.querySelector(".scroll").style.height = size.height * 0.65 - 46 + 'px'
}
</script>
<style lang="scss" scoped>
page {
background-color: #ffffff;
padding-top: 1vw;
#view {
--heightSize : 0;
width: 100%;
& > div {
width: 100%;
};
& > .scroll {
width: 100%;
}
}
}
table {
border-collapse: collapse;
width: 95%;
border: 1px solid #ccc;
font-size: 14px;
margin:0 auto;
tr td:first-child{
width: 30%;
}
};
p {
text-align:center;
}
</style>

View File

@@ -0,0 +1,167 @@
<template>
<view>
<uni-forms ref="form" :modelValue="form" label-width="25%" label-align="right" :rules="rules">
<uni-forms-item label="工单编号:" name="pwoCode" >
<uni-easyinput v-model="form.pwoCode" placeholder="请输入不小于5位的工单编号" />
</uni-forms-item>
<uni-forms-item label='批号:' name='batchNo'>
<uni-easyinput v-model="form.batchNo" placeholder="请输入不小于5位的批号" />
</uni-forms-item>
<uni-forms-item label="物料编码:" >
<uni-easyinput v-model="form.ptNoTar" placeholder="请输入物料编码" />
</uni-forms-item>
<uni-forms-item label="物料名称:" >
<uni-easyinput v-model="form.ptTitleTar" placeholder="请输入物料名称" />
</uni-forms-item>
<uni-forms-item label="物料规格:" >
<uni-easyinput v-model="form.specification1" placeholder="请输入物料规格" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="clickSubmit(form)" :disabled="formComputed">查询</button>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue/>
</uni-popup>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.type" :message="message.messageText" :duration="message.duration"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
listPwoLike
} from "@/api/mes/pwoIn.js";
import {listDepartment} from"@/api/basic/department.js"
import {
hasValue
} from "@/utils/judge"
import {listWarehouse} from "@/api/wms/pdcIn.js"
//引入加载动画
import lodingVue from "@/utils/loding/loding.vue";
export default {
components:{
lodingVue
},
data() {
return {
/**表单数据 */
form:{
/** 工单编号 */
pwoCode : null,
/** 批号 */
batchNo : null,
/** 物料编码 */
ptNoTar : null,
/** 物料名称 */
ptTitleTar : null,
/** 物料规格 */
specification1 : null
},
/** 校验规则 */
rules:{
pwoCode:{
rules:[
{
required : true,
},
]
},
batchNo:{
rules:[
{
required : true,
},
]
},
},
/** 提示信息 */
message:{
//类型 succes成功warn警告error失败inf消息
type:'error',
//提示信息
messageText:'没有符合条件的数据',
//显示时间
duration:1500
}
}
},
async mounted(){
//在页面挂载的时候获取部门数据
const data = await Promise.all([ listDepartment(), listWarehouse()])
this.$store.commit('updateDepartment',data[0].rows)
this.$store.commit('updateWarehouse',data[1].rows)
},
/**
* 计算属性
*/
computed:{
/**
* 判断form值是否符合要求
* 如果符合则可以点击按钮,没有不能点击
*/
formComputed(){
const {pwoCode,batchNo} = this.form
//判断工单编号和批号是否有值
//如果有值且长度大于5位则必填标志消失并且提交按钮可以点击
if((hasValue(pwoCode) && pwoCode.length >= 5) || (hasValue(batchNo) && batchNo.length >= 5)){
if(hasValue(pwoCode) && pwoCode.length >= 5) this.rules.batchNo.rules[0].required = false
if(hasValue(batchNo) && batchNo.length >= 5) this.rules.pwoCode.rules[0].required = false
return false
}
this.rules.batchNo.rules[0].required = this.rules.pwoCode.rules[0].required = true
return true
}
},
methods: {
/**
* 提交按钮点击事件
*/
async clickSubmit(){
const _self = this
try{
//打开蒙层
this.$refs.popup.open()
//查询接口
const res = await listPwoLike(this.form)
//关闭蒙层
//当没有查到数据给一个提示
if(res.total === 0 || res.rows.length === 0) {
this.$refs.message.open()
return
}
//通过vuex把获取到的数据保存下来 this.$store.state.pwo
this.$store.commit('updatData',res.rows)
uni.navigateTo({
url:'/pages/mes/jobCv/transfer/table'
})
}catch{
this.message.messageText="请求超时"
this.$refs.message.open()
}finally{
this.$refs.popup.close()
}
}
},
/**
* 页面卸载的时候清空数据
*/
onUnload(){
this.$store.commit('updateDepartment',[])
this.$store.commit('updateWarehouse',[])
}
}
</script>
<style scoped>
//设置页面背景颜色
page {
background-color: #ffffff;
padding-top: 1vw;
}
view {
width: 98%;
margin: 2% auto;
color: black;
}
</style>

View File

@@ -0,0 +1,108 @@
<template>
<view>
<div v-for="(item,index) in data" :key="index">
<div>
<table>
<tr>
<td>&emsp;&emsp;</td><td>{{item.pwoCode}}</td>
</tr>
<tr>
<td>物料编码</td><td>{{item.ptNoTar}}</td>
</tr>
<tr>
<td>物料名称</td><td>{{item.ptTitleTar}}</td>
</tr>
<tr>
<td>物料规格</td><td>{{item.specification1}}</td>
</tr>
<tr>
<td>物料图号</td><td></td>
</tr>
<tr>
<td>客户名称</td><td></td>
</tr>
<tr>
<td>是否冲孔</td><td></td>
</tr>
<tr>
<td>&thinsp;&thinsp;&nbsp;</td><td>{{item.num}}</td>
</tr>
</table>
</div>
<div>
<u-button class="uButton" @click="clickButton(item)">入库</u-button>
</div>
</div>
</view>
</template>
<script>
import {
getPwoByCode,
getDetailData
} from "@/api/mes/pwoIn.js";
export default {
data() {
return {
data:{}
}
},
beforeMount() {
//把查询页面查询到的数据放入进来
this.data =this.$store.state.pwo.data
//接收完后清空vuex里面的数据清空
this.$store.commit('updatData',{})
},
methods: {
/**
* 入库按钮点击事件
* @param {Object} item 当前点击按钮的数据
*/
async clickButton(item){
const {pwoCode,id} = item
const obj = {
delStatus : "0",
genRedraw : true,
pwoCode,
pwoI : id,
status : '0',
type : "3"
}
const res = await Promise.all([getPwoByCode(pwoCode),getDetailData(obj)])
this.$store.commit("updatData",{body:res[0].data,list:res[1].data})
uni.navigateTo({
url:"/pages/mes/jobCv/transfer/from"
})
}
}
}
</script>
<style lang="scss" scoped>
$fontSize : 14px ;
page {
background-color: #ffffff;
padding-top: 1vw;
view > div {
position: relative;
width: 95%;
border-width: 1px 2px;
border-style: solid;
border: 2px solid #e0fff9;
margin: 1px 2.5% 2px 2.5%;
display: flex;
div:first-child {
width: 85%;
margin-right:2%
};
div:last-child {
margin-right: auto;
width: 13%;
& > .uButton{
height: 1.65 * 8 * $fontSize;
}
}
}
}
</style>

View File

@@ -0,0 +1,239 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="作业编码" :labelWidth='90' name="code">
<utils-input prefixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.code" @input="handleInput"
type="text" :key="input.boolean" :focus='true' @focus="focus" @click="focus"></utils-input>
<!-- <uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.code" @input="handleInput"
type="text" :key="input.boolean"/> -->
</uni-forms-item>
<uni-forms-item label="质检结果" :labelWidth='90' name="qcFlag">
<u-radio-group v-model="formData.qcFlag" placement="row">
<u-radio v-for="(item, index) in qc_bill_result_Options" :key="index" :label="item.text"
:name="item.name"></u-radio>
</u-radio-group>
</uni-forms-item>
<uni-forms-item label="质检人" :labelWidth='90' name="qcBy">
<uni-easyinput v-model="formData.qcBy" type="text" suffixIcon="scan" @iconClick="scanBarqcBy" />
</uni-forms-item>
<uni-forms-item label="图片" :labelWidth='90' name="qcImg">
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10"></u-upload>
</uni-forms-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getPwoJob,
listPwoJob,
updatePwoJob,
} from "@/api/mes/jobReport.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
import {
uploadImage,
getStandardList,
addQualityHistoryList,
listQualityHistory,
updateQualityHistory
} from "@/api/qc/qc.js";
import utilsInput from "@/utils/uniapp/utilsInput.vue"
export default {
components:{
utilsInput
},
mounted() {
getDicts("qc_bill_result").then(res => {
this.qc_bill_result_Options = res.data.map(dict => {
return {
text: dict.dictLabel,
name: dict.dictValue,
diasble: false
}
});
})
},
data() {
return {
input:{
boolean: 0 ,
inputValue : '',
},
qc_bill_result_Options: [],
fileList1: [],
formData: {
code: null,
qcFlag: null,
qcBy: null,
qcImg: null
},
rules: {
code: {
rules: [{
required: true,
errorMessage: '请输入作业!'
}]
},
qcFlag: {
rules: [{
required: true,
errorMessage: '请输入质检结果!'
}]
},
qcBy: {
rules: [{
required: true,
errorMessage: '请输入质检人!'
}]
},
}
}
},
methods: {
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
try {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
} catch (e) {
this[`fileList${event.name}`].splice(fileListLen, 1);
}
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uploadImage({
filePath: url
}).then(response => {
uni.showToast({
title: "上传成功",
icon: 'success'
});
resolve(response.fileName)
}).catch(e => {
reject(e);
});
})
},
// selectQcFlag(e) {
// console.log(e, this.formData.qcFlag)
// },
scanBarCode(code) {
if (code) {
listPwoJob({
code: code
}).then(async res => {
if (res.rows != null && res.rows.length > 0) {
this.formData = res.rows[0]
} else {
this.$modal.msg("未查询到该作业!");
}
});
}
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.code = res.result;
_this.scanBarCode(_this.formData.code);
}
});
},
//质检人
scanBarqcBy() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.qcBy = res.result;
_this.scanBarCode(_this.formData.qcBy);
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检吗?',
success: function(res) {
if (res.confirm) {
if (_this.fileList1.length > 0) {
_this.formData.qcImg = _this.fileList1.map(obj => obj.url)
.join(', ');
}
_this.$modal.loading('提交中')
updatePwoJob(_this.formData).then(response => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("质检成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
} else if (res.cancel) {
}
}
});
});
},
/**
* 隐藏软键盘
*/
focus(){
uni.hideKeyboard()
},
/**
* 不让手动输入
* @param {Object} value
*/
handleInput(value) {
const {inputValue} = this.input
if(value.length - inputValue.length == 1 || inputValue.length - value.length == 1){
this.$modal.msg("请扫描")
this.formData.code = null
this.input.inputValue = value
this.input.boolean = this.input.boolean == 0 ? 10 :0
return
}
this.input.inputValue = value
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,343 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
<uni-easyinput disabled type="text" v-model="formData.type" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum" v-model="formData.reportNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良原因" :labelWidth='80' name="reason">
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="是否录入件号" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<view v-show="radio==1">
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text" v-model="formData.pieceNo" />
</uni-forms-item>
</view>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportEnterPiece
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.formData.type = '不良品';
if (option) {
this.formData = JSON.parse(decodeURIComponent(option.formData));
this.isPwoRoute = true;
}
getDicts("mes_job_report_defect").then(res => {
this.reasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
// this.formData.createByName = this.$store.state.user.name;
},
data() {
return {
isPwoRoute: false,
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
pieceNo: null,
startTime: null,
endTime: null,
},
reportableNum: 0,
radio: 0,
pieceIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
reportNumber: {
rules: [{
required: true,
errorMessage: '请输入报工数量!'
}]
},
reason: {
rules: [{
required: true,
errorMessage: '请输入不良原因!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
},
// machineId: {
// rules: [
// { required: true, errorMessage:'请输入设备编码!' }
// ]
// },
},
reasonOptions: [],
}
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
//判断是否选择录入件号
if (this.radio == 1) {
//判断是否输入件号
if (this.formData.pieceNo && this.formData.pieceNo != "") {
this.$modal.loading('提交中')
addReportEnterPiece(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入件号!");
}
} else {
this.$modal.loading('提交中')
addReport(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
})
},
scanBarCode() {
if (this.formData.pwoJobCode) {
listPwoJob({
code: this.formData.pwoJobCode
}).then(async res => {
let jobs = res.rows;
if (jobs.length == 0) {
this.$modal.msg("未检索到该作业编码相关的信息!");
} else {
let job = jobs[0];
this.formData.pwoCode = job.pwoCode;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.reportableNum = job.targetNum - job.finishQty;
if (job.eqpId) {
await getEquipment(job.eqpId).then(res => {
this.formData.machineId = res.data.equipmentCode;
})
//调取最后一条转入记录的操作人
let code = {
powJobCode: this.formData.pwoJobCode
}
listConversion(code).then(async res => {
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
this.formData.createByName = res.rows[0].operateBy;
let arry = {
name: this.formData.createByName
}
listEmployee(arry).then(async res => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
});
}
})
}
this.formData.batchNo = job.batchNo;
}
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,81 @@
<template>
<view class="uni-padding-wrap uni-common-mt" >
<view class="grid-body">
<uni-grid :column="3" :showBorder="false" @change="changeGrid1">
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-tongguo" size="30"></uni-icons>
<text class="text">合格品报工</text>
</view>
</uni-grid-item>
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-shenhebutongguo" size="30"></uni-icons>
<text class="text">不良品报工</text>
</view>
</uni-grid-item>
<uni-grid-item :index="3" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-tubiaozhizuomoban-134" size="30"></uni-icons>
<text class="text">报废品报工</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
<!-- <u-button type="primary" @click="$tab.navigateTo('/pages/mes/jobReport/pass')">合格品报工</u-button>
<u-button style="margin-top:100px; background-color:#ffff00;" @click="$tab.navigateTo('/pages/mes/jobReport/defect')">不良品报工</u-button>
<u-button style="margin-top:100px;;" type="warn" @click="$tab.navigateTo('/pages/mes/jobReport/scrap')">报废品报工</u-button>
</view> -->
<!-- </view> -->
</template>
<script>
export default {
onLoad: function() {
},
methods: {
changeGrid1(e) {
console.log(e.detail.index);
if (e.detail.index == 1) {
this.$tab.navigateTo('/pages/mes/jobReport/pass');
} else if (e.detail.index == 2) {
this.$tab.navigateTo('/pages/mes/jobReport/defect');
} else if (e.detail.index == 3) {
this.$tab.navigateTo('/pages/mes/jobReport/scrap');
}
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -0,0 +1,323 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
<uni-easyinput disabled disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
<uni-easyinput disabled disabled type="text" v-model="formData.type" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum" v-model="formData.reportNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗原因" :labelWidth='80' name="reason">
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportEnterPiece
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import { getDicts } from "@/api/system/dict/dictData.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.formData.type = '损耗';
if (option) {
this.formData = JSON.parse(decodeURIComponent(option.formData));
this.isPwoRoute = true;
}
getDicts("mes_job_report_loss").then(res => {
this.reasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
// this.formData.createByName = this.$store.state.user.name;
},
data() {
return {
isPwoRoute: false,
reasonOptions: [],
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
pieceNo: null,
},
radio: 0,
reportableNum: 0,
pieceIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
reportNumber: {
rules: [{
required: true,
errorMessage: '请输入报工数量!'
}]
},
reason: {
rules: [{
required: true,
errorMessage: '请输入不良原因!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
},
}
}
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
//判断是否选择录入件号
if (this.radio == 1) {
//判断是否输入件号
if (this.formData.pieceNo && this.formData.pieceNo != "") {
this.$modal.loading('提交中')
addReportEnterPiece(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入件号!");
}
} else {
this.$modal.loading('提交中')
addReport(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
})
},
scanBarCode() {
if (this.formData.pwoJobCode) {
let obj = {
code: this.formData.pwoJobCode
}
listPwoJob(obj).then(async res => {
let jobs = res.rows;
if (jobs.length == 0) {
this.$modal.msg("未检索到该作业编码相关的信息!");
} else {
let job = jobs[0];
this.formData.pwoCode = job.pwoCode;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.reportableNum = job.targetNum - job.finishQty;
if (job.eqpId) {
await getEquipment(job.eqpId).then(res => {
this.formData.machineId = res.data.equipmentCode;
})
//调取最后一条转入记录的操作人
let code = {
powJobCode: this.formData.pwoJobCode
}
listConversion(code).then(async res => {
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
this.formData.createByName = res.rows[0].operateBy;
let arry = {
name: this.formData.createByName
}
listEmployee(arry).then(async res => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
})
}
})
}
this.formData.batchNo = job.batchNo;
}
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,527 @@
<template>
<view style="background-color: #fff">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-align="right">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth="90" name="pwoJobCode" required>
<!-- <utils-input prefixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" @input="handleInput" :key="input.boolean" :focus='true'
@focus="focus" @click="focus" /> -->
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" @input="handleInput" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth="90" name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth="90" name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth="90" name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="18">
<uni-forms-item label="设备编号" :labelWidth="90" name="machineId">
<uni-easyinput type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="6">
<u-button style="height: 37px;" @click="handleBindEqp" text="绑定设备"
:disabled="!formData.pwoJobCode || !formData.machineId" />
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth="90" name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程编码" :labelWidth="90" name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程名称" :labelWidth="90" name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="用时(s)" :labelWidth="90" name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth="90" name="createByCode" required>
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth="90" name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
<u-divider :text="'可报工数量:' + reportableNum"></u-divider>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="合格数量" :labelWidth="90" name="pass">
<u-number-box button-size="36" inputWidth="auto"
v-model="formData.mesJobReportOnceRequestDTO.pass.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良数量" :labelWidth="90" name="defect">
<u-number-box button-size="36" inputWidth="auto"
v-model="formData.mesJobReportOnceRequestDTO.defect.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良原因" :labelWidth="90" name="defectReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['defect'].reason"
:localdata="defectReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废数量" :labelWidth="90" name="scrap">
<u-number-box button-size="36" inputWidth="auto"
v-model="formData.mesJobReportOnceRequestDTO.scrap.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废原因" :labelWidth="90" name="scrapReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['scrap'].reason"
:localdata="scrapReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗数量" :labelWidth="90" name="loss">
<u-number-box button-size="36" inputWidth="auto"
v-model="formData.mesJobReportOnceRequestDTO.loss.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗原因" :labelWidth="90" name="lossReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['loss'].reason"
:localdata="lossReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth="90">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth="90" name="endTime" required>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="备注" :labelWidth="90" name="remark" :required="requireRemark">
<uni-easyinput autoHeight type="textarea" v-model="formData.remark"></uni-easyinput>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
<!-- <u-button type="primary" @click="end">关闭</u-button> -->
</view>
</template>
<script>
import {
listPwoJob,
addReport,
updatePwoJob,
getEquipment,
addReportOnce,
listEquipment
} from '@/api/mes/jobReport.js';
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from '@/api/mes/jobIn.js';
import { getDicts } from '@/api/system/dict/dictData.js';
// const serialPort = uni.requireNativePlugin('Fvv-UniSerialPort')
import utilsInput from '@/utils/uniapp/utilsInput.vue';
import { getConfigKey } from '@/api/system/config.js';
import { listAllBadCauseByOpCode } from '@/api/basic/badCause';
export default {
components: {
utilsInput
},
onLoad: async function(option) {
if (option.code) {
this.isSearchRoute = true;
this.formData.pwoJobCode = option.code;
this.scanBarCode();
}
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ('0' + (currentDate.getMonth() + 1)).slice(-2);
var day = ('0' + currentDate.getDate()).slice(-2);
var hours = ('0' + currentDate.getHours()).slice(-2);
var minutes = ('0' + currentDate.getMinutes()).slice(-2);
var seconds = ('0' + currentDate.getSeconds()).slice(-2);
var formattedDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
// this.formData.type = '报废品';
// this.formData.createByName = this.$store.state.user.name;
await getConfigKey('basic:operation:badCause').then((res) => {
if (!res.msg) return;
this.reasonFrom = +res.msg;
this.formData.reasonFrom = +res.msg || 0;
});
await getConfigKey('mes.job.report.requireRemark').then(res => {
if (res.msg == null) return;
this.requireRemark = Boolean(+res.msg);
});
this.getOptions();
},
data() {
return {
input: {
boolean: 0,
inputValue: ''
},
//判断是否从工单状态页面查询过来
isSearchRoute: false,
lossReasonOptions: [],
scrapReasonOptions: [],
defectReasonOptions: [],
formData: {
pwoJobCode: null,
pwoJobId: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
remark: null,
mesJobReportOnceRequestDTO: {
pass: {
reportNumber: 0,
reason: null
},
defect: {
reportNumber: 0,
reason: null
},
scrap: {
reportNumber: 0,
reason: null
},
loss: {
reportNumber: 0,
reason: null
}
},
startTime: null,
endTime: null
},
reasonFrom: null,
reportableNum: 0,
requireRemark: false,
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
}
}
};
},
created: function(option) {
// const self = this
// serialPort.getAllDeviceList(res => {
// console.log('//设备列表', res)
// })
// serialPort.getAllDevicePath(res => {
// console.log('//路径列表', res)
// }),
// setTimeout(() => {
// serialPort.setPath('/dev/ttyUSB0')
// serialPort.setBaudRate(9600)
// serialPort.open(res => {
// if (!res.status) {
// uni.showToast({
// title: res.msg,
// duration: 2000,
// icon: "none"
// });
// return
// }
// serialPort.onMessage(rec => {
// this.onMessage(rec);
// }, send => {
// console.log(send)
// })
// })
// }, 10000)
},
methods: {
test() {
serialPort.sendHex('A00102A3');
},
end() {
serialPort.sendHex('A00100A1');
},
getOptions() {
this.defectReasonOptions = [];
this.scrapReasonOptions = [];
this.lossReasonOptions = [];
if (this.formData.opCode && this.reasonFrom === 1) {
listAllBadCauseByOpCode(this.formData.opCode).then((res) => {
res.rows.forEach((item) => {
switch (item.causeType) {
case '0':
this.defectReasonOptions.push({
text: item.name,
value: item.id,
disable: false
});
break;
case '1':
this.scrapReasonOptions.push({
text: item.name,
value: item.id,
disable: false
});
break;
case '2':
this.lossReasonOptions.push({
text: item.name,
value: item.id,
disable: false
});
break;
}
});
});
} else {
getDicts('mes_job_report_defect').then((res) => {
this.defectReasonOptions = res.data.map((dict) => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
};
});
});
getDicts('mes_job_report_scrap').then((res) => {
this.scrapReasonOptions = res.data.map((dict) => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
};
});
});
getDicts('mes_job_report_loss').then((res) => {
this.lossReasonOptions = res.data.map((dict) => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
};
});
});
}
},
async handleRenderEmp() {
if(!this.formData.machineId) return;
const { rows, total } = await listEmpEqpHistory({ equipmentCode: this.formData.machineId });
const emp = rows.filter(item => !item.endTime)?.[0];
if(!emp || !total > 0) return this.$modal.msg('该设备下没有绑定人员');
this.formData.createByCode = rows[0].empCode || '';
this.formData.createByName = rows[0].empName || '';
this.formData.createById = rows[0].empId || '';
},
// 绑定设备
async handleBindEqp() {
let eqpId = '';
this.$modal.loading('绑定中');
try {
const { rows, total } = await listEquipment({ equipmentCode: this.formData.machineId });
if(total == 1) {
eqpId = rows[0].id;
} else {
this.$modal.msg('未检索到该设备编码相关的信息!');
return;
}
await updatePwoJob({
id: this.formData.pwoJobId,
eqpId
});
this.$modal.msgSuccess("绑定成功!");
this.handleRenderEmp();
} catch (err) {
console.log(err);
this.$modal.msgError('绑定失败!');
} finally {
this.$modal.closeLoading();
}
},
submit() {
this.$refs.form.validate().then((res) => {
if(this.requireRemark && !this.formData.remark) {
this.$modal.msg('请输入备注!');
return;
}
this.formData.mesJobReportOnceRequestDTO.pass.reportNumber = Number(this.formData.mesJobReportOnceRequestDTO
.pass.reportNumber);
this.formData.mesJobReportOnceRequestDTO.defect.reportNumber = Number(this.formData
.mesJobReportOnceRequestDTO.defect.reportNumber);
this.formData.mesJobReportOnceRequestDTO.scrap.reportNumber = Number(this.formData
.mesJobReportOnceRequestDTO.scrap.reportNumber);
this.$modal.loading('提交中');
addReportOnce(this.formData).then((res) => {
this.$modal.closeLoading();
this.$modal.msgSuccess('报工成功!');
if ((this.isSearchRoute = true)) {
setTimeout(() => {
this.$tab.navigateBack();
}, 500);
} else {
setTimeout(() => {
this.$tab.switchTab('/pages/work/index');
}, 500);
}
});
});
},
scanBarCode() {
if (!this.formData.pwoJobCode) return;
listPwoJob({
code: this.formData.pwoJobCode
}).then(async (res) => {
if (!res.total > 0) return this.$modal.msg('未检索到该作业编码相关的信息!');
const job = res.rows[0];
this.formData.pwoCode = job.pwoCode;
this.formData.pwoJobId = job.id;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.formData.batchNo = job.batchNo;
this.reportableNum = job.targetNum - job.finishQty;
this.getOptions();
if (job.eqpId) {
await getEquipment(job.eqpId).then((res) => {
this.formData.machineId = res.data.equipmentCode;
});
// 查找该设备下上机人员
await this.handleRenderEmp();
}
if(this.formData.createById) return;
// 若没有人员,则调取最后一条转入记录的操作人
listConversion({
powJobCode: this.formData.pwoJobCode
}).then(async (res) => {
if(!res.total > 0) return;
this.formData.createByName = res.rows[0].operateBy;
if(!this.formData.createByName) return;
listEmployee({
name: this.formData.createByName
}).then(async (res) => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
});
});
});
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
};
listEmployee(obj).then(async (res) => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg('未查询到该人员信息!');
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
/**
* 隐藏软键盘
*/
focus() {
uni.hideKeyboard();
},
/**
* 不让手动输入
* @param {Object} value
*/
handleInput(value) {
const { inputValue } = this.input;
if (value.length - inputValue.length == 1 || inputValue.length - value.length == 1) {
this.$modal.msg('请扫描');
this.formData.pwoJobCode = null;
this.input.inputValue = value;
this.input.boolean = this.input.boolean == 0 ? 10 : 0;
return;
}
this.input.inputValue = value;
}
}
};
</script>

View File

@@ -0,0 +1,315 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
<uni-easyinput disabled type="text" v-model="formData.type" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum" v-model="formData.reportNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="是否录入件号" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<view v-show="radio==1">
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text" v-model="formData.pieceNo" />
</uni-forms-item>
</view>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportEnterPiece
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.formData.type = '合格品';
if (option) {
this.formData = JSON.parse(decodeURIComponent(option.formData));
this.isPwoRoute = true;
}
},
data() {
return {
isPwoRoute: false,
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
pieceNo: null,
startTime: null,
endTime: null,
},
reportableNum: 0,
radio: 0,
pieceIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
reportNumber: {
rules: [{
required: true,
errorMessage: '请输入报工数量!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
},
}
}
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
//判断是否选择录入件号
if (this.radio == 1) {
//判断是否输入件号
if (this.formData.pieceNo && this.formData.pieceNo != "") {
this.$modal.loading('提交中')
addReportEnterPiece(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入件号!");
}
} else {
this.$modal.loading('提交中')
addReport(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
});
},
scanBarCode() {
if (this.formData.pwoJobCode) {
let obj = {
code: this.formData.pwoJobCode
}
listPwoJob(obj).then(async res => {
let jobs = res.rows;
if (jobs.length == 0) {
this.$modal.msg("未检索到该作业编码相关的信息!");
} else {
let job = jobs[0];
this.formData.pwoCode = job.pwoCode;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.reportableNum = job.targetNum - job.finishQty;
if (job.eqpId) {
await getEquipment(job.eqpId).then(res => {
console.log(res);
this.formData.machineId = res.data.equipmentCode;
})
//调取最后一条转入记录的操作人
let code = {
powJobCode: this.formData.pwoJobCode
}
listConversion(code).then(async res => {
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
this.formData.createByName = res.rows[0].operateBy;
let arry = {
name: this.formData.createByName
}
listEmployee(arry).then(async res => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
})
}
})
}
this.formData.batchNo = job.batchNo;
}
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,710 @@
<template>
<view class="container">
<uni-segmented-control :current="current" :values="items" active-color="#2979FF" @clickItem="current = (current + 1) % 2" />
<t-gap />
<view v-if="current === 0" class="segmented-wrapper">
<uni-forms label-position="left" :label-width="75" label-align="right">
<uni-forms-item label="生产工单" name="pwoCode">
<uni-easyinput v-model="pwoCode" suffixIcon="scan" @iconClick="handleScanPwoCode" @confirm="fetchPwoJobList"
placeholder="请输入工单编码" />
</uni-forms-item>
<uni-forms-item label="产线" name="proLineId">
<uni-data-select v-model="proLineId" :localdata="proLineOptions" :disabled="!pwoCode"
@change="handleSelectProLine" :clear="false" placeholder="请选择产线" />
</uni-forms-item>
<uni-forms-item label="开始作业" name="startJobCode">
<uni-data-select v-model="startJobCode" :localdata="startJobOptions" :disabled="!pwoCode"
@change="handleJobChange($event, 'start')" :clear="false" placeholder="请选择开始作业" />
</uni-forms-item>
<uni-forms-item label="结束作业" name="endJobCode">
<uni-data-select v-model="endJobCode" :localdata="endJobOptions" :disabled="!pwoCode"
@change="handleJobChange($event, 'end')" :clear="false" placeholder="请选择结束作业" />
</uni-forms-item>
<uni-forms-item label="合格数量">
<uni-number-box v-model="mesJobReportOnceRequestDTO.pass.reportNumber" />
</uni-forms-item>
<uni-forms-item label="不良数量">
<uni-number-box v-model="mesJobReportOnceRequestDTO.defect.reportNumber" />
</uni-forms-item>
<uni-forms-item label="不良原因" v-if="mesJobReportOnceRequestDTO.defect.reportNumber">
<uni-data-checkbox v-model="mesJobReportOnceRequestDTO.defect.reason" :localdata="defectOptions"
placeholder="请选择不良原因" />
</uni-forms-item>
<uni-forms-item label="报废数量">
<uni-number-box v-model="mesJobReportOnceRequestDTO.scrap.reportNumber" />
</uni-forms-item>
<uni-forms-item label="报废原因" v-if="mesJobReportOnceRequestDTO.scrap.reportNumber">
<uni-data-checkbox v-model="mesJobReportOnceRequestDTO.scrap.reason" :localdata="scrapOptions"
placeholder="请选择报废原因" />
</uni-forms-item>
</uni-forms>
</view>
<view v-if="current === 1" class="segmented-wrapper">
<uni-card v-for="(item, index) in selectedJobs" :key="index">
<template #title>
<view class="header">
<view class="jobInfo">
<uni-tag :text="String(index + 1)" />
<text class="jobCode">
{{ item.pwoJobCode }}
</text>
<uni-tag :text="item.status" :type="item.labelStyle" />
</view>
</view>
</template>
<view class="card-list">
<view class="card-item">
<span class="card-item__label">目标产品编码</span>
<span class="card-item__value">{{ item.ptNoTar || '/' }}</span>
</view>
<view class="card-item">
<span class="card-item__label">目标产品名称</span>
<span class="card-item__value">{{ item.ptTitleTar || '/' }}</span>
</view>
<view class="card-item">
<span class="card-item__label">制程名称</span>
<span class="card-item__value">{{ item.opTitle || '/' }}</span>
</view>
</view>
<view class="card-data">
<view class="card-data-item">
<span class="card-data-item__label">完成数量</span>
<span class="card-data-item__value finish">
{{ typeof item.finishQty === 'number' ? item.finishQty : '/' }}
</span>
</view>
<view class="card-data-item">
<span class="card-data-item__label">目标数量</span>
<span class="card-data-item__value">
{{ typeof item.targetNum === 'number' ? item.targetNum : '/' }}
</span>
</view>
</view>
<template #actions>
<view class="actions">
<uni-forms-item label="加工人员" :labelWidth="80">
<uni-easyinput @change="validateEmpCode(index)"
v-model="item.createByCode">
<template #right>
<uni-tag :text="item.createByName" />
<uni-icons type="scan" size="30" @click="handleScanEmpCode(index)" />
</template>
</uni-easyinput>
</uni-forms-item>
</view>
</template>
</uni-card>
<u-empty v-if="selectedJobs.length == 0" mode="list" />
<view class="btns">
<u-button v-if="startJobCode && endJobCode" type="primary" @click="submit" class="pri-btn">提交</u-button>
</view>
</view>
</view>
</template>
<script>
import { getConfigKey } from '@/api/system/config';
import { listPwo } from '@/api/mes/pwo';
import {
listPwoJob,
addReport,
getEquipment,
addPipelineReport
} from "@/api/mes/jobReport";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn";
import { getDicts } from "@/api/system/dict/dictData";
import { listProLine } from "@/api/basic/proLine";
import { listEmployeeInProLines } from "@/api/basic/employee";
import { setProductionLine } from '@/api/mes/pwo';
export default {
data() {
return {
proLineEmployeeDataSet: 1,
empSelectOptions: [],
proLineMap: {},
items: ['报工信息', '作业列表'],
current: 0,
dataSet: null,
isCollapse: false,
pwoCode: null,
pwoId: null,
proLineId: null,
startJobCode: null,
endJobCode: null,
mesJobReportOnceRequestDTO: {
defect: { reportNumber: 0, reason: null },
loss: { reportNumber: 0, reason: null },
pass: { reportNumber: 0, reason: null },
scrap: { reportNumber: 0, reason: null }
},
rawList: [],
pwoJobList: [],
startJobOptions: [],
endJobOptions: [],
proLineOptions: [],
defectOptions: [],
scrapOptions: [],
statusMap: {},
selectedJobs: [],
startIndex: null,
endIndex: null,
}
},
async mounted() {
// 获取产线人员对应列表数据源
await getConfigKey('mes.proline-employee-dataset').then(res => {
this.proLineEmployeeDataSet = +res.msg;
});
// 获取产线列表
this.fetchProLineOptions();
// 获取作业状态列表
this.fetchJobStatusList();
// 获取不良原因列表
this.fetchDefectOptions();
// 获取产线人员对应列表
this.getEmpOptions();
console.log('PWO100022136');
},
methods: {
// 获取产线列表
fetchProLineOptions() {
this.$modal.loading('加载产线列表...');
listProLine().then(res => {
this.$modal.closeLoading();
res.rows
.filter(item => !item.delStatus)
.forEach(item => {
this.proLineOptions.push({
text: item.productLineTitle,
value: item.id,
proLineCode: item.productLineCode
})
})
}).catch(err => {
this.$modal.closeLoading();
this.$modal.alert('加载产线列表失败', err.msg || err);
})
},
// 获取作业状态列表
fetchJobStatusList() {
// this.$modal.loading('加载作业类型...');
getDicts('mes_job_status').then(res => {
// this.$modal.closeLoading();
res.data.forEach(item => {
this.statusMap[item.dictValue] = [item.dictLabel, item.listClass];
})
}).catch(err => {
// this.$modal.closeLoading();
this.$modal.alert('加载作业列表失败', err.msg || err);
})
},
// 获取不良原因列表
async fetchDefectOptions() {
try {
await getDicts("mes_job_report_defect").then(res => {
this.defectOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
await getDicts("mes_job_report_scrap").then(res => {
this.scrapOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
} catch (err) {
this.$modal.msgError('加载不良原因列表失败');
console.error(`加载不良原因列表失败:\n${err}`);
}
},
// 获取作业列表
async fetchPwoJobList() {
if (!this.pwoCode) return;
this.resetForm();
this.$modal.loading('获取工单信息...');
await listPwo({ pwoCode: this.pwoCode }).then(res => {
this.$modal.closeLoading();
if (res.total === 1) {
this.proLineId = res.rows[0].proLineId;
}
}).catch(err => {
this.$modal.closeLoading();
this.$modal.msgError('获取工单信息失败');
console.error(`获取工单信息失败:\n${err}`);
return;
})
this.$modal.loading('获取作业列表...');
await listPwoJob({
pwoCode: this.pwoCode
}).then(res => {
this.$modal.closeLoading();
this.rawList = res.rows;
this.pwoId = res.rows[0].pwoId;
res.rows.forEach((item, index) => {
this.isCollapse = true;
this.pwoJobList.push({
pwoJobCode: item.code,
status: this.statusMap[item.status][0],
labelStyle: this.statusMap[item.status][1] || 'default',
ptTitleTar: item.ptTitleTar,
ptNoTar: item.ptNoTar,
opTitle: item.opTitle,
targetNum: item.targetNum,
finishQty: item.finishQty,
createByCode: null
})
this.startJobOptions.push({
text: `${item.code}(${item.opTitle})`,
value: item.code,
disable: index === res.rows.length - 1
})
this.endJobOptions.push({
text: `${item.code}(${item.opTitle})`,
value: item.code,
disable: index === 0
})
})
}).catch(err => {
this.$modal.closeLoading();
console.log(err)
this.$modal.alert('获取作业列表失败', err.msg || err);
})
},
// 扫描工单编码
handleScanPwoCode() {
const _this = this;
this.$modal.scanCode((res) => {
if (!res.result) {
_this.$modal.msg('未扫描到有效值,请重试');
return;
}
_this.pwoCode = res.result;
_this.fetchPwoJobList();
});
},
// 扫描员工编码
handleScanEmpCode(index) {
const _this = this;
this.$modal.scanCode((res) => {
if (!res.result) {
_this.$modal.msg('未扫描到有效值,请重试');
return;
}
_this.selectedJobs[index].createByCode = res.result;
_this.validateEmpCode(index);
});
},
// 绑定产线
async handleSelectProLine(e) {
if (!e) return;
await setProductionLine({
pwoId: [this.pwoId],
productionLineId: this.proLineId
}).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess("绑定成功");
}
}).catch(err => {
console.error(`绑定失败:${err.msg}`);
this.proLineId = null;
});
this.renderEmpInProLine();
},
// 根据产线人员对应关系填写人员编码
async renderEmpInProLine() {
let proLineChildren = this.proLineMap[this.proLineId];
proLineChildren = [];
if (this.proLineEmployeeDataSet === 0) {
console.log(this.empSelectOptions)
this.empSelectOptions
.find(item => item.proLineId == this.proLineId)?.children
.forEach(item => {
proLineChildren.push({
name: item.empName,
empId: item.value,
empCode: item.empCode,
lineNum: item.serialNum,
});
})
} else {
await listProductLineEmployee(this.proLineId).then((res) => {
res.rows.forEach(item => {
proLineChildren.push({
name: item.employeeName,
empId: item.employeeId,
empCode: item.employeeCode,
lineNum: item.serialNum,
});
});
})
}
console.log(proLineChildren);
this.selectedJobs.forEach((job, index) => {
const emp = proLineChildren.find(item => item.lineNum == index + 1);
const empName = emp?.name;
const empCode = emp?.empCode;
const empId = emp?.empId;
this.$set(job, 'createByCode', empCode || null);
this.$set(job, 'createByName', empName || null);
this.$set(job, 'createById', empId || null);
console.log(`${index + 1}个作业的员工名称为${empName}id为${empId}`);
})
},
// 获取产线人员对应关系
async getEmpOptions() {
// 一人员一产线
if (this.proLineEmployeeDataSet === 1) {
const proLineMap = new Map(); // 用于存储产线信息
await listProLine().then((res) => {
res.rows.forEach(item => {
const { id, productLineTitle } = item;
// 如果产线不存在,初始化产线
proLineMap.set(id, {
proLineId: id,
label: productLineTitle,
children: []
});
})
})
await listEmployee().then((res) => {
res.rows.forEach(item => {
const { empCode, name, proLineId,id } = item;
// 添加员工到对应产线
if (proLineId) {
proLineMap.get(proLineId).children.push({
value: id,
label: empCode + ': ' + name,
empId: id,
empName: name,
empCode: empCode
});
}
});
});
// 将Map转换为数组
this.empSelectOptions = Array.from(proLineMap.values());
} else {
// 一人员多产线
listEmployeeInProLines().then(res => {
if (!res.data) return;
res.data.forEach(proLine => {
const children = proLine.employees.map(emp => {
return {
value: emp.id,
label: emp.employeeCode + ': ' + emp.employeeName,
empId: emp.id,
empName: emp.employeeName,
empCode: emp.employeeCode,
serialNum: emp.serialNum
}
})
this.empSelectOptions.push({
proLineId: proLine.id,
label: proLine.productLineTitle,
children
})
})
})
}
},
// 校验员工编码
validateEmpCode(index) {
if (!this.selectedJobs[index].createByCode) return;
listEmployee({
empCode: this.selectedJobs[index].createByCode
}).then(res => {
if (res.total === 0) {
this.$modal.msgError(`员工不存在,请重新输入!`);
this.selectedJobs[index].createByCode = null;
} else if (res.total > 1) {
this.$modal.msgError(`员工编码异常,请联系管理员!`);
this.selectedJobs[index].createByCode = null;
} else {
this.selectedJobs[index].createByName = res.rows[0].name;
this.selectedJobs[index].createById = res.rows[0].id;
}
}).catch(err => {
this.$modal.msgError(`校验失败,请重试!\n${err}`);
this.selectedJobs[index].createByCode = null;
})
},
// 重置表单
resetForm() {
this.isCollapse = false;
this.proLineId = null;
this.startJobCode = null;
this.endJobCode = null;
this.mesJobReportOnceRequestDTO = {
defect: { reportNumber: 0, reason: null },
loss: { reportNumber: 0, reason: null },
pass: { reportNumber: 0, reason: null },
scrap: { reportNumber: 0, reason: null }
};
this.pwoJobList = [];
this.startJobOptions = [];
this.endJobOptions = [];
this.selectedJobs = [];
this.startIndex = null;
this.endIndex = null;
},
// 校验表单
async validateForm() {
try {
if (!this.pwoCode) throw new Error("请填写工单编码");
if (!this.startJobCode) throw new Error("请选择起始作业");
if (!this.endJobCode) throw new Error("请选择结束作业");
if (!this.proLineId) {
await this.$modal.confirm('未选择产线,是否继续提交').then(res => {
if (res.cancel) {
throw new Error("取消提交");
}
})
}
// 校验报工数量
let hasReport = false;
for (const key in this.mesJobReportOnceRequestDTO) {
const item = this.mesJobReportOnceRequestDTO[key];
const { reportNumber, reason } = item;
if (reportNumber !== 0) {
hasReport = true;
}
// 除了 pass数量不为0 且 原因为空时抛错
if (key !== "pass" && reportNumber !== 0 && (reason == null || reason === "")) {
throw new Error("请选择不良原因");
}
}
if (!hasReport) {
throw new Error("请填写报工数量");
}
this.selectedJobs.forEach((item, index) => {
if (!item.createByCode) {
throw new Error(`请填写第 ${index + 1} 条作业的加工人员`);
}
})
return true;
} catch (err) {
this.$modal.msg(String(err).replace('Error: ', ''));
console.error(`表单校验失败:\n${err}`);
return false;
}
},
// 切换作业
handleJobChange(e, type) {
if (!e) return;
switch (type) {
case 'start':
this.startIndex = this.pwoJobList.findIndex(item => item.pwoJobCode === e);
this.endJobOptions.forEach((job, i) => {
job.disable = i <= this.startIndex;
})
break;
case 'end':
this.endIndex = this.pwoJobList.findIndex(item => item.pwoJobCode === e);
this.startJobOptions.forEach((job, i) => {
job.disable = i >= this.endIndex;
})
break;
}
this.selectedJobs = [];
if (typeof this.startIndex === 'number' && typeof this.endIndex === 'number') {
this.selectedJobs = this.pwoJobList.slice(this.startIndex, this.endIndex + 1);
}
this.renderEmpInProLine();
},
// 提交
async submit() {
const res = await this.validateForm();
if (!res) return;
const submitList = this.rawList.slice(this.startIndex, this.endIndex + 1)
this.selectedJobs.forEach((item, index) => {
submitList[this.startIndex + index] = Object.assign({}, submitList[this.startIndex + index], item);
})
const data = {
reasonFrom: "0",
endTime: this.$time.getTime(),
endPwoJobId: this.rawList[this.endIndex].id,
startPwoJobId: this.rawList[this.startIndex].id,
productLineId: this.proLineId,
mesJobReportList: submitList,
mesJobReportOnceRequestDTO: this.mesJobReportOnceRequestDTO
}
addPipelineReport(data).then(() => {
this.$modal.msgSuccess('提交成功');
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 1000);
}).catch(err => {
this.$modal.alert('提交失败', err.msg);
console.error(`提交失败:\n${err}`);
})
}
}
}
</script>
<style scoped lang="scss">
.container {
/* #ifdef H5 */
height: calc(100vh - 44px);
/* #endif */
/* #ifndef H5 */
height: 100vh;
/* #endif */
padding: 10px;
display: flex;
flex-direction: column;
.card-list__title {
background: transparent;
border-top: 1px solid #d9d9d9;
margin-top: 5px;
}
.segmented-wrapper {
flex: 1;
overflow: scroll;
.u-empty {
height: 100%;
}
}
.uni-card {
margin: 0 0 10px !important;
padding: 0 !important;
box-shadow: none !important;
border-radius: 11px;
.header {
display: flex;
align-items: center;
padding: 8px;
border-bottom: 1px solid #d9d9d9;
.jobInfo {
display: flex;
align-items: center;
flex: 1;
.jobCode {
font-size: 16px;
font-weight: bold;
flex: 1;
}
.uni-tag {
box-sizing: border-box;
height: 100%;
text-align: center;
margin-right: 8px;
}
}
}
.card-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 4px;
.card-item {
display: flex;
flex-direction: column;
align-items: flex-start;
.card-item__label {
font-size: 13px;
}
.card-item__value {
font-weight: bold;
font-size: 15px;
color: #333;
}
}
}
.card-data {
display: flex;
margin-top: 10px;
background-color: #f1f1f1;
border-radius: 4px;
padding: 6px 0;
.card-data-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.card-data-item__label {
font-size: 13px;
}
.card-data-item__value {
font-weight: bold;
font-size: 15px;
color: #333;
&.finish {
color: #059669;
}
}
}
}
.actions {
padding: 0 10px;
}
}
.btns {
padding-top: 5px;
}
}
::v-deep .uni-numbox__value {
flex: 1;
height: 36px;
}
::v-deep .uni-forms-item.is-direction-left {
align-items: baseline;
}
</style>

View File

@@ -0,0 +1,445 @@
<template>
<view style="background-color: #fff;">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="工单编码" :labelWidth='100' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoCode"
@blur="scanBarCode" :key="input.boolean" :focus='true' />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='100' name="pwoJobCode">
<uni-data-select :localdata="formData.pwoJobs" v-model="formData.pwoJobCode"
@change="getJobInfo"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='100' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='100' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='100' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='100' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程编码" :labelWidth='100' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程名称" :labelWidth='100' name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="用时(h)" :labelWidth='100' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='100' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @blur="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='100' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
<u-divider :text="'可报工数量:'+reportableNum"></u-divider>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="合格数量" :labelWidth='100' name="pass">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.pass.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良数量" :labelWidth='100' name="defect">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.defect.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良原因" :labelWidth='100' name="defectReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['defect'].reason"
:localdata="defectReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废数量" :labelWidth='100' name="scrap">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.scrap.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废原因" :labelWidth='100' name="scrapReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['scrap'].reason"
:localdata="scrapReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗数量" :labelWidth='100' name="loss">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.loss.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗原因" :labelWidth='100' name="lossReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['loss'].reason"
:localdata="lossReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='100'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='100' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="备注" :labelWidth='100' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="formData.remark"></uni-easyinput>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
<!-- <u-button type="primary" @click="end">关闭</u-button> -->
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportOnce
} from "@/api/mes/jobReport.js";
import { listPwoJobLike } from "@/api/mes/pwoIn.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import { getDicts } from "@/api/system/dict/dictData.js";
import { login } from "../../../api/login";
// const serialPort = uni.requireNativePlugin('Fvv-UniSerialPort')
export default {
data() {
return {
input: {
boolean: 0,
inputValue: '',
},
//判断是否从工单状态页面查询过来
isSearchRoute: false,
lossReasonOptions: [],
scrapReasonOptions: [],
defectReasonOptions: [],
formData: {
pwoJobCode: null,
pwoJobs: [],
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
opTitle: null,
opCode: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
remark: null,
mesJobReportOnceRequestDTO: {
pass: {
reportNumber: 0,
reason: null
},
defect: {
reportNumber: 0,
reason: null
},
scrap: {
reportNumber: 0,
reason: null
},
loss: {
reportNumber: 0,
reason: null
}
},
startTime: null,
endTime: null,
},
reportableNum: 0,
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入工单编码!'
}]
},
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请选择作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
}
}
}
},
methods: {
test() {
serialPort.sendHex("A00102A3")
},
end() {
serialPort.sendHex("A00100A1")
},
getOptions() {
getDicts("mes_job_report_defect").then(res => {
this.defectReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("mes_job_report_scrap").then(res => {
this.scrapReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("mes_job_report_loss").then(res => {
this.lossReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
},
submit() {
if (this.sumReportNum() <= 0 || this.sumReportNum() > this.reportableNum) {
this.$modal.showToast("请重新检查报工数量")
return
}
this.$refs.form.validate().then(res => {
this.$modal.loading('提交中')
addReportOnce(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
if (this.isSearchRoute = true) {
setTimeout(() => {
this.$tab.navigateBack();
}, 500);
} else {
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
}
})
})
},
sumReportNum() {
const sum = ['pass', 'defect', 'scrap', 'loss'].reduce((total, key) => {
const value = Number(this.formData.mesJobReportOnceRequestDTO[key].reportNumber)
this.formData.mesJobReportOnceRequestDTO[key].reportNumber = value
return total + value
}, 0)
return sum
},
scanBarCode() {
if (this.formData.pwoCode) {
this.formData.pwoJobs = []
this.formData.pwoJobCode = null
this.clearJobInfo()
listPwoJob({
pwoCode: this.formData.pwoCode
}).then((res) => {
if (res.rows.length > 0) {
this.$set(this.formData, "pwoJobs", res.rows.map(item => ({
text: item.code + ":" + item.opTitle,
value: item.code,
disabled: false
})))
console.log(this.formData.pwoJobs)
} else {
this.$modal.showToast("未查询到该工单编码")
}
})
}
},
clearJobInfo() {
this.reportableNum = 0
const resetFields = [
"ptNoTar", "ptTitleTar", "batchNo",
"createByName", "createByCode", "createById", "remark", "startTime",
"machineId", "opCode", "opTitle"
]
// 重置表单信息
resetFields.forEach(field => {
this.$set(this.formData, field, null)
})
// 重置报工数量
Object.keys(this.formData.mesJobReportOnceRequestDTO).forEach(key => {
const item = this.formData.mesJobReportOnceRequestDTO[key];
this.$set(item, 'reportNumber', 0);
this.$set(item, 'reason', null);
});
},
async getJobInfo(e) {
this.formData.pwoJobCode = e
if (this.formData.pwoJobCode) {
this.clearJobInfo()
await listPwoJob({
code: this.formData.pwoJobCode
}).then(async res => {
this.formData.ptNoTar = res.rows[0].ptNoTar
this.formData.ptTitleTar = res.rows[0].ptTitleTar
this.formData.opCode = res.rows[0].opCode
this.formData.opTitle = res.rows[0].opTitle
this.formData.batchNo = res.rows[0].batchNo
this.reportableNum = res.rows[0].targetNum - res.rows[0].finishQty
await listPwoJobLike({
code: this.formData.pwoJobCode
}).then(res => {
this.formData.eqpId = res.rows[0].eqpId
})
if (this.formData.eqpId) {
getEquipment(this.formData.eqpId).then(res => {
this.formData.machineId = res.data.equipmentCode
}).catch(() => {
this.$modal.showToast("获取设备编号失败")
})
}
}).catch(() => {
this.$modal.showToast("获取作业信息失败!")
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
/**
* 隐藏软键盘
*/
focus() {
uni.hideKeyboard()
},
/**
* 不让手动输入
* @param {Object} value
handleInput(value) {
const {
inputValue
} = this.input
if (value.length - inputValue.length == 1 || inputValue.length - value.length == 1) {
this.$modal.msg("请扫描")
this.formData.pwoJobCode = null
this.input.inputValue = value
this.input.boolean = this.input.boolean == 0 ? 10 : 0
return
}
this.input.inputValue = value
}*/
},
onLoad: function(option) {
if (option.pwoCode) {
this.isSearchRoute = true;
this.formData.pwoCode = option.pwoCode;
this.scanBarCode();
}
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.getOptions();
}
}
</script>

View File

@@ -0,0 +1,345 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
<uni-easyinput disabled disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
<uni-easyinput disabled disabled type="text" v-model="formData.type" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum" v-model="formData.reportNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废原因" :labelWidth='80' name="reason">
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="是否录入件号" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<view v-show="radio==1">
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text" v-model="formData.pieceNo" />
</uni-forms-item>
</view>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportEnterPiece
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import { getDicts } from "@/api/system/dict/dictData.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.formData.type = '报废品';
if (option) {
this.formData = JSON.parse(decodeURIComponent(option.formData));
this.isPwoRoute = true;
}
getDicts("mes_job_report_scrap").then(res => {
this.reasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
// this.formData.createByName = this.$store.state.user.name;
},
data() {
return {
isPwoRoute: false,
reasonOptions: [],
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
pieceNo: null,
startTime: null,
endTime: null,
},
reportableNum: 0,
radio: 0,
pieceIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
reportNumber: {
rules: [{
required: true,
errorMessage: '请输入报工数量!'
}]
},
reason: {
rules: [{
required: true,
errorMessage: '请输入不良原因!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
},
// machineId: {
// rules: [
// { required: true, errorMessage:'请输入设备编码!' }
// ]
// },
}
}
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
//判断是否选择录入件号
if (this.radio == 1) {
//判断是否输入件号
if (this.formData.pieceNo && this.formData.pieceNo != "") {
this.$modal.loading('提交中')
addReportEnterPiece(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入件号!");
}
} else {
this.$modal.loading('提交中')
addReport(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
})
},
scanBarCode() {
if (this.formData.pwoJobCode) {
let obj = {
code: this.formData.pwoJobCode
}
listPwoJob(obj).then(async res => {
let jobs = res.rows;
if (jobs.length == 0) {
this.$modal.msg("未检索到该作业编码相关的信息!");
} else {
let job = jobs[0];
console.log(job);
this.formData.pwoCode = job.pwoCode;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.reportableNum = job.targetNum - job.finishQty;
if (job.eqpId) {
await getEquipment(job.eqpId).then(res => {
console.log(res);
this.formData.machineId = res.data.equipmentCode;
})
//调取最后一条转入记录的操作人
let code = {
powJobCode: this.formData.pwoJobCode
}
listConversion(code).then(async res => {
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
this.formData.createByName = res.rows[0].operateBy;
let arry = {
name: this.formData.createByName
}
listEmployee(arry).then(async res => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
})
}
})
}
this.formData.batchNo = job.batchNo;
console.log(this.formData);
}
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,535 @@
<template>
<view style="background-color: #fff;">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="班产任务编码" :label-width='120' name="taskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanTaskCode" type="text" v-model="formData.taskCode"
@blur="scanBarTaskCode" :key="input.boolean" :focus='true' />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单编码" :labelWidth='120' name="pwoCode">
<uni-easyinput type="text" v-model="formData.pwoCode" disabled />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="班产作业编码" :labelWidth='120' name="shiftJobCode">
<uni-data-select :localdata="formData.shiftJobs" v-model="formData.shiftJobCode"
@change="getShiftJobInfo"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单作业编码" :labelWidth='120' name="pwoJobCode">
<uni-easyinput v-model="formData.pwoJobCode" disabled />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='120' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='120' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="规格" :labelWidth='50' name="specification1">
<uni-easyinput disabled type="text" v-model="formData.specification1" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="材质" :labelWidth='50' name="texture">
<uni-easyinput disabled type="text" v-model="formData.texture" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='120' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='120' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程编码" :labelWidth='120' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程名称" :labelWidth='120' name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="用时(h)" :labelWidth='120' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='120' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @blur="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='120' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
<u-divider :text="'可报工数量:'+reportableNum"></u-divider>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="合格数量" :labelWidth='100' name="pass">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.pass.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良数量" :labelWidth='100' name="defect">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.defect.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良原因" :labelWidth='100' name="defectReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['defect'].reason"
:localdata="defectReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废数量" :labelWidth='100' name="scrap">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.scrap.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废原因" :labelWidth='100' name="scrapReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['scrap'].reason"
:localdata="scrapReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗数量" :labelWidth='100' name="loss">
<u-number-box button-size="36" inputWidth="120"
v-model="formData.mesJobReportOnceRequestDTO.loss.reportNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="损耗原因" :labelWidth='100' name="lossReason">
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['loss'].reason"
:localdata="lossReasonOptions"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='100'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='100' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="备注" :labelWidth='100' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="formData.remark"></uni-easyinput>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
<!-- <u-button type="primary" @click="end">关闭</u-button> -->
</view>
</template>
<script>
import {
listPwoJob,
addReportOnce
} from "@/api/mes/jobReport.js";
import {
getEquipment
} from "@/api/mes/jobIn.js";
import {
listPwoJobLike
} from "@/api/mes/pwoIn.js";
import {
listShiftTask
} from "@/api/mes/shiftTask.js";
import {
listShiftJobWithAssociatedData,
getShiftJobByShiftJobCode
} from "@/api/mes/shiftJob.js";
import {
listMaterial
} from "@/api/mes/material.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
import {
login
} from "../../../api/login";
// const serialPort = uni.requireNativePlugin('Fvv-UniSerialPort')
export default {
data() {
return {
input: {
boolean: 0,
inputValue: '',
},
//判断是否从工单状态页面查询过来
isSearchRoute: false,
lossReasonOptions: [],
scrapReasonOptions: [],
defectReasonOptions: [],
formData: {
taskCode: null,
shiftJobCode: null,
pwoJobCode: null,
shiftJobs: [],
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
eqpId: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
remark: null,
mesJobReportOnceRequestDTO: {
pass: {
reportNumber: 0,
reason: null
},
defect: {
reportNumber: 0,
reason: null
},
scrap: {
reportNumber: 0,
reason: null
},
loss: {
reportNumber: 0,
reason: null
}
},
startTime: null,
endTime: null,
specification1: null,
jobType: 1,
texture: null,
opCode: null,
opTitle: null
},
reportableNum: 0,
rules: {
taskCode: {
rules: [{
required: true,
errorMessage: '请输入班产任务编码!'
}]
},
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入工单编码!'
}]
},
shiftJobCode: {
rules: [{
required: true,
errorMessage: '请选择班产作业编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
endTime: {
rules: [{
required: true,
errorMessage: '请输入完工时间!'
}]
}
}
}
},
methods: {
getOptions() {
getDicts("mes_job_report_defect").then(res => {
this.defectReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("mes_job_report_scrap").then(res => {
this.scrapReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("mes_job_report_loss").then(res => {
this.lossReasonOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
},
submit() {
if (this.sumReportNum() <= 0 || this.sumReportNum() > this.reportableNum) {
this.$modal.showToast("请重新检查报工数量")
return
}
this.$refs.form.validate().then(res => {
this.$modal.loading('提交中')
addReportOnce(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
if (this.isSearchRoute = true) {
setTimeout(() => {
this.$tab.navigateBack();
}, 500);
} else {
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
}
})
})
},
sumReportNum() {
const sum = ['pass', 'defect', 'scrap', 'loss'].reduce((total, key) => {
const value = Number(this.formData.mesJobReportOnceRequestDTO[key].reportNumber)
this.formData.mesJobReportOnceRequestDTO[key].reportNumber = value
return total + value
}, 0)
return sum
},
scanBarPwoCode() {
this.formData.shiftJobs = []
if (this.formData.pwoCode) {
listShiftJobWithAssociatedData({
pwoCode: this.formData.pwoCode
}).then((res) => {
if (res.rows.length > 0) {
this.$set(this.formData, "shiftJobs", res.rows.map(item => ({
text: item.shiftJobCode + ":" + item.opTitle,
value: item.shiftJobCode,
disabled: false
})))
console.log(this.formData.shiftJobs)
} else {
this.$modal.showToast("未查询到该工单编码")
}
})
}
},
clearJobInfo() {
this.reportableNum = 0
const resetFields = [
"ptNoTar", "ptTitleTar", "eqpId", "batchNo",
"createByName", "createByCode", "createById", "remark", "startTime",
"texture", "specification1", "machineId", "pwoJobCode",
"opCode", "opTitle"
]
// 重置表单信息
resetFields.forEach(field => {
this.$set(this.formData, field, null)
})
// 重置报工数量
Object.keys(this.formData.mesJobReportOnceRequestDTO).forEach(key => {
const item = this.formData.mesJobReportOnceRequestDTO[key];
this.$set(item, 'reportNumber', 0);
this.$set(item, 'reason', null);
});
},
async getShiftJobInfo(e) {
this.formData.shiftJobCode = e
if (this.formData.shiftJobCode) {
this.clearJobInfo()
await getShiftJobByShiftJobCode(this.formData.shiftJobCode).then(async res => {
this.formData.pwoJobCode = res.data.code
this.formData.ptNoTar = res.data.ptNoTar
this.formData.ptTitleTar = res.data.ptTitleTar
this.formData.opCode = res.data.opCode
this.formData.opTitle = res.data.opTitle
this.formData.batchNo = res.data.batchNo
this.reportableNum = res.data.targetNum - res.data.finishQty
await listPwoJobLike({
code: this.formData.pwoJobCode
}).then(resp => {
this.formData.eqpId = resp.rows[0].eqpId
})
if (this.formData.eqpId) {
getEquipment(this.formData.eqpId).then(res => {
this.formData.machineId = res.data.equipmentCode
}).catch(() => {
this.$modal.showToast("获取设备编号失败")
})
}
if (res.data.ptNoTar) {
listMaterial({
materialCode: res.data.ptNoTar
}).then(resp => {
if (resp.rows.length > 0) {
if (resp.rows[0].specification1) this.formData.specification1 =
resp.rows[0].specification1
if (resp.rows[0].texture) this.formData.texture = resp.rows[0]
.texture
// this.formData.specification1 = resp.rows[0].specification1 ?
// resp.rows[0].specification1 : ''
// this.formData.texture = resp.rows[0].texture ? res.rows[0]
// .texture : ''
}
}).catch(() => {
this.$modal.showToast("查询产品规格/材质信息失败!")
})
}
}).catch(() => {
this.$modal.showToast("获取作业信息失败!")
})
}
},
scanBarCreateBy() {
if (this.formData.createByCode) {
let obj = {
empCode: this.formData.createByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanTaskCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.taskCode = res.result
_this.scanBarTaskCode()
}
});
},
scanBarTaskCode() {
console.log(this.formData.taskCode)
if (this.formData.taskCode) {
this.formData.pwoCode = null
this.formData.shiftJobCode = null
this.formData.shiftJobs = []
this.clearJobInfo()
listShiftTask({
// taskCode: "ST000003017"
taskCode: this.formData.taskCode
}).then((res) => {
this.formData.pwoCode = res.rows[0].pwoCode
this.scanBarPwoCode()
}).catch(() => {
this.$modal.showToast("获取工单编码失败")
})
}
},
/**
* 隐藏软键盘
*/
focus() {
uni.hideKeyboard()
},
/**
* 不让手动输入
* @param {Object} value
handleInput(value) {
const {
inputValue
} = this.input
if (value.length - inputValue.length == 1 || inputValue.length - value.length == 1) {
this.$modal.msg("请扫描")
this.formData.pwoJobCode = null
this.input.inputValue = value
this.input.boolean = this.input.boolean == 0 ? 10 : 0
return
}
this.input.inputValue = value
}*/
},
onLoad: function(option) {
if (option.taskCode) {
this.isSearchRoute = true;
this.formData.taskCode = option.taskCode;
this.scanTaskCode();
}
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.getOptions();
// this.formData.type = '报废品';
// this.formData.createByName = this.$store.state.user.name;
}
}
</script>

View File

@@ -0,0 +1,292 @@
<template>
<view style="background-color: #fff">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-align="right">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth="90" name="pwoJobCode" required>
<uni-easyinput suffixIcon="scan" @iconClick="scanJob" type="text" v-model="formData.pwoJobCode"
@confirm="getJobInfo" focus />
</uni-forms-item>
</uni-col>
<uni-col :span="18">
<uni-forms-item label="员工编码" :labelWidth="90" name="createByCode" required>
<uni-easyinput type="text" @confirm="getEmpInfo" v-model="formData.createByCode" />
<!-- <uni-easyinput type="text" suffixIcon="scan" @iconClick="scanEmp" @confirm="getEmpInfo"
v-model="formData.createByCode" /> -->
</uni-forms-item>
</uni-col>
<uni-col :span="6">
<uni-easyinput disabled type="text" v-model="formData.createByName || '/'" />
</uni-col>
<uni-col :span="18">
<uni-forms-item label="设备编码" :labelWidth="90" name="machineId" required>
<uni-easyinput type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="6">
<u-button style="height: 37px;" @click="handleBindEqp" text="绑定设备"
:disabled="!formData.pwoJobCode || !formData.machineId" />
</uni-col>
<uni-col :span="24">
<u-divider />
<uni-forms-item label="工单编码" :labelWidth="90" name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth="90" name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth="90" name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth="90" name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程编码" :labelWidth="90" name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="制程名称" :labelWidth="90" name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth="90">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" :disabled="!checkPermi(['mes:jobStartRecord:edit'])" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">开工</u-button>
</view>
</template>
<script>
import {
addStart,
listPwoJob,
updatePwoJob,
getEquipment,
listEquipment
} from '@/api/mes/jobReport.js';
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from '@/api/mes/jobIn.js';
import { getConfigKey } from '@/api/system/config.js';
import { checkPermi } from "@/utils/permission";
export default {
data() {
return {
timer: null,
formData: {
pwoJobCode: null,
pwoJobId: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
createById: null,
startTime: null,
},
rules: {
pwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入作业编码!'
}]
},
machineId: {
rules: [{
required: true,
errorMessage: '请输入设备编码!'
}]
},
createByCode: {
rules: [{
required: true,
errorMessage: '请输入生产员工编码!'
}]
},
startTime: {
rules: [{
required: true,
errorMessage: '请输入开工时间!'
}]
}
}
};
},
created() {
this.timer = setInterval(() => {
this.renderStartTime();
}, 1000);
},
methods: {
checkPermi,
renderStartTime() {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ('0' + (currentDate.getMonth() + 1)).slice(-2);
var day = ('0' + currentDate.getDate()).slice(-2);
var hours = ('0' + currentDate.getHours()).slice(-2);
var minutes = ('0' + currentDate.getMinutes()).slice(-2);
var seconds = ('0' + currentDate.getSeconds()).slice(-2);
var formattedDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
// 将当前时间赋值给 formData.startTime
this.formData.startTime = formattedDate;
},
async handleRenderEmp() {
if(!this.formData.machineId) return;
const { rows, total } = await listEmpEqpHistory({ equipmentCode: this.formData.machineId });
const emp = rows.filter(item => !item.endTime)?.[0];
if(!emp || !total > 0) return this.$modal.msg('该设备下没有绑定人员');
this.formData.createByCode = rows[0].empCode || '';
this.formData.createByName = rows[0].empName || '';
this.formData.createById = rows[0].empId || '';
},
// 绑定设备
async handleBindEqp() {
let eqpId = '';
this.$modal.loading('绑定中');
try {
const { rows, total } = await listEquipment({ equipmentCode: this.formData.machineId });
if(total == 1) {
eqpId = rows[0].id;
} else {
this.$modal.msg('未检索到该设备编码相关的信息!');
return;
}
await updatePwoJob({
id: this.formData.pwoJobId,
eqpId
});
this.$modal.msgSuccess("绑定成功!");
this.handleRenderEmp();
} catch (err) {
console.log(err);
this.$modal.msgError('绑定失败!');
} finally {
this.$modal.closeLoading();
}
},
submit() {
this.$refs.form.validate().then(() => {
this.$modal.loading('提交中');
addStart({
jobCode: this.formData.pwoJobCode,
equipmentCode: this.formData.machineId,
employeeCode: this.formData.createByCode,
startTime: this.formData.startTime
}).then(() => {
this.$modal.closeLoading();
this.$modal.msgSuccess('操作成功!');
setTimeout(() => {
this.$tab.switchTab('/pages/work/index');
}, 500);
});
});
},
getJobInfo() {
if (!this.formData.pwoJobCode) return;
listPwoJob({
code: this.formData.pwoJobCode
}).then(async (res) => {
if (!res.total > 0) return this.$modal.msg('未检索到该作业编码相关的信息!');
const job = res.rows[0];
this.formData.pwoCode = job.pwoCode;
this.formData.pwoJobId = job.id;
this.formData.ptNoTar = job.ptNoTar;
this.formData.ptTitleTar = job.ptTitleTar;
this.formData.opCode = job.opCode;
this.formData.opTitle = job.opTitle;
this.formData.batchNo = job.batchNo;
if (job.eqpId) {
await getEquipment(job.eqpId).then((res) => {
this.formData.machineId = res.data.equipmentCode;
});
// 查找该设备下上机人员
await this.handleRenderEmp();
}
if(this.formData.createById) return;
// 若没有人员,则调取最后一条转入记录的操作人
listConversion({
powJobCode: this.formData.pwoJobCode
}).then(async (res) => {
if(!res.total > 0) return;
this.formData.createByName = res.rows[0].operateBy;
if(!this.formData.createByName) return;
listEmployee({
name: this.formData.createByName
}).then(async (res) => {
this.formData.createByCode = res.rows[0].empCode;
this.formData.createById = res.rows[0].id;
});
});
});
},
getEmpInfo() {
if (!this.formData.createByCode) {
this.formData.createByName = null;
this.formData.createById = null;
return;
}
listEmployee({
empCode: this.formData.createByCode
}).then(res => {
if (res.rows.length == 0) {
this.$modal.msg('未查询到该人员信息!');
return;
}
this.formData.createByName = res.rows[0].name;
this.formData.createById = res.rows[0].id;
});
},
scanJob() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanEmp() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.getEmpInfo();
}
});
},
},
beforeDestroy() {
clearInterval(this.timer);
},
};
</script>

View File

@@ -0,0 +1,182 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="合并标签码" :labelWidth='90' name="singleReportSign">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="query"
v-model="formData.singleReportSign" type="text" />
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query">查询</u-button>
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-for="item,index in reportList" :key="item.id">
<div><strong>合并标签号</strong>:{{item.singleReportSign}}</div>
<div><strong>物料编码</strong>:{{item.ptNoTar}}</div>
<div><strong>物料名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>物料规格</strong>:{{item.specification1}}</div>
<div><strong>数量</strong>:{{item.reportNumber}}</div>
<div><strong>仓库</strong>:{{item.whName?item.whName:item.whCode}}</div>
<div><strong>状态</strong>:检验未入库</div>
</uni-card>
<!-- <u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right">
<u-checkbox size="25" iconSize="25" activeColor="green" v-for="(item, index) in reportList"
:key="index" :disabled="item.disabled" :name="item.id" :label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'合并标签号 : '+(item.singleReportSign? item.singleReportSign:'')+'\n\n'+
'物料编码 : '+(item.ptNoTar?item.ptNoTar:'')+'\n\n'+
'物料名称 : '+(item.ptTitleTar?item.ptTitleTar:'')+'\n\n'+
'物料规格 : '+(item.specification1?item.specification1:'')+'\n\n'+
'数量 : '+(item.reportNumber?item.reportNumber:'')+'\n\n'+
'仓库 : '+(item.whCode?item.whCode:'')+'\n\n'+
'状态 : '+returnStatus(item.status)+'\n\n'
">
</u-checkbox>
</u-checkbox-group> -->
</uni-collapse-item>
<u-button type="primary" @click="submit" v-if="reportList.length>0">提交</u-button>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
export default {
mounted() {
getDicts("mes_job_single_report_sign_status").then(res => {
this.mes_job_single_report_sign_status = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
listWarehouse().then(res => {
this.whList = res.rows
})
},
data() {
return {
whList: [],
mes_job_single_report_sign_status: [],
selectAllChecked: false,
checked: [],
reportList: [],
formData: {
singleReportSign: null
},
ids: [],
rules: {
}
}
},
methods: {
returnStatus(i) {
console.log(i)
let obj = this.mes_job_single_report_sign_status.find(dict => dict.value == i)
console.log(obj)
if (obj)
return obj.text
else
return ''
},
getCheckedList(e) {
this.ids = e;
// 判断当前选中的复选框数量,决定全选框的状态
if (this.ids.length === this.reportList.length) {
this.selectAllChecked = true;
} else {
this.selectAllChecked = false;
}
},
//物料编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.singleReportSign = res.result;
}
});
},
query() {
listMesJobSingleReportSign(this.formData).then(res => {
if (res.rows.length > 0) {
if (res.rows[0].status != 2) {
let text = this.returnStatus(res.rows[0].status)
this.$modal.msg("查询的记录当前处于'" + text + "'状态!");
} else {
if (!res.rows[0].whCode) {
this.reportList = res.rows
} else {
let obj = this.whList.find(item => item.warehouseCode == res.rows[0].whCode)
if (obj) {
console.log(obj)
res.rows[0].whName = obj.warehouseName
}
this.reportList = res.rows
}
}
} else {
this.$modal.msg("未查询到相关记录!");
}
})
},
selectAll() {
// 点击全选按钮时,更新所有复选框的选中状态
if (this.checked.length === this.reportList.length) {
this.checked = [];
this.selectAllChecked = false; // 全选框不选中
} else {
this.checked = this.reportList.map(item => item.id);
this.selectAllChecked = true; // 全选框选中
}
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该入库确认吗?',
success: function(res) {
if (res.confirm) {
_this.$modal.loading('提交中')
whInConfirm([_this.reportList[0].id]).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("上传入库确认成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,111 @@
<template>
<view style="background-color: #fff" v-if="reportList.length>0">
<u-checkbox size="25" iconSize="25" activeColor="green" labelSize='40rpx' :label="'全选'" @change="selectAll"
v-if="reportList.length>0" :checked="selectAllChecked">
</u-checkbox>
<u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right" style="height: 80vh;overflow: scroll;overflow-wrap:anywhere">
<div v-for="(item, index) in reportList" :key="index">
<u-checkbox size="25" iconSize="25" activeColor="green" :disabled="item.disabled" :name="item.id"
:label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'物料编码 : '+(item.ptNoTar?item.ptNoTar:'')+'\n\n'+
'物料名称 : '+(item.ptTitleTar?item.ptTitleTar:'')+'\n\n'+
'物料规格 : '+(item.specification1?item.specification1:'')+'\n\n'+
'数量 : '+(item.reportNumber?item.reportNumber:'')+'\n\n'+
'仓库 : '+(item.whCode?item.whCode:'')+'\n\n'+
'合并标签号 : '+(item.singleReportSign? item.singleReportSign:'')+'\n\n'+
'失败原因 : '+(item.remark? item.remark:'')+'\n\n'
">
</u-checkbox>
<u-button type="success" @click="updateStatus(item)">强制入库</u-button>
</div>
</u-checkbox-group>
<u-button type="primary" @click="submit" v-if="reportList.length>0">提交</u-button>
</view>
<view v-else style="text-align: center;">
查询无记录
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
export default {
mounted() {
this.query()
},
data() {
return {
selectAllChecked: false,
checked: [],
ids: [],
reportList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
}
},
methods: {
//强制入库
updateStatus(item) {
item.status = 3
updateMesJobSingleReportSign(item).then(res => {
this.$modal.msgSuccess("强制入库成功!");
this.query()
})
},
getCheckedList(e) {
this.ids = e;
// 判断当前选中的复选框数量,决定全选框的状态
if (this.ids.length === this.reportList.length) {
this.selectAllChecked = true;
} else {
this.selectAllChecked = false;
}
},
selectAll() {
// 点击全选按钮时,更新所有复选框的选中状态
if (this.checked.length === this.reportList.length) {
this.checked = [];
this.selectAllChecked = false; // 全选框不选中
} else {
this.checked = this.reportList.map(item => item.id);
this.selectAllChecked = true; // 全选框选中
}
},
query() {
listMesJobSingleReportSign({
errStatus: 1,
status: 2
}).then(res => {
this.reportList = res.rows
})
},
submit() {
// let ids = this.reportList.map(item => item.id)
whInConfirm(this.ids)
this.$tab.switchTab(
"/pages/work/index");
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,136 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="日期范围" :labelWidth='90' name="updateTime">
<uni-datetime-picker v-model="formData.updateTime" type="daterange" rangeSeparator="至" />
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90' name="ptNoTar">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.ptNoTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' name="ptTitleTar">
<uni-easyinput v-model="formData.ptTitleTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料规格" :labelWidth='90' name="specification1">
<uni-easyinput v-model="formData.specification1" type="text" />
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90' name="formData.whCode">
<zxz-uni-data-select v-model="formData.whCode" :localdata="whOptions"
:filterable="true"></zxz-uni-data-select>
<!-- <uni-data-select v-model="formData.whCode" :localdata="whOptions"></uni-data-select> -->
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query">查询</u-button>
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-for="item,index in reportList" :key="item.id">
<div><strong>合并标签号</strong>:{{item.singleReportSign}}</div>
<div><strong>物料编码</strong>:{{item.ptNoTar}}</div>
<div><strong>物料名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>物料规格</strong>:{{item.specification1}}</div>
<div><strong>数量</strong>:{{item.reportNumber}}</div>
<div><strong>仓库</strong>:{{item.whName?item.whName:item.whCode}}</div>
<div><strong>状态</strong>:入库完成</div>
</uni-card>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
export default {
mounted() {
listWarehouse().then(res => {
this.whList = res.rows;
this.whOptions = res.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode,
diasble: false
}
});
})
},
data() {
return {
whOptions: [],
whList: [],
datetimerange: [],
reportList: [],
formData: {
ptNoTar: null,
ptTitleTar: null,
updateTime: [],
specification1: null,
whCode: null
},
rules: {
}
}
},
methods: {
//物料编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.ptNoTar = res.result;
}
});
},
query() {
let obj = {
['A.ptNoTar-0']: this.formData.ptNoTar,
['A.ptNoTar-op']: 'ct',
['A.ptTitleTar-0']: this.formData.ptTitleTar,
['A.ptTitleTar-op']: 'ct',
['A.specification1-0']: this.formData.specification1,
['A.specification1-op']: 'ct',
['A.updateTime-0']: this.formData.updateTime.length > 0 ? (this.formData.updateTime[0] +
' 00:00:00') : null,
['A.updateTime-1']: this.formData.updateTime.length > 0 ? (this.formData.updateTime[1] +
' 00:00:00') : null,
['A.updateTime-op']: 'bt',
['A.whCode-0']: this.formData.whCode,
['A.whCode-op']: 'eq',
['A.status-op']: 'eq',
['A.status-0']: 3,
gexpr: 'A',
pageNum: 0,
pageSize: 100
}
console.log(obj)
advListMesJobSingleReportSign(obj).then(res => {
this.reportList = res.rows.map(item => {
let obj = this.whList.find(i => i.warehouseCode == item.whCode)
if (obj) {
console.log(obj)
item.whName = obj.warehouseName
}
return item
})
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,219 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="物料编码" :labelWidth='90' name="ptNoTar">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.ptNoTar" type="text" />
</uni-forms-item>
<!-- <uni-forms-item label="物料名称" :labelWidth='90' name="ptTitleTar">
<uni-easyinput v-model="formData.ptTitleTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料规格" :labelWidth='90' name="specification1">
<uni-easyinput v-model="formData.specification1" type="text" />
</uni-forms-item> -->
<uni-forms-item label="创建时间" :labelWidth='90' name="updateTime">
<uni-datetime-picker v-model="formData.updateTime" type="datetimerange" rangeSeparator="至" />
</uni-forms-item>
<uni-forms-item label="状态" :labelWidth='90' name="status">
<uni-data-select v-model="formData.status" :localdata="range"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90' name="formData.whCode">
<zxz-uni-data-select v-model="formData.whCode" :localdata="whOptions"
:filterable="true" :multiple="true"></zxz-uni-data-select>
<!-- <uni-data-select v-model="formData.whCode" :localdata="whOptions"></uni-data-select> -->
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query">查询</u-button>
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-for="item,index in reportList" :key="item.id">
<u-row :gutter="12">
<u-col :span="8">
<div><strong>合并标签号</strong>:{{item.singleReportSign}}</div>
<div><strong>物料编码</strong>:{{item.ptNoTar}}</div>
<div><strong>物料名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>物料规格</strong>:{{item.specification1}}</div>
<div><strong>数量</strong>:{{item.reportNumber}}</div>
<div><strong>仓库</strong>:{{item.whName?item.whName:item.whCode}}</div>
<div><strong>状态</strong>:{{returnStatus(item.status)}}</div>
</u-col>
<u-col :span="4">
<button type="primary" size="mini" style="float: right;margin-top: 80px;" @click="handleconfirmWhIn(item.id)">确认入库</button>
</u-col>
</u-row>
<!-- <view> -->
<!-- </view> -->
</uni-card>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
getDicts
} from "@/api/system/dict/dictData.js";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
export default {
onLoad: function() {
// 获取当前时间
var currentDate = new Date();
// 计算三天前的时间
var threeDateAgo = new Date(currentDate);
threeDateAgo.setDate(currentDate.getDate() - 3);
// 计算昨天的时间
var yesterday = new Date(currentDate);
yesterday.setDate(currentDate.getDate() - 1);
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = threeDateAgo.getFullYear();
var year1 = yesterday.getFullYear();
var month = String(threeDateAgo.getMonth() + 1).padStart(2, "0");
var month1 = String(yesterday.getMonth() + 1).padStart(2, "0");
var day = String(threeDateAgo.getDate()).padStart(2, "0");
var day1 = String(yesterday.getDate()).padStart(2, "0");
var beginTime = year + "-" + month + "-" + day + " " + "18:00:00";
var endTime = year1 + "-" + month1 + "-" + day1 + " " + "18:00:00";
// 将当前时间赋值给 formData.endTime
this.formData.updateTime.push(beginTime)
this.formData.updateTime.push(endTime)
},
mounted() {
getDicts("mes_job_single_report_sign_status").then(res => {
this.mes_job_single_report_sign_status = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
listWarehouse().then(res => {
this.whList = res.rows
this.whOptions = res.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode,
diasble: false
}
});
})
},
data() {
return {
whOptions: [],
whList: [],
mes_job_single_report_sign_status: [],
datetimerange: [],
reportList: [],
formData: {
ptNoTar: null,
ptTitleTar: null,
status: 1,
specification1: null,
updateTime: [],
specification1: null,
whCode: [],
},
range: [{
value: 1,
text: "报工未检验"
},
{
value: 2,
text: "检验未入库"
}
],
rules: {
}
}
},
methods: {
returnStatus(i) {
console.log(i)
let obj = this.mes_job_single_report_sign_status.find(dict => dict.value == i)
console.log(obj)
if (obj)
return obj.text
else
return ''
},
//物料编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.ptNoTar = res.result;
}
});
},
query() {
let obj = {
['A.ptNoTar-0']: this.formData.ptNoTar,
['A.ptTitleTar-0']: this.formData.ptTitleTar,
['A.specification1-0']: this.formData.specification1,
['A.status-0']: this.formData.status,
['A.ptNoTar-op']: 'ct',
['A.ptTitleTar-op']: 'ct',
['A.specification1-op']: 'ct',
// ['A.whCode-0']: this.formData.whCode,
['A.status-op']: 'eq',
['A.whCode-op']: 'eq',
['A.updateTime-0']: this.formData.updateTime.length > 0 ? (this.formData.updateTime[0]) : null,
['A.updateTime-1']: this.formData.updateTime.length > 0 ? (this.formData.updateTime[1]) : null,
['A.updateTime-op']: 'bt',
gexpr: 'A',
pageNum: 0,
pageSize: 100
}
//多选,动态添加仓库
if(this.formData.whCode.length==0){
obj['A.whCode-0']=null
}else{
for(let i=0;i<this.formData.whCode.length;i++){
obj['A.whCode-'+i]=this.formData.whCode[i]
}
}
advListMesJobSingleReportSign(obj).then(res => {
this.reportList = res.rows.map(item => {
let obj = this.whList.find(i => i.warehouseCode == item.whCode)
if (obj) {
console.log(obj)
item.whName = obj.warehouseName
}
return item
})
})
},
//确认入库
handleconfirmWhIn(id){
// console.log(id);
whInConfirm(id).then(res => {
this.$modal.msgSuccess("上传入库确认成功!");
})
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,161 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="物料编码" :labelWidth='90' name="ptNoTar">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.ptNoTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' name="ptTitleTar">
<uni-easyinput v-model="formData.ptTitleTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料规格" :labelWidth='90' name="specification1">
<uni-easyinput v-model="formData.specification1" type="text" />
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90' name="formData.whCode">
<zxz-uni-data-select v-model="formData.whCode" :localdata="whOptions"
:filterable="true"></zxz-uni-data-select>
<!-- <uni-data-select v-model="formData.whCode" :localdata="whOptions"></uni-data-select> -->
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query">查询</u-button>
<uni-collapse-item :open="true">
<u-checkbox size="25" iconSize="25" activeColor="green" labelSize='40rpx' :label="'全选'"
@change="selectAll" v-if="reportList.length>0" :checked="selectAllChecked">
</u-checkbox>
<u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right" style="height: 50vh;overflow: scroll;">
<u-checkbox size="25" iconSize="25" activeColor="green" v-for="(item, index) in reportList"
:key="index" :disabled="item.disabled" :name="item.id" :label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'物料编码 : '+(item.ptNoTar?item.ptNoTar:'')+'\n\n'+
'物料名称 : '+(item.ptTitleTar?item.ptTitleTar:'')+'\n\n'+
'物料规格 : '+(item.specification1?item.specification1:'')+'\n\n'+
'数量 : '+(item.reportNumber?item.reportNumber:'')+'\n\n'+
'仓库 : '+(item.whCode?item.whCode:'')+'\n\n'+
'合并标签号 : '+(item.singleReportSign? item.singleReportSign:'')+'\n'
">
</u-checkbox>
</u-checkbox-group>
</uni-collapse-item>
<u-button type="primary" @click="submit" v-if="reportList.length>0">提交</u-button>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn";
export default {
mounted() {
listWarehouse().then(res => {
this.whOptions = res.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode,
diasble: false
}
});
})
},
data() {
return {
selectAllChecked: false,
checked: [],
whOptions: [],
reportList: [],
formData: {
ptNoTar: null,
ptTitleTar: null,
specification1: null,
whCode: null,
//报工未检验
status: 1
},
ids: [],
rules: {
}
}
},
methods: {
getCheckedList(e) {
this.ids = e;
console.log(this.ids)
// 判断当前选中的复选框数量,决定全选框的状态
if (this.ids.length === this.reportList.length) {
this.selectAllChecked = true;
} else {
this.selectAllChecked = false;
}
},
//物料编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.ptNoTar = res.result;
}
});
},
query() {
listMesJobSingleReportSign(this.formData).then(res => {
this.reportList = res.rows
})
},
selectAll() {
// 点击全选按钮时,更新所有复选框的选中状态
if (this.checked.length === this.reportList.length) {
this.checked = [];
this.ids = this.checked;
this.selectAllChecked = false; // 全选框不选中
} else {
this.checked = this.reportList.map(item => item.id);
this.ids = this.checked
this.selectAllChecked = true; // 全选框选中
}
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检确认吗?',
success: function(res) {
if (res.confirm) {
_this.$modal.loading('提交中')
console.log(_this.ids)
qualityConfirm(_this.ids).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("上传质检确认成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,173 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="物料编码" :labelWidth='90' name="ptNoTar">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.ptNoTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' name="ptTitleTar">
<uni-easyinput v-model="formData.ptTitleTar" type="text" />
</uni-forms-item>
<uni-forms-item label="物料规格" :labelWidth='90' name="specification1">
<uni-easyinput v-model="formData.specification1" type="text" />
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90' name="formData.whCode">
<zxz-uni-data-select v-model="formData.whCode" :localdata="whOptions"
:filterable="true"></zxz-uni-data-select>
<!-- <uni-data-select v-model="formData.whCode" :localdata="whOptions"></uni-data-select> -->
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query" style="margin-bottom: 10px;">查询</u-button>
<!-- <uni-collapse-item :open="true"> -->
<u-checkbox size="25" iconSize="25" activeColor="green" labelSize='40rpx' :label="'全选'" @change="selectAll"
v-if="reportList.length>0" :checked="selectAllChecked">
</u-checkbox>
<u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right" style="height: 63vh;overflow: scroll;">
<u-checkbox size="25" iconSize="25" activeColor="green" v-for="(item, index) in reportList" :key="index"
:disabled="item.disabled" :name="item.id" :label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'物料编码 : '+(item.ptNoTar?item.ptNoTar:'')+'\n\n'+
'物料名称 : '+(item.ptTitleTar?item.ptTitleTar:'')+'\n\n'+
'物料规格 : '+(item.specification1?item.specification1:'')+'\n\n'+
'数量 : '+(item.reportNumber?item.reportNumber:'')+'\n\n'+
'仓库 : '+(item.whCode?item.whCode:'')+'\n\n'+
'合并标签号 : '+(item.singleReportSign? item.singleReportSign:'')+'\n'
">
</u-checkbox>
</u-checkbox-group>
<!-- </uni-collapse-item> -->
<u-button type="primary" @click="submit" v-if="reportList.length>0">提交</u-button>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn";
export default {
mounted() {
listWarehouse().then(res => {
this.whOptions = res.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode,
diasble: false
}
});
})
},
data() {
return {
selectAllChecked: false,
checked: [],
whOptions: [],
reportList: [],
formData: {
ptNoTar: null,
ptTitleTar: null,
specification1: null,
whCode: null,
status: 0
},
ids: [],
rules: {
}
}
},
methods: {
getCheckedList(e) {
this.ids = e;
console.log(this.ids)
// 判断当前选中的复选框数量,决定全选框的状态
if (this.ids.length === this.reportList.length) {
this.selectAllChecked = true;
} else {
this.selectAllChecked = false;
}
},
//物料编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.ptNoTar = res.result;
}
});
},
query() {
listMesJobSingleReportSign(this.formData).then(res => {
if (res.rows.length === 0) {
this.$modal.msg("未查询到相关记录!");
return;
}
this.reportList = res.rows.map(item => {
let obj = this.whOptions.find(item => item.warehouseCode == item.whCode)
if (obj) {
item.whName = obj.warehouseName
}
return item
});
})
},
selectAll() {
// 点击全选按钮时,更新所有复选框的选中状态
if (this.checked.length === this.reportList.length) {
this.checked = [];
this.ids = this.checked;
this.selectAllChecked = false; // 全选框不选中
} else {
this.checked = this.reportList.map(item => item.id);
this.ids = this.checked
this.selectAllChecked = true; // 全选框选中
}
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检确认吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.ids)
// let ids = this.reportList.map(item => item.id)
reportConfirm(_this.ids)
_this.$modal.msg("报工确认已提交!");
_this.formData = {
ptNoTar: null,
ptTitleTar: null,
specification1: null,
whCode: null,
}
_this.reportList = [];
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,157 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData">
<uni-forms-item label="合并标签码" :labelWidth='90' name="singleReportSign">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.singleReportSign" type="text" />
</uni-forms-item>
<uni-swipe-action style="height: 88vh;overflow: scroll;">
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
@click="(data) => clickDetail(index,data)" v-for="(item, index) in reportList">
<uni-card :is-shadow="false" is-full>
<div><strong>物料编码</strong>:{{item.ptNoTar}}</div>
<div><strong>物料名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>物料规格</strong>:{{item.specification1}}</div>
<div><strong>数量</strong>:{{item.reportNumber}}</div>
<div><strong>仓库</strong>:{{item.whName?item.whName:item.whCode}}</div>
<div><strong>合并标签码</strong>:{{item.singleReportSign}}</div>
</uni-card>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
export default {
mounted() {
listWarehouse().then(res => {
this.whList = res.rows
})
},
data() {
return {
whList: [],
reportList: [],
formData: {
singleReportSign: null
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
}
},
methods: {
deleteDetail(index) {
this.reportList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
submit() {
let ids = this.reportList.map(item => item.id)
reportConfirm(ids)
this.$modal.msg("报工确认已提交!");
this.reportCode = null;
this.reportList = [];
},
scanBarCode() {
listMesJobSingleReportSign(this.formData).then(res => {
if (res.rows.length === 0) {
this.$modal.msg("未查询到相关记录!");
return;
}
const row = res.rows[0];
if (row.status !== 0) {
this.$modal.msg("该记录当前不在'未上传报工'状态!");
} else {
if (this.reportList.some(item => item.id == row.id)) {
this.$modal.msg("数据已存在,无需重复添加。");
return;
}
let obj = this.whList.find(item => item.warehouseCode == row.whCode)
if (obj) {
row.whName = obj.warehouseName
}
this.reportList.push(row);
}
this.formData.singleReportSign = null;
})
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.singleReportSign = res.result;
_this.scanBarCode();
}
});
},
}
}
</script>
<style>
// 搜索框
.search-bar {
width: 100%;
height: 100rpx;
margin-top: 2%;
}
.search-bar-box {
display: flex;
margin: 0 auto;
width: 620rpx;
height: 74rpx;
border: 5rpx solid #00a8cc;
border-radius: 50rpx;
}
.search-text {
width: 100%;
margin-top: 10rpx;
margin-left: 20rpx;
font-size: 30rpx;
color: #7f7f81;
}
.search-btn {
background-color: #00a8cc;
/* Green */
color: white;
text-align: center;
display: inline-block;
font-size: 35rpx;
width: 240rpx;
height: 70rpx;
line-height: 65rpx;
border-radius: 30rpx;
letter-spacing: 3rpx;
}
</style>

View File

@@ -0,0 +1,98 @@
<template>
<view style="background-color: #fff" v-if="reportList.length>0">
<u-checkbox size="25" iconSize="25" activeColor="green" labelSize='40rpx' :label="'全选'" @change="selectAll"
v-if="reportList.length>0" :checked="selectAllChecked">
</u-checkbox>
<u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right" style="height: 80vh;overflow: scroll;overflow-wrap:anywhere">
<u-checkbox size="25" iconSize="25" activeColor="green" v-for="(item, index) in reportList" :key="index"
:disabled="item.disabled" :name="item.id" :label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'物料编码 : '+(item.ptNoTar?item.ptNoTar:'')+'\n\n'+
'物料名称 : '+(item.ptTitleTar?item.ptTitleTar:'')+'\n\n'+
'物料规格 : '+(item.specification1?item.specification1:'')+'\n\n'+
'数量 : '+(item.reportNumber?item.reportNumber:'')+'\n\n'+
'仓库 : '+(item.whCode?item.whCode:'')+'\n\n'+
'合并标签号 : '+(item.singleReportSign? item.singleReportSign:'')+'\n\n'+
'失败原因 : '+(item.remark? item.remark:'')+'\n'
">
</u-checkbox>
</u-checkbox-group>
<u-button type="primary" @click="submit" v-if="reportList.length>0">提交</u-button>
</view>
<view v-else style="text-align: center;">
查询无记录
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
export default {
mounted() {
this.query()
},
data() {
return {
selectAllChecked: false,
checked: [],
ids: [],
reportList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
}
},
methods: {
getCheckedList(e) {
this.ids = e;
// 判断当前选中的复选框数量,决定全选框的状态
if (this.ids.length === this.reportList.length) {
this.selectAllChecked = true;
} else {
this.selectAllChecked = false;
}
},
selectAll() {
// 点击全选按钮时,更新所有复选框的选中状态
if (this.checked.length === this.reportList.length) {
this.checked = [];
this.selectAllChecked = false; // 全选框不选中
} else {
this.checked = this.reportList.map(item => item.id);
this.selectAllChecked = true; // 全选框选中
}
},
query() {
listMesJobSingleReportSign({
errStatus: 1,
status: 0
}).then(res => {
this.reportList = res.rows
})
},
submit() {
// let ids = this.reportList.map(item => item.id)
reportConfirm(this.ids)
this.$tab.switchTab(
"/pages/work/index");
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,131 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="合并标签码" :labelWidth='90' name="singleReportSign">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="query"
v-model="formData.singleReportSign" type="text" />
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="query">查询</u-button>
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-for="item,index in reportList" :key="item.id">
<div><strong>合并标签号</strong>:{{item.singleReportSign}}</div>
<div><strong>物料编码</strong>:{{item.ptNoTar}}</div>
<div><strong>物料名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>物料规格</strong>:{{item.specification1}}</div>
<div><strong>数量</strong>:{{item.reportNumber}}</div>
<div><strong>仓库</strong>:{{item.whName?item.whName:item.whCode}}</div>
<div><strong>失败原因</strong>:{{item.remark?item.remark:''}}</div>
<div><strong>状态</strong>:{{returnStatus(item.status)}}</div>
</uni-card>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listMesJobSingleReportSign,
advListMesJobSingleReportSign,
getMesJobSingleReportSign,
delMesJobSingleReportSign,
addMesJobSingleReportSign,
updateMesJobSingleReportSign,
reportConfirm,
qualityConfirm,
whInConfirm
} from "@/api/mes/mesJobSingleReportSign";
import {
listWarehouse
} from "@/api/wms/pdcIn.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
export default {
mounted() {
getDicts("mes_job_single_report_sign_status").then(res => {
this.mes_job_single_report_sign_status = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
listWarehouse().then(res => {
this.whList = res.rows
})
},
data() {
return {
whList: [],
mes_job_single_report_sign_status: [],
reportList: [],
formData: {
singleReportSign: null
},
rules: {
}
}
},
methods: {
returnStatus(i) {
console.log(i)
let obj = this.mes_job_single_report_sign_status.find(dict => dict.value == i)
console.log(obj)
if (obj)
return obj.text
else
return ''
},
//合并标签编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.singleReportSign = res.result;
}
});
},
query() {
let obj = {
['A.singleReportSign-0']: this.formData.singleReportSign,
['A.singleReportSign-op']: 'ct',
gexpr: 'A'
}
advListMesJobSingleReportSign(obj).then(res => {
this.reportList = res.rows.map(item => {
let obj = this.whList.find(i => i.warehouseCode == item.whCode)
if (obj) {
console.log(obj)
item.whName = obj.warehouseName
}
return item
})
})
// listMesJobSingleReportSign(this.formData).then(res => {
// if (res.rows.length > 0) {
// if (!res.rows[0].whCode) {
// this.reportList = res.rows
// } else {
// let obj = this.whList.find(item => item.warehouseCode == res.rows[0].whCode)
// if (obj) {
// console.log(obj)
// res.rows[0].whName = obj.warehouseName
// }
// this.reportList = res.rows
// }
// } else {
// this.$modal.msg("未查询到相关记录!");
// }
// })
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,140 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="共模作业组编码" :labelWidth='80' name="shareMouldJobGroupCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" type="text"
v-model="formData.shareMouldJobGroupCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="共模组编码" :labelWidth='80' name="shareMouldGroupCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar2"
v-model="formData.shareMouldGroupCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="模具编码" :labelWidth='80' name="mouldUuid">
<uni-easyinput type="text" v-model="formData.mouldUuid" @focus="show=!show" />
<u-picker :show="show" @cancel="showClose" @close="showClose" closeOnClickOverlay
:columns="mouldUuidList" @confirm="showConfirm" keyName="label">
</u-picker>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="备注" :labelWidth='80' name="remark">
<uni-easyinput type="textarea" v-model="formData.remark" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listMesMouldShareGroup,
getMesMouldShareGroup,
delMesMouldShareGroup,
addMesMouldShareGroup,
updateMesMouldShareGroup,
listMould
} from "@/api/mes/mouldShareGroup";
export default {
data() {
return {
mouldUuidList: [],
show: false,
formData: {
shareMouldJobGroupCode: null,
shareMouldGroupCode: null,
mouldUuid: null,
mouldCode: null,
remark: null,
type: null,
status: 0,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
delStatus: "0"
},
rules: {
shareMouldJobGroupCode: {
rules: [{
required: true,
errorMessage: '请输入共模作业组编码!'
}]
},
// shareMouldGroupCode: {
// rules: [{
// required: true,
// errorMessage: '请输入共模组编码!'
// }]
// }
},
}
},
mounted() {
listMould().then(res => {
this.mouldUuidList.push(res.rows.map(item => {
item.label = item.mouldUuid + ':' + item.mouldName;
return item
}))
})
},
methods: {
showConfirm(e) {
console.log(e)
this.formData.mouldCode = e.value[0].mouldCode;
this.formData.mouldUuid = e.value[0].mouldUuid;
this.show = false
},
showClose() {
this.show = false
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定添加该共模作业组吗?',
success: function(res) {
if (res.confirm) {
_this.$modal.loading('提交中')
addMesMouldShareGroup(_this.formData).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("添加共模作业组成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
}
})
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.shareMouldJobGroupCode = res.result;
}
});
},
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.shareMouldGroupCode = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,299 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="共模作业组单" :open="true">
<uni-forms-item label="共模作业组编码" :labelWidth='80' name="shareMouldJobGroupCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" type="text"
v-model="formData.shareMouldJobGroupCode" />
</uni-forms-item>
<uni-forms-item label="共模组编码" :labelWidth='80' name="shareMouldGroupCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar2"
v-model="formData.shareMouldGroupCode" />
</uni-forms-item>
<uni-forms-item label="模具编码" :labelWidth='80' name="mouldUuid">
<uni-easyinput type="text" v-model="formData.mouldUuid" @focus="showmould=!showmould" />
<u-picker :show="showmould" @cancel="showmouldClose" @close="showmouldClose" closeOnClickOverlay
:columns="mouldUuidList" @confirm="showmouldConfirm" keyName="label">
</u-picker>
</uni-forms-item>
<uni-row :gutter="20">
<uni-col :span="12" style="text-align: center;">
<button type="primary" size="mini" @click="addDetail">添加</button>
</uni-col>
<uni-col :span="12" style="text-align: center;">
<button type="success" size="mini" @click="reset">重置</button>
</uni-col>
</uni-row>
</uni-collapse-item>
<uni-collapse-item title="共模作业组单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.mesMouldShareGroupDetailList"
@click="(data) => clickDetail(index,data)">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-card :is-shadow="false" is-full>
<div><strong>作业</strong>:{{item.jobCode}}</div>
<div><strong>制程序号</strong>:{{item.opNo}}</div>
<div><strong>制程编码</strong>:{{item.opCode}}</div>
<div><strong>目标产品</strong>:{{item.ptNoTar}}</div>
<div><strong>生产版本</strong>:{{item.productionVersion}}</div>
<div><strong>单模产出数量</strong>:{{item.singleMouldNum}}</div>
<div><strong>备注</strong>:{{item.remark}}</div>
</uni-card>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
<u-popup :show="show" @close="close">
<div style="min-height: 50vh;">
<div style="font-size: 16px;color:#606266; margin-top: 10px;">作业编码</div>
<uni-easyinput style="margin-top: 10px;" suffixIcon="scan" @iconClick="scanBar1" type="text" focus
v-model="jobCode" @confirm="scanBarJobCode" />
<uni-card :is-shadow="false" is-full v-for="item in jobList" :key="item.id" :border="false">
<div><strong>制程序号</strong>:{{item.opNo}}</div>
<div><strong>制程编码</strong>:{{item.opCode}}</div>
<div><strong>目标产品</strong>:{{item.ptNoTar}}</div>
<div><strong>生产版本</strong>:{{item.productionVersion}}</div>
<div><strong>单模产出数量</strong>:<u-number-box button-size="36" inputWidth="120"
v-model="item.singleMouldNum" min="0"></u-number-box></div>
<div><strong>备注</strong>:<uni-easyinput type="textarea" v-model="item.remark" /></div>
</uni-card>
<u-button type="primary" v-show="jobList.length>0" @click="pickJob">选中</u-button>
</div>
</u-popup>
</view>
</template>
<script>
import {
listMesMouldShareGroupDetail,
getMesMouldShareGroupDetail,
addMesMouldShareGroupDetail,
updateMesMouldShareGroupDetail,
delMesMouldShareGroupDetail
} from "@/api/mes/mouldShareGroupDetail";
import {
listMesMouldShareGroup,
getMesMouldShareGroup,
delMesMouldShareGroup,
addMesMouldShareGroup,
updateMesMouldShareGroup,
listMould
} from "@/api/mes/mouldShareGroup";
import {
listPwoJob
} from "@/api/mes/jobReport.js";
export default {
mounted() {
listMould().then(res => {
this.mouldUuidList.push(res.rows.map(item => {
item.label = item.mouldUuid + ':' + item.mouldName;
return item
}))
})
},
data() {
return {
mouldUuidList: [],
show: false,
jobList: [],
showmould: false,
jobCode: null,
formData: {
id: null,
shareMouldJobGroupCode: null,
shareMouldGroupCode: null,
mesMouldShareGroupDetailList: [],
},
oldmesMouldShareGroupDetailList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
shareMouldJobGroupCode: {
rules: [{
required: true,
errorMessage: '请输入共模作业组编码!'
}]
},
}
}
},
methods: {
showmouldConfirm(e) {
console.log(e)
this.formData.mouldCode = e.value[0].mouldCode;
this.formData.mouldUuid = e.value[0].mouldUuid;
this.showmould = false
},
showmouldClose() {
this.showmould = false
},
reset() {
this.formData.mesMouldShareGroupDetailList = this.oldmesMouldShareGroupDetailList;
},
deleteDetail(index) {
this.formData.mesMouldShareGroupDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
close() {
this.jobCode = null;
this.jobList = [];
this.show = false;
},
scanBarCode() {
if (this.formData.shareMouldJobGroupCode) {
let obj = {
shareMouldJobGroupCode: this.formData.shareMouldJobGroupCode
}
listMesMouldShareGroup(obj).then(async res => {
if (res.rows.length != 0) {
this.formData = res.rows[0];
listMesMouldShareGroupDetail({
shareMouldJobGroupId: this.formData.id
}).then(async res => {
if (res.rows.length != 0) {
this.oldmesMouldShareGroupDetailList = res.rows;
this.$set(this.formData, 'mesMouldShareGroupDetailList', [...
res.rows
])
} else {
this.formData.mesMouldShareGroupDetailList = [];
this.$modal.msg("该共模作业组查无明细!");
}
});
} else {
this.$modal.msg("未查到该共模作业组!");
}
})
} else {
this.$modal.msg("请输入共模作业组编码!");
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.shareMouldJobGroupCode = res.result;
_this.scanBarCode();
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.pwoCode = res.result;
_this.scanBarPwoCode();
}
});
},
addcancel() {
this.addshow = false;
},
pickJob() {
const _this = this;
if (_this.jobList.length > 0) {
if (_this.formData.id && _this.formData.shareMouldJobGroupCode && _this.jobList[0].singleMouldNum) {
let obj = {
shareMouldJobGroupCode: _this.formData.shareMouldJobGroupCode,
shareMouldJobGroupId: _this.formData.id,
jobId: _this.jobList[0].id,
jobCode: _this.jobList[0].code,
opCode: _this.jobList[0].opCode,
opNo: _this.jobList[0].opNo,
ptNoTar: _this.jobList[0].ptNoTar,
productionVersion: _this.jobList[0].productionVersion,
singleMouldNum: _this.jobList[0].singleMouldNum,
status: 0
}
addMesMouldShareGroupDetail(obj).then(async res => {
_this.$modal.msgSuccess("添加共模作业组明细成功!");
_this.scanBarCode();
_this.jobCode = null;
_this.jobList = [];
_this.show = false;
});
} else {
_this.$modal.msg("请先输入共模作业组编码并查询明细!")
}
} else {
_this.$modal.msg("请先输入作业编码并查询!")
}
},
scanBarJobCode() {
if (this.jobCode) {
let obj = {
code: this.jobCode
}
listPwoJob(obj).then(res => {
if (res.rows.length > 0) {
this.jobList = res.rows
} else {
this.$modal.msg("未找到该作业!")
}
});
}
},
addDetail() {
if (this.formData.shareMouldJobGroupCode && this.formData.shareMouldJobGroupCode != '' && this.formData
.id) {
this.show = true;
} else {
this.$modal.msg("请先输入共模作业组编码并查询明细!")
}
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定修改该共模作业组吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.id && _this.formData.shareMouldJobGroupCode) {
console.log(_this.formData)
_this.$modal.loading('提交中')
updateMesMouldShareGroup(_this.formData).then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("修改共模作业组成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
} else {
_this.$modal.msg("请先输入共模作业组编码并查询明细!")
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
}
}
}
</script>
<style>
</style>

Some files were not shown because too many files have changed in this diff Show More