init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

View File

@@ -0,0 +1,182 @@
<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-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">提交</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: '请输入要切换的设备编号'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
},
],
}
}
}
},
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
View File

@@ -0,0 +1,423 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="上机转入单" :open="true">
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" 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>

View File

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

View File

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

View File

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

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

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

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

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

View File

@@ -0,0 +1,439 @@
<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
} 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('提交中')
listCirculateBalance(obj).then((response) => {
_this.$modal.closeLoading();
_this.pwoJobList = response.rows;
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
submitClose() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定关闭该生产工单吗?',
success: function(res) {
if (res.confirm) {
//判断工单是否能关闭
if (_this.status >= 7) {
_this.$modal.msg("该工单无法关闭!")
} else {
_this.$modal.loading('提交中')
pwoAtificialClose('"' + _this.id + '"').then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("工单关闭成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
report(code) {
uni.navigateTo({
url: '/pages/mes/jobReport/onceReport?code=' + code
});
},
async submitIn() {
this.materialStockList = [];
this.$modal.loading('提交中')
await listStock({
pwoBelongCode: this.formData.pwoCode
}).then((resp) => {
this.$modal.closeLoading();
this.materialStockList = this.materialStockList.concat(resp.rows);
uni.navigateTo({
url: '/pages/mes/jobCv/pwoWarehousing?pwoCode=' + this.formData.pwoCode +
'&materialStockList=' + encodeURIComponent(JSON.stringify(
this.materialStockList))
});
});
// const _this = this;
// this.$refs.form.validate().then(res => {
// uni.showModal({
// title: '提示',
// content: '您确定入库该生产工单吗?',
// success: function(res) {
// if (res.confirm) {
// if (_this.status != 10) {
// console.log(_this.status);
// _this.$modal.msg("该工单不是‘待入库’状态,请重新输入!")
// } else {
// _this.formData.warehouseCode = _this.value
// console.log(_this.formData)
// handleIn(Number(_this.formData.pwoCode.slice(4)), _this.formData
// .warehouseCode).then(res => {
// _this.$modal.msgSuccess("入库成功!");
// setTimeout(() => {
// _this.$tab.switchTab("/pages/work/index");
// }, 500);
// });
// }
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// });
},
}
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card>.cu-item {
margin: 13px 0;
}
</style>

View File

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

View File

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

View File

@@ -0,0 +1,205 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="作业编码" :labelWidth='90' name="code">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.code"
type="text" />
</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";
export default {
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 {
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)
console.log(event)
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++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
// console.log(item)
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uploadImage({
filePath: url
}).then(response => {
uni.showToast({
title: "上传成功",
icon: 'success'
});
console.log(response)
resolve(response.fileName)
});
})
},
// selectQcFlag(e) {
// console.log(e, this.formData.qcFlag)
// },
scanBarCode(code) {
if (code) {
listPwoJob({
code: code
}).then(async res => {
console.log(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(', ');
}
console.log(_this.formData)
_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) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,344 @@
<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,
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.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;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

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

View File

@@ -0,0 +1,324 @@
<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,
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.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;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,400 @@
<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='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="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>
<u-divider :text="'可报工数量:'+reportableNum"></u-divider>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="合格数量" :labelWidth='70' 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='70' 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='70' 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='70' 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='70' 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='70' 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='70' 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">
<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">提交</u-button>
<!-- <u-button type="primary" @click="end">关闭</u-button> -->
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportOnce
} 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')
export default {
onLoad: 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.getOptions();
// this.formData.type = '报废品';
// this.formData.createByName = this.$store.state.user.name;
},
data() {
return {
//判断是否从工单状态页面查询过来
isSearchRoute: false,
lossReasonOptions: [],
scrapReasonOptions: [],
defectReasonOptions: [],
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: 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: {
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() {
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() {
this.$refs.form.validate().then(res => {
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);
console.log(this.formData);
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) {
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.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;
} 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();
}
});
}
}
}
</script>

View File

@@ -0,0 +1,315 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
<uni-easyinput disabled type="text" v-model="formData.machineId" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
<uni-easyinput disabled type="text" v-model="formData.opCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
<uni-easyinput type="number" v-model="formData.timeTake" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
<uni-easyinput disabled type="text" v-model="formData.type" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum"
v-model="formData.reportNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
v-model="formData.createByCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
<uni-easyinput disabled type="text" v-model="formData.createByName" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="是否录入件号" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<view v-show="radio==1">
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text"
v-model="formData.pieceNo" />
</uni-forms-item>
</view>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开工时间" :labelWidth='90'>
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
</view>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportEnterPiece
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.endTime = formattedDate;
this.formData.way = '人工报工';
this.formData.type = '合格品';
if (option) {
this.formData = JSON.parse(decodeURIComponent(option.formData));
this.isPwoRoute = true;
}
},
data() {
return {
isPwoRoute: false,
formData: {
pwoJobCode: null,
pwoCode: null,
ptNoTar: null,
ptTitleTar: null,
machineId: null,
batchNo: null,
createByName: null,
createByCode: null,
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.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;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

@@ -0,0 +1,232 @@
<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='80' name="startPwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text"
v-model="formData.startPwoJobCode" @confirm="scanBarStartCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="结束作业编码" :labelWidth='80' name="endPwoJobCode">
<uni-combox-re labelKey="code" valueKey="id" :candidates="endPwoJobOptions" emptyTips="无"
@input="scanBarEndCode" v-model="formData.endPwoJobCode"></uni-combox-re>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="合格数量" :labelWidth='80' name="passNum">
<u-number-box button-size="36" v-model="formData.passNum" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="缺陷数量" :labelWidth='80' name="defectNum">
<u-number-box button-size="36" v-model="formData.defectNum" min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="报废数量" :labelWidth='80' name="scrapNum">
<u-number-box button-size="36" v-model="formData.scrapNum" min="0"></u-number-box>
</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-row>
</uni-forms>
<uni-card :is-shadow="false" is-full v-for="item in jobList" :key="item.id">
<div><strong>工单</strong>:{{item.pwoCode}}</div>
<div><strong>作业编码</strong>:{{item.code}}</div>
<div><strong>目标产品编码</strong>:{{item.ptNoTar}}</div>
<div><strong>目标产品名称</strong>:{{item.ptTitleTar}}</div>
<div><strong>制程名称</strong>:{{item.opTitle}}</div>
<div><strong>目标数量</strong>:{{item.planNum}}</div>
<div><strong>完成数量</strong>:{{item.finishQty}}</div>
<div><strong>开工状态</strong>:
<uni-tag :text="jobtag(item.status)" type="success"></uni-tag>
</div>
</uni-card>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addPipelineReport
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
import uniComboxRe from "../../../uni_modules/uni-combox/components/uni-combox/uni-combox-re.vue"
export default {
components: {
uniComboxRe
},
data() {
return {
formData: {
startPwoJobCode: null,
endPwoJobCode: null,
startPwoJobId: null,
endPwoJobId: null,
passNum: 0,
defectNum: 0,
scrapNum: 0,
createByName: null,
createByCode: null
},
endPwoJobOptions: [],
pwojobList: [],
jobList: [],
rules: {
startPwoJobCode: {
rules: [{
required: true,
errorMessage: '请输入开始作业编码!'
}]
},
},
}
},
mounted() {
listPwoJob().then((response) => {
this.pwojobList = response.rows;
});
},
methods: {
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;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
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;
}
},
submit() {
this.$refs.form.validate().then(res => {
if (this.jobList.length == 0) {
this.$modal.mesError("没有选择作业!");
} else {
this.$modal.loading('提交中')
addPipelineReport(this.formData).then((resp) => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
}
})
},
scanBarStartCode() {
this.endPwoJobOptions = [];
this.jobList = [];
listPwoJob({
code: this.formData.startPwoJobCode
}).then((response) => {
if (response.total > 0) {
//开始作业的工单id
var pwoId = response.rows[0].pwoId;
//开始作业id
let id = this.formData.startPwoJobId = response.rows[0].id;
for (let item of this.pwojobList) {
if (pwoId == item.pwoId && id > item.id) {
this.endPwoJobOptions.push(item);
}
}
}
});
},
//选择结束作业后表单自动填充作业信息
scanBarEndCode(e) {
var startJobId = this.formData.startPwoJobId;
this.formData.endPwoJobId = e;
this.jobList = [];
if (startJobId == null || e == null || e == "") {
this.jobList = [];
return;
}
for (let item of this.pwojobList) {
if (item.id <= startJobId && item.id >= e) {
this.jobList.push(item);
}
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.startPwoJobCode = res.result;
_this.scanBarStartCode(_this.formData.startPwoJobCode);
}
});
}
}
}
</script>

View File

@@ -0,0 +1,240 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode"
@confirm="scanBarCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="开始作业" :labelWidth='80' name="startPwoJobCode">
<uni-easyinput disabled type="text" v-model="formData.startPwoJobCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="结束作业" :labelWidth='80' name="endPwoJobCode">
<uni-easyinput disabled type="text" v-model="formData.endPwoJobCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="操作员" :labelWidth='80' name="operator">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarOperator" type="text"
v-model="formData.operator" />
</uni-forms-item>
</uni-col>
<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 :key="index" v-for="(item, index) in jobList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="作业编码" :labelWidth='90' :name="'jobList.'+ index +'.code'">
<uni-easyinput type="text" v-model="item.code"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标产品编码" :labelWidth='90' :name="'jobList.'+ index +'.ptNoTar'">
<uni-easyinput type="text" v-model="item.ptNoTar"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标产品名称" :labelWidth='90'
:name="'jobList.'+ index +'.ptTitleTar'">
<uni-easyinput type="text" v-model="item.ptTitleTar"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="制程名称" :labelWidth='90' :name="'jobList.'+ index +'.opTitle'">
<uni-easyinput type="text" v-model="item.opTitle"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="目标数量" :labelWidth='90' :name="'jobList.'+ index +'.planNum'">
<uni-easyinput type="text" v-model="item.planNum"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="完成数量" :labelWidth='90' :name="'jobList.'+ index +'.finishQty'">
<uni-easyinput type="text" v-model="item.finishQty"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
<uni-col :span="24">
<uni-forms-item label="合格数量" :labelWidth='80' name="passNum">
<u-number-box inputWidth="120" button-size="36" v-model="formData.passNum"
min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="不良数量" :labelWidth='80' name="defectNum">
<u-number-box inputWidth="120" button-size="36" v-model="formData.defectNum"
min="0"></u-number-box>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="报废数量" :labelWidth='80' name="scrapNum">
<u-number-box inputWidth="120" button-size="36" v-model="formData.scrapNum"
min="0"></u-number-box>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<!-- <uni-table ref="table" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="100" align="center">作业编码</uni-th>
<uni-th width="150" align="center">产品编码</uni-th>
<uni-th width="50" align="center">数量</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in jobList" :key="index">
<uni-td align="center">{{ item.code }}</uni-td>
<uni-td align="center">{{ item.ptNoTar }}</uni-td>
<uni-td align="center">{{ item.planNum }}</uni-td>
</uni-tr>
</uni-table> -->
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listPwoJob,
addReport,
getEquipment,
addReportOnce,
pwoReport
} from "@/api/mes/jobReport.js";
import {
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
formData: {
pwoJobCode: null,
pwoCode: null,
startPwoJobId: null,
startPwoJobCode: null,
endPwoJobId: null,
endPwoJobCode: null,
operator: null,
passNum: 0,
defectNum: 0,
scrapNum: 0,
},
jobList: [],
rules: {
pwoCode: {
rules: [{
required: true,
errorMessage: '请输入工单!'
}]
},
operator: {
rules: [{
required: true,
errorMessage: '请输入操作员工编码!'
}]
},
passNum: {
rules: [{
required: true,
errorMessage: '请输入合格数量!'
}]
},
defectNum: {
rules: [{
required: true,
errorMessage: '请输入不良数量!'
}]
},
scrapNum: {
rules: [{
required: true,
errorMessage: '请输入报废数量!'
}]
}
// machineId: {
// rules: [
// { required: true, errorMessage:'请输入设备编码!' }
// ]
// },
}
}
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
if (this.jobList.length == 0) {
this.$modal.mesError("没有作业可报工!");
} else {
//员工
let emp = {
empCode: this.formData.operator
}
listEmployee(emp).then(res => {
if (res.rows.length != 0) {
this.formData.operator = res.rows[0].id;
}
this.$modal.loading('提交中')
pwoReport(this.formData).then(resp => {
this.$modal.closeLoading();
this.$modal.msgSuccess("报工成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
})
}
})
},
scanBarCode() {
if (this.formData.pwoCode) {
var queryParams = {
pwoCode: this.formData.pwoCode,
};
listPwoJob(queryParams).then(response => {
// this.pwoJobOptionsDraft = response.rows;
console.log(response);
let total = response.total;
if (total != 0) {
this.jobList = response.rows;
//编码用于前端显示
this.formData.startPwoJobCode = this.jobList[0].code;
this.formData.endPwoJobCode = this.jobList[total - 1].code;
//id用于提交时传回给后端
this.formData.startPwoJobId = this.jobList[0].id;
this.formData.endPwoJobId = this.jobList[total - 1].id;
console.log(this.formData);
} else {
this.jobList = response.rows;
//编码用于前端显示
this.formData.startPwoJobCode = "";
this.formData.endPwoJobCode = "";
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoCode = res.result;
_this.scanBarCode();
}
});
},
scanBarOperator() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.operator = res.result;
_
}
});
},
}
}
</script>

