初始化仓库
This commit is contained in:
179
pages/mes/jobCv/jobBindEqp.vue
Normal file
179
pages/mes/jobCv/jobBindEqp.vue
Normal 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>
|
||||
423
pages/mes/jobCv/jobIn - 副本.vue
Normal file
423
pages/mes/jobCv/jobIn - 副本.vue
Normal 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
436
pages/mes/jobCv/jobIn.vue
Normal 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>
|
||||
86
pages/mes/jobCv/pieceIn.vue
Normal file
86
pages/mes/jobCv/pieceIn.vue
Normal 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>
|
||||
83
pages/mes/jobCv/pieceReport.vue
Normal file
83
pages/mes/jobCv/pieceReport.vue
Normal 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>
|
||||
355
pages/mes/jobCv/pieceReportOper/index.vue
Normal file
355
pages/mes/jobCv/pieceReportOper/index.vue
Normal 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>制  程:{{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>
|
||||
111
pages/mes/jobCv/pwoClose.vue
Normal file
111
pages/mes/jobCv/pwoClose.vue
Normal 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
208
pages/mes/jobCv/pwoDraw.vue
Normal 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
152
pages/mes/jobCv/pwoIn.vue
Normal 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>
|
||||
441
pages/mes/jobCv/pwoSearch.vue
Normal file
441
pages/mes/jobCv/pwoSearch.vue
Normal 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>
|
||||
271
pages/mes/jobCv/pwoWarehousing.vue
Normal file
271
pages/mes/jobCv/pwoWarehousing.vue
Normal 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>
|
||||
102
pages/mes/jobCv/stockConvertion.vue
Normal file
102
pages/mes/jobCv/stockConvertion.vue
Normal 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>
|
||||
281
pages/mes/jobCv/transfer/from.vue
Normal file
281
pages/mes/jobCv/transfer/from.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<view id="view">
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>工  单:</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>总 数 量 :</td><td>{{from.body.num}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>部  门:</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>总 数 量 :</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>
|
||||
167
pages/mes/jobCv/transfer/index.vue
Normal file
167
pages/mes/jobCv/transfer/index.vue
Normal 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>
|
||||
108
pages/mes/jobCv/transfer/table.vue
Normal file
108
pages/mes/jobCv/transfer/table.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view>
|
||||
<div v-for="(item,index) in data" :key="index">
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>工  单:</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>总 数 量 </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>
|
||||
239
pages/mes/jobQuality/jobQuality.vue
Normal file
239
pages/mes/jobQuality/jobQuality.vue
Normal 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>
|
||||
343
pages/mes/jobReport/defect.vue
Normal file
343
pages/mes/jobReport/defect.vue
Normal 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>
|
||||
81
pages/mes/jobReport/index.vue
Normal file
81
pages/mes/jobReport/index.vue
Normal 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>
|
||||
323
pages/mes/jobReport/loss.vue
Normal file
323
pages/mes/jobReport/loss.vue
Normal 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>
|
||||
527
pages/mes/jobReport/onceReport.vue
Normal file
527
pages/mes/jobReport/onceReport.vue
Normal 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>
|
||||
315
pages/mes/jobReport/pass.vue
Normal file
315
pages/mes/jobReport/pass.vue
Normal 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>
|
||||
710
pages/mes/jobReport/pipelineReport.vue
Normal file
710
pages/mes/jobReport/pipelineReport.vue
Normal 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>
|
||||
445
pages/mes/jobReport/pwoReport.vue
Normal file
445
pages/mes/jobReport/pwoReport.vue
Normal 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>
|
||||
345
pages/mes/jobReport/scrap.vue
Normal file
345
pages/mes/jobReport/scrap.vue
Normal 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>
|
||||
535
pages/mes/jobReport/shiftTaskReport.vue
Normal file
535
pages/mes/jobReport/shiftTaskReport.vue
Normal 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>
|
||||
292
pages/mes/jobReport/start.vue
Normal file
292
pages/mes/jobReport/start.vue
Normal 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>
|
||||
182
pages/mes/mesJobSingleReportSign/inEnsure.vue
Normal file
182
pages/mes/mesJobSingleReportSign/inEnsure.vue
Normal 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>
|
||||
111
pages/mes/mesJobSingleReportSign/inFailRecord.vue
Normal file
111
pages/mes/mesJobSingleReportSign/inFailRecord.vue
Normal 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>
|
||||
136
pages/mes/mesJobSingleReportSign/inQuery.vue
Normal file
136
pages/mes/mesJobSingleReportSign/inQuery.vue
Normal 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>
|
||||
219
pages/mes/mesJobSingleReportSign/notInQuery.vue
Normal file
219
pages/mes/mesJobSingleReportSign/notInQuery.vue
Normal 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>
|
||||
161
pages/mes/mesJobSingleReportSign/qualityEnsure.vue
Normal file
161
pages/mes/mesJobSingleReportSign/qualityEnsure.vue
Normal 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>
|
||||
173
pages/mes/mesJobSingleReportSign/reportContEnsure.vue
Normal file
173
pages/mes/mesJobSingleReportSign/reportContEnsure.vue
Normal 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>
|
||||
157
pages/mes/mesJobSingleReportSign/reportEnsure.vue
Normal file
157
pages/mes/mesJobSingleReportSign/reportEnsure.vue
Normal 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>
|
||||
98
pages/mes/mesJobSingleReportSign/reportFailRecord.vue
Normal file
98
pages/mes/mesJobSingleReportSign/reportFailRecord.vue
Normal 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>
|
||||
131
pages/mes/mesJobSingleReportSign/statusQuery.vue
Normal file
131
pages/mes/mesJobSingleReportSign/statusQuery.vue
Normal 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>
|
||||
140
pages/mes/mouldShareGroup/addMouldShareGroup.vue
Normal file
140
pages/mes/mouldShareGroup/addMouldShareGroup.vue
Normal 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>
|
||||
299
pages/mes/mouldShareGroup/addMouldShareGroupDetail.vue
Normal file
299
pages/mes/mouldShareGroup/addMouldShareGroupDetail.vue
Normal 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>
|
||||
100
pages/mes/productSuit/addSuit.vue
Normal file
100
pages/mes/productSuit/addSuit.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="套装编码" :labelWidth='80' name="suitCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.suitCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="套装名称" :labelWidth='80' name="suitName">
|
||||
<uni-easyinput type="text" v-model="formData.suitName" />
|
||||
</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 {
|
||||
listMesProductSuit,
|
||||
getMesProductSuit,
|
||||
delMesProductSuit,
|
||||
addMesProductSuit,
|
||||
updateMesProductSuit
|
||||
} from "@/api/mes/productSuit";
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
suitCode: null,
|
||||
suitName: null,
|
||||
remark: null,
|
||||
type: null,
|
||||
status: 0,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delStatus: "0"
|
||||
},
|
||||
rules: {
|
||||
suitCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入套装编码!'
|
||||
}]
|
||||
},
|
||||
suitName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入套装名称!'
|
||||
}]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定添加该套装吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// cons
|
||||
_this.$modal.loading('提交中')
|
||||
addMesProductSuit(_this.formData).then(res => {
|
||||
_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.formData.suitCode = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
313
pages/mes/productSuit/addSuitDetail.vue
Normal file
313
pages/mes/productSuit/addSuitDetail.vue
Normal file
@@ -0,0 +1,313 @@
|
||||
<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="suitCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" type="text"
|
||||
v-model="formData.suitCode" />
|
||||
</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.mesProductSuitDetailList"
|
||||
@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.materialCode}}</div>
|
||||
<div><strong>物料名称</strong>:{{item.materialName}}</div>
|
||||
<div><strong>批号</strong>:{{item.batchNo}}</div>
|
||||
<div><strong>箱号</strong>:{{item.lotNo}}</div>
|
||||
<div><strong>件号</strong>:{{item.pieceNo}}</div>
|
||||
<div><strong>数量</strong>:{{item.num}}</div>
|
||||
<div><strong>单位</strong>:{{item.unitId}}</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="pwoCode" @confirm="scanBarPwoCode" />
|
||||
<uni-card :is-shadow="false" is-full v-for="item in pwoList" :key="item.id" :border="false">
|
||||
<div><strong>目标产品编码</strong>:{{item.ptNoTar}}</div>
|
||||
<div><strong>目标产品名称</strong>:{{item.ptTitleTar}}</div>
|
||||
<div><strong>批号</strong>:{{item.batchNo}}</div>
|
||||
<div><strong>数量</strong>:{{item.num}}</div>
|
||||
<div><strong>状态</strong>:<uni-tag :text="pwotag(item.status)" type="warning"></uni-tag></div>
|
||||
</uni-card>
|
||||
<u-button type="primary" v-show="pwoList.length>0" @click="pickPwo">选中</u-button>
|
||||
</div>
|
||||
|
||||
</u-popup>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listMesProductSuitDetail,
|
||||
getMesProductSuitDetail,
|
||||
delMesProductSuitDetail,
|
||||
addMesProductSuitDetail,
|
||||
updateMesProductSuitDetail
|
||||
} from "@/api/mes/productSuitDetail";
|
||||
import {
|
||||
getPwo,
|
||||
listPwo,
|
||||
pwoAtificialClose,
|
||||
handleIn,
|
||||
listCirculateBalance
|
||||
} from "@/api/mes/pwoDraw.js";
|
||||
import {
|
||||
listMesProductSuit,
|
||||
getMesProductSuit,
|
||||
delMesProductSuit,
|
||||
addMesProductSuit,
|
||||
updateMesProductSuit
|
||||
} from "@/api/mes/productSuit";
|
||||
export default {
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
pwoList: [],
|
||||
show: false,
|
||||
pwoCode: null,
|
||||
formData: {
|
||||
id: null,
|
||||
suitCode: null,
|
||||
mesProductSuitDetailList: [],
|
||||
},
|
||||
oldmesProductSuitDetailList: [],
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
suitCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入套装编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
this.formData.mesProductSuitDetailList = this.oldmesProductSuitDetailList;
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.formData.mesProductSuitDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.pwoCode = null;
|
||||
this.pwoList = [];
|
||||
this.show = false;
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.suitCode) {
|
||||
let obj = {
|
||||
suitCode: this.formData.suitCode
|
||||
}
|
||||
listMesProductSuit(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.id = res.rows[0].id;
|
||||
listMesProductSuitDetail({
|
||||
suitId: this.formData.id
|
||||
}).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.oldmesProductSuitDetailList = res.rows;
|
||||
this.formData.mesProductSuitDetailList = [...res.rows]
|
||||
} else {
|
||||
this.formData.mesProductSuitDetailList = [];
|
||||
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.suitCode = 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;
|
||||
},
|
||||
pickPwo() {
|
||||
const _this = this;
|
||||
if (_this.pwoList.length > 0) {
|
||||
|
||||
if (_this.formData.id && _this.formData.suitCode) {
|
||||
|
||||
let obj = {
|
||||
suitId: _this.formData.id,
|
||||
suitCode: _this.formData.suitCode,
|
||||
materialCode: _this.pwoList[0].ptNoTar,
|
||||
materialName: _this.pwoList[0].ptTitleTar,
|
||||
batchNo: _this.pwoList[0].batchNo,
|
||||
num: _this.pwoList[0].planNum
|
||||
}
|
||||
addMesProductSuitDetail(obj).then(async res => {
|
||||
_this.$modal.msgSuccess("添加套装明细成功!");
|
||||
_this.scanBarCode();
|
||||
_this.pwoCode = null;
|
||||
_this.pwoList = [];
|
||||
_this.show = false;
|
||||
});
|
||||
} else {
|
||||
_this.$modal.msg("请先输入套装编码并查询明细!")
|
||||
}
|
||||
} else {
|
||||
_this.$modal.msg("请先输入工单并查询!")
|
||||
}
|
||||
},
|
||||
scanBarPwoCode() {
|
||||
if (this.pwoCode) {
|
||||
let obj = {
|
||||
pwoCode: this.pwoCode
|
||||
}
|
||||
listPwo(obj).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.pwoList = res.rows
|
||||
} else {
|
||||
this.$modal.msg("未找到该工单!")
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
addDetail() {
|
||||
if (this.formData.suitCode && this.formData.suitCode != '' && this.formData.id) {
|
||||
this.show = true;
|
||||
} else {
|
||||
this.$modal.msg("请先输入套装编码并查询明细!")
|
||||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
},
|
||||
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.suitCode) {
|
||||
_this.$modal.loading('提交中')
|
||||
updateMesProductSuitDetail(_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>
|
||||
129
pages/mes/pwoRecord/badRecord.vue
Normal file
129
pages/mes/pwoRecord/badRecord.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<uni-card :is-shadow="false" is-full>
|
||||
<h2 style="margin-bottom: 10px;">报工信息</h2>
|
||||
<view><strong>工单编码:</strong>{{formData.pwoCode}}</view>
|
||||
<view><strong>作业编码:</strong>{{formData.pwoJobCode}}</view>
|
||||
<view><strong>物料编码:</strong>{{formData.ptNoTar}}</view>
|
||||
<view><strong>物料名称:</strong>{{formData.ptTitleTar}}</view>
|
||||
<view><strong>物料规格:</strong>{{formData.specification1}}</view>
|
||||
<view><strong>制程:</strong>{{formData.opCode+':'+formData.opTitle}}</view>
|
||||
<view><strong>设备编码:</strong>{{formData.eqpCode}}</view>
|
||||
<view><strong>报工数量:</strong>{{formData.reportNumber}}</view>
|
||||
<view><strong>加工人员:</strong>{{formData.createByName}}</view>
|
||||
<view><strong>报工时间:</strong>{{formData.reportcreateTime}}</view>
|
||||
<h2 style="margin-top: 10px;">不良原因</h2>
|
||||
<view v-for="item in reasonOptions">
|
||||
<uni-row style="margin-top: 10px;">
|
||||
<uni-col :span="12">
|
||||
<span>{{item.defectReason}}</span>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<u-number-box button-size="36" inputWidth="120" v-model="item.number" min="0"></u-number-box>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</uni-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
import {
|
||||
listMesPwoRecordrecord,
|
||||
getMesPwoRecordrecord,
|
||||
delMesPwoRecordrecord,
|
||||
addMesPwoRecordrecord,
|
||||
updateMesPwoRecordrecord
|
||||
} from "@/api/mes/mesPwoRecordrecord";
|
||||
import {
|
||||
listMesPwoRecordDetail,
|
||||
getMesPwoRecordDetail,
|
||||
delMesPwoRecordDetail,
|
||||
addMesPwoRecordDetail,
|
||||
updateMesPwoRecordDetail,
|
||||
} from "@/api/mes/mesPwoRecordDetail";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
getDicts("mes_pwo_record_defect_reason").then(res => {
|
||||
this.reasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
defectReason: dict.dictLabel,
|
||||
number: 0,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
listEmployee().then(res => {
|
||||
this.empList = res.rows
|
||||
});
|
||||
if (option) {
|
||||
this.formData = JSON.parse(decodeURIComponent(
|
||||
option.reportForm));
|
||||
console.log(this.formData)
|
||||
// this.formData = option.badRecord
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
empList: [],
|
||||
reasonOptions: [],
|
||||
formData: {
|
||||
pwoCode: null,
|
||||
pwoJobCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
specification1: null,
|
||||
reportNumber: null,
|
||||
createByName: null,
|
||||
createTime: null,
|
||||
eqpCode: null,
|
||||
qualityCode: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.reasonOptions.filter(item => item.number > 0).map(item => {
|
||||
item.ptNoTar = this.formData.ptNoTar.split("@")[0];
|
||||
item.ptTitleTar = this.formData.ptTitleTar.split("@")[0];
|
||||
item.pwoCode = this.formData.pwoCode;
|
||||
item.opCode = this.formData.opCode;
|
||||
item.pwoJobCode = this.formData.pwoJobCode;
|
||||
item.specification1 = this.formData.specification1;
|
||||
item.eqpCode = this.formData.eqpCode;
|
||||
let obj = this.empList.find(obj => obj.name == this.formData.createByName)
|
||||
if (obj) {
|
||||
item.empCode = obj.empCode
|
||||
}
|
||||
item.dateTime = this.formData.reportcreateTime;
|
||||
return item
|
||||
})
|
||||
addMesPwoRecordrecord({
|
||||
pwoRecordName: '不良记录单',
|
||||
relOrderCode: this.formData.qualityCode
|
||||
}).then(res => {
|
||||
for (var i in this.reasonOptions) {
|
||||
this.reasonOptions[i] = JSON.stringify(this.reasonOptions[i])
|
||||
addMesPwoRecordDetail({
|
||||
pwoRecordCode: res.data.pwoRecordCode,
|
||||
pwoRecordId: res.data.id,
|
||||
dataInfo: this.reasonOptions[i]
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("新增成功!");
|
||||
}).catch(() => {});
|
||||
}
|
||||
this.$tab.navigateBack();
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
107
pages/mes/pwoRecord/badRecordList.vue
Normal file
107
pages/mes/pwoRecord/badRecordList.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData">
|
||||
<uni-collapse-item title="不良记录单" :open="true">
|
||||
<uni-forms-item label="记录单编码" :labelWidth='90' name="pwoRecordCode">
|
||||
<uni-easyinput v-model="formData.pwoRecordCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="记录单名称" :labelWidth='90' name="pwoRecordName">
|
||||
<uni-easyinput v-model="formData.pwoRecordName" />
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="不良记录单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :key="index" v-for="(item, index) in formData.mesPwoRecordDetailList">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="作业编码" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.pwoJobCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修工单" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.pwoCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="制程" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.opCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修产品编码" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修产品名称" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料规格" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.specification1" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="记录人员" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.empCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="不良原因" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.defectReason" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修数量" :labelWidth='90'>
|
||||
<uni-easyinput type="number" v-model="item.dataInfo.number" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修时间" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.dateTime" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.dataInfo.eqpCode" />
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listMesPwoRecordrecord,
|
||||
getMesPwoRecordrecord,
|
||||
delMesPwoRecordrecord,
|
||||
addMesPwoRecordrecord,
|
||||
updateMesPwoRecordrecord
|
||||
} from "@/api/mes/mesPwoRecordrecord";
|
||||
import {
|
||||
listMesPwoRecordDetail,
|
||||
getMesPwoRecordDetail,
|
||||
delMesPwoRecordDetail,
|
||||
addMesPwoRecordDetail,
|
||||
updateMesPwoRecordDetail,
|
||||
} from "@/api/mes/mesPwoRecordDetail";
|
||||
export default {
|
||||
onLoad(option) {
|
||||
this.formData = JSON.parse(option.formData);
|
||||
console.log(this.formData)
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pwoRecordCode: null,
|
||||
pwoRecordName: null,
|
||||
mesPwoRecordDetailList: []
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
for (var i in this.formData.mesPwoRecordDetailList) {
|
||||
this.formData.mesPwoRecordDetailList[i].dataInfo = JSON.stringify(this.formData.mesPwoRecordDetailList[
|
||||
i].dataInfo);
|
||||
updateMesPwoRecordDetail(this.formData.mesPwoRecordDetailList[i]).then(res => {
|
||||
this.$modal.msgSuccess("修改成功!");
|
||||
})
|
||||
this.formData.mesPwoRecordDetailList[i].dataInfo = JSON.parse(this.formData.mesPwoRecordDetailList[
|
||||
i].dataInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
459
pages/mes/pwoRecord/pwoRecordAdd.vue
Normal file
459
pages/mes/pwoRecord/pwoRecordAdd.vue
Normal file
@@ -0,0 +1,459 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-collapse-item title="不良记录单新增" :open="true">
|
||||
<uni-forms-item label="记录单编码" :labelWidth='90' name="pwoRecordCode">
|
||||
<uni-easyinput v-model="formData.pwoRecordCode" type="text" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="记录单名称" :labelWidth='90' name="pwoRecordName">
|
||||
<uni-easyinput v-model="formData.pwoRecordName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="不良原因" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item v-for="(item, index) in dataList" :key="index"
|
||||
:rightOptions="rightOptions" @click="(data) => clickDetail(index,data)">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="作业编码" :labelWidth='90'>
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwoJobCode(index)"
|
||||
@confirm="confirmPwoJobCode(index)" type="text" v-model="item.pwoJobCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修工单" :labelWidth='90'>
|
||||
{{item.pwoCode}}
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="制程" :labelWidth='90'>
|
||||
{{item.opCode?(item.opCode+':'+item.opTitle):''}}
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修产品编码" :labelWidth='90'>
|
||||
{{item.ptNoTar}}
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修产品名称" :labelWidth='90'>
|
||||
{{item.ptTitleTar}}
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料规格" :labelWidth='90'>
|
||||
{{item.specification1}}
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="记录人员" :labelWidth='90'>
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarEmpCode(index)"
|
||||
v-model="item.empCode" @confirm="(data) => isEmp(index,data)" />
|
||||
<uni-data-picker popup-title="请选择记录人员" :localdata="dataTree"
|
||||
@change="(e) => onchange(e, index)" @nodeclick="(e) => onnodeclick(e, index)"
|
||||
@popupopened="onpopupopened" @popupclosed="onpopupclosed" style="margin-top: 5px;"
|
||||
:preload="true">
|
||||
</uni-data-picker>
|
||||
<!-- <uni-data-select style="margin-top: 10px;" v-model="item.empCode"
|
||||
@change="(data) => selectEmp(index,data)" :localdata="empList"></uni-data-select> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="不良原因" :labelWidth='90' name="defectReason">
|
||||
<uni-data-select style="margin-top: 10px;" v-model="item.defectReason"
|
||||
:localdata="reasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修数量" :labelWidth='90' name="number">
|
||||
<u-number-box button-size="36" inputWidth="120" v-model="item.number"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="用时" :labelWidth='90'>
|
||||
<uni-easyinput type="number" v-model="item.timeTake" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="维修时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="item.dateTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备" :labelWidth='90'>
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarEqpCode(index)"
|
||||
@confirm="(data) => isEqp(index,data)" type="text" v-model="item.eqpCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth='90'>
|
||||
<uni-easyinput autoHeight type="textarea" v-model="item.remark"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
<button @click="handleAddDataList" size="mini" type="primary" plain="true"
|
||||
style="text-align: center;font-size: 18px;width: 50%;margin-bottom: 10px;display: block;margin-top: 10px;"
|
||||
v-if="formData.pwoRecordId">添加</button>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<uni-row :gutter="10">
|
||||
<uni-col :span="12">
|
||||
<u-button type="success" @click="savesubmit" :disabled="formData.pwoRecordId">保存</u-button>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<u-button type="primary" :disabled="!formData.pwoRecordId" @click="submit">提交</u-button>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listMesPwoRecordrecord,
|
||||
getMesPwoRecordrecord,
|
||||
delMesPwoRecordrecord,
|
||||
addMesPwoRecordrecord,
|
||||
updateMesPwoRecordrecord
|
||||
} from "@/api/mes/mesPwoRecordrecord";
|
||||
import {
|
||||
listMesPwoRecordDetail,
|
||||
getMesPwoRecordDetail,
|
||||
delMesPwoRecordDetail,
|
||||
addMesPwoRecordDetail,
|
||||
updateMesPwoRecordDetail,
|
||||
} from "@/api/mes/mesPwoRecordDetail";
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportEnterPiece,
|
||||
listEquipment
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
listDepartment
|
||||
} from "@/api/basic/department";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
getDicts("mes_pwo_record_defect_reason").then(res => {
|
||||
this.reasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictLabel,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
listEmployee().then((res) => {
|
||||
this.empList = res.rows
|
||||
})
|
||||
listDepartment().then((res) => {
|
||||
this.dptList = res.rows
|
||||
})
|
||||
},
|
||||
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
reasonOptions: [],
|
||||
item: '',
|
||||
dataTree: [],
|
||||
pickerData: '',
|
||||
dptList: [],
|
||||
empList: [],
|
||||
formData: {
|
||||
pwoRecordCode: null,
|
||||
pwoRecordName: '不良记录单',
|
||||
},
|
||||
dataList: [],
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
formData: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入记录单名称!'
|
||||
}]
|
||||
},
|
||||
// rulesName:{
|
||||
// rules:[{
|
||||
// required:true,
|
||||
// errorMessage: '请输入记录人员!'
|
||||
// }]
|
||||
// },
|
||||
// defectReason:{
|
||||
// rules:[{
|
||||
// required:true,
|
||||
// errorMessage: '请输入记录不良原因!'
|
||||
// }]
|
||||
// },
|
||||
// number:{
|
||||
// rules:[{
|
||||
// required:true,
|
||||
// errorMessage: '请输入数量!'
|
||||
// }]
|
||||
// },
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 防抖函数
|
||||
debounce(fn, delay) {
|
||||
let timer = null; // 声明一个定时器
|
||||
return function(...args) { // 返回一个函数,它接收函数的参数
|
||||
if (timer) {
|
||||
clearTimeout(timer); // 如果定时器存在,清除它
|
||||
}
|
||||
timer = setTimeout(() => { // 设置一个新的定时器
|
||||
fn.apply(this, args); // 执行原函数
|
||||
}, delay);
|
||||
}
|
||||
},
|
||||
|
||||
selectEmp(i, e) {
|
||||
this.dataList[i].empName = this.empList.find(item => item.value == e).text
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.dataList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
onnodeclick(e, index) {
|
||||
console.log(e);
|
||||
this.item = e;
|
||||
this.onchange(this.item, index); // 传递 e 和 index 给 onchange 方法
|
||||
},
|
||||
|
||||
onpopupopened(e) {
|
||||
this.dataTree = []
|
||||
|
||||
this.empList.filter(item => item.deptId).forEach(item => {
|
||||
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
|
||||
// 检查dataTree中是否已存在相同部门
|
||||
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
|
||||
if (existingDept) {
|
||||
// 如果已存在相同部门,则将员工信息push进该部门的children数组
|
||||
existingDept.children.push({
|
||||
text: item.name,
|
||||
value: item.empCode
|
||||
});
|
||||
} else {
|
||||
// 如果不存在相同部门,则创建一个新部门对象,包括children数组,并将员工信息push进去
|
||||
let newDept = {
|
||||
text: item.departmentTitle,
|
||||
value: item.deptId,
|
||||
children: [{
|
||||
text: item.name,
|
||||
value: item.empCode
|
||||
}]
|
||||
};
|
||||
this.dataTree.push(newDept);
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
onpopupclosed() {
|
||||
//处理不同步
|
||||
// this.$nextTick(() => {
|
||||
// this.pickerData = this.item.value;
|
||||
// this.formData.pickerData = this.item.value;
|
||||
// if (!this.item) return
|
||||
// this.onchange(this.item)
|
||||
// });
|
||||
},
|
||||
onchange(e, index) {
|
||||
console.log(e)
|
||||
this.dataList[index].empCode = null
|
||||
this.$set(this.dataList[index], 'empCode', e.value.split('/')[0]);
|
||||
},
|
||||
scanBarPwoJobCode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
// _this.$set(_this.dataList[i], "pwoJobCode", res
|
||||
// .result);
|
||||
_this.dataList[i].pwoJobCode = res.result;
|
||||
_this.confirmPwoJobCode(i);
|
||||
}
|
||||
});
|
||||
},
|
||||
confirmPwoJobCode(i) {
|
||||
listPwoJob({
|
||||
code: this.dataList[i].pwoJobCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.dataList[i].pwoCode = res.rows[0].pwoCode;
|
||||
this.dataList[i].opCode = res.rows[0].opCode;
|
||||
this.dataList[i].opTitle = res.rows[0].opTitle;
|
||||
this.dataList[i].ptNoTar = res.rows[0].ptNoTar.split("@")[0];
|
||||
this.dataList[i].ptTitleTar = res.rows[0].ptTitleTar.split("@")[0];
|
||||
this.dataList[i].specification1 = res.rows[0].specification1;
|
||||
if (res.rows[0].eqpId) {
|
||||
getEquipment(res.rows[0].eqpId).then(resp => {
|
||||
if (resp.data) {
|
||||
this.dataList[i].eqpCode = resp.data.equipmentCode;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarEmpCode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.dataList[i].empCode = res
|
||||
.result;
|
||||
_this.isEmp(i, res
|
||||
.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
//验证是否为员工
|
||||
isEmp(i, code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(res => {
|
||||
if (res.total == 0) {
|
||||
this.$modal.msg("未查询到该员工!");
|
||||
this.dataList[i].empCode = null;
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarEqpCode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.dataList[i].eqpCode = res
|
||||
.result;
|
||||
_this.isEqp(i, res
|
||||
.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
//验证是否为设备
|
||||
isEqp(i, code) {
|
||||
listEquipment({
|
||||
equipmentCode: code
|
||||
}).then(res => {
|
||||
if (res.total == 0) {
|
||||
this.$modal.msg("未查询到该设备!");
|
||||
this.dataList[i].eqpCode = null;
|
||||
}
|
||||
})
|
||||
},
|
||||
handleAddDataList() {
|
||||
let obj = {}
|
||||
obj.pwoJobCode = null;
|
||||
//目前仅支持合格品
|
||||
obj.pwoCode = null;
|
||||
obj.opCode = null;
|
||||
obj.opTitle = null;
|
||||
obj.ptNoTar = null;
|
||||
obj.ptTitleTar = null;
|
||||
obj.specification1 = null;
|
||||
obj.empCode = null;
|
||||
obj.empName = null;
|
||||
obj.number = null;
|
||||
obj.timeTake = null;
|
||||
obj.dateTime = null;
|
||||
obj.eqpCode = null;
|
||||
this.dataList.push(obj);
|
||||
},
|
||||
savesubmit() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定新增该维修单吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
addMesPwoRecordrecord(_this.formData).then(res => {
|
||||
_this.$modal.msgSuccess("新增成功!");
|
||||
console.log(res.data)
|
||||
_this.formData.pwoRecordCode = res.data.pwoRecordCode;
|
||||
_this.formData.pwoRecordId = res.data.id
|
||||
}).catch(() => {});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
console.log(_this.dataList, this.dataTree, "dataListdataList");
|
||||
_this.dataList.forEach(item => {
|
||||
_this.dataTree.forEach(department => {
|
||||
if (department.children) {
|
||||
department.children.forEach(employee => {
|
||||
if (employee.value === item.empCode) {
|
||||
item.empName = employee.text;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定新增该维修单明细吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let promises = [];
|
||||
|
||||
for (var i in _this.dataList) {
|
||||
if (!_this.dataList[i].pwoCode) {
|
||||
_this.$modal.msg("作业必填!");
|
||||
return;
|
||||
}
|
||||
if (!_this.dataList[i].defectReason) {
|
||||
_this.$modal.msg("不良原因必填!");
|
||||
return;
|
||||
}
|
||||
if (!_this.dataList[i].empCode) {
|
||||
_this.$modal.msg("记录人员必填!");
|
||||
return;
|
||||
}
|
||||
if (!_this.dataList[i].number) {
|
||||
_this.$modal.msg("数量必填!");
|
||||
return;
|
||||
}
|
||||
_this.formData.dataInfo = _this.dataList[i];
|
||||
_this.formData.dataInfo = JSON.stringify(_this.formData.dataInfo);
|
||||
console.log(_this.formData);
|
||||
|
||||
// 将addMesPwoRecordDetail的Promise加入数组
|
||||
promises.push(addMesPwoRecordDetail(_this.formData)
|
||||
.then(() => {
|
||||
_this.$modal.msgSuccess("新增成功!");
|
||||
})
|
||||
.catch(() => {}));
|
||||
}
|
||||
|
||||
// 等所有Promise完成后执行
|
||||
Promise.all(promises).then(() => {
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
debouncedFunction() {
|
||||
return debounce(this.submit, 1500);
|
||||
},
|
||||
debouncedFunction() {
|
||||
return debounce(this.savesubmit, 1500);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user