View File

@@ -0,0 +1,347 @@
<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,
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.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;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pwoJobCode = res.result;
_this.scanBarCode(_this.formData.pwoJobCode);
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.createByCode = res.result;
_this.scanBarCreateBy();
}
});
},
scanBarPieceNo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pieceNo = res.result;
}
});
}
}
}
</script>

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,145 @@
<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="status">
<uni-data-select v-model="formData.status" :localdata="range"></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>:{{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 {
getDicts
} from "@/api/system/dict/dictData.js";
import {
listWarehouse
} from "@/api/wms/pdcIn.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: [],
datetimerange: [],
reportList: [],
formData: {
ptNoTar: null,
ptTitleTar: null,
status: 1,
specification1: null,
},
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.status-op']: 'eq',
gexpr: 'A',
pageNum: 0,
pageSize: 100
}
advListMesJobSingleReportSign(obj).then(res => {
this.reportList = res.rows.map(item => {
let obj = this.whList.find(i => i.warehouseCode == item.whCode)
if (obj) {
console.log(obj)
item.whName = obj.warehouseName
}
return item
})
})
}
}
}
</script>
<style>
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

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

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

View File

@@ -0,0 +1,440 @@
<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: {
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('用户点击取消');
}
}
});
});
}
}
}
</script>
<style>
</style>