初始化仓库
This commit is contained in:
179
pages/mes/jobCv/jobBindEqp.vue
Normal file
179
pages/mes/jobCv/jobBindEqp.vue
Normal file
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoJobCode" type="text"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="当前设备" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput disabled v-model="formData.equipmentCode" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="切换设备" :labelWidth='90' name="newEquipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.newEquipmentCode"
|
||||
type="text"/>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit" style="position: absolute;bottom: 0">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPwoJob,
|
||||
updatePwoJob,
|
||||
getEquipment,
|
||||
listEquipment
|
||||
} from "@/api/mes/jobReport.js";
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
// this.test()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
equipmentCode: null,
|
||||
newEquipmentCode: null,
|
||||
eqpId: null
|
||||
},
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码'
|
||||
}]
|
||||
},
|
||||
newEquipmentCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入要切换的设备编号'
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
test() {
|
||||
let ip = null;
|
||||
uni.setStorageSync('appversion', plus.runtime.version)
|
||||
// IP地址
|
||||
let Context = plus.android.importClass('android.content.Context')
|
||||
let main = plus.android.runtimeMainActivity()
|
||||
let cm = main.getSystemService(Context.CONNECTIVITY_SERVICE)
|
||||
plus.android.importClass(cm)
|
||||
let linkProperties = cm.getLinkProperties(cm.getActiveNetwork())
|
||||
let linkAddrs = plus.android.invoke(linkProperties, 'getLinkAddresses')
|
||||
plus.android.importClass(linkAddrs)
|
||||
for (var i = 0; i < linkAddrs.size(); i++) {
|
||||
let inetAddr = plus.android.invoke(linkAddrs.get(i), 'getAddress')
|
||||
ip = plus.android.invoke(inetAddr, 'getHostAddress')
|
||||
}
|
||||
|
||||
// let baseUrl = uni.getStorageSync("base_url").slice(0, 20)
|
||||
console.log(ip)
|
||||
uni.request({
|
||||
url: 'http://' + ip + ':8080/api/1.0/alarm/success_start',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
let obj = Number(this.formData.pwoJobCode.slice(4));
|
||||
console.log(Number(this.formData.pwoJobCode.slice(4)));
|
||||
getPwoJob(obj).then(async res => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
let eqpId = res.data.eqpId;
|
||||
//判断扫描的作业编码是否绑定设备
|
||||
if (eqpId && eqpId != 0) {
|
||||
this.formData.eqpId = eqpId;
|
||||
getEquipment(eqpId).then(async res => {
|
||||
this.formData.equipmentCode = res.data.equipmentCode;
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("该作业编码未绑定设备!");
|
||||
}
|
||||
} else {
|
||||
this.formData.equipmentCode = "无";
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.newEquipmentCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定使用该设备上工吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let query = {
|
||||
equipmentCode: _this.formData.newEquipmentCode
|
||||
}
|
||||
//根据设备编码来获取设备id
|
||||
listEquipment(query).then(async res => {
|
||||
let eqpId1 = res.rows[0].id;
|
||||
let data = {
|
||||
id: _this.formData.pwoJobCode.slice(4),
|
||||
eqpId: res.rows[0].id
|
||||
}
|
||||
_this.$modal.loading('提交中')
|
||||
updatePwoJob(data).then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("作业上机成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
423
pages/mes/jobCv/jobIn - 副本.vue
Normal file
423
pages/mes/jobCv/jobIn - 副本.vue
Normal file
@@ -0,0 +1,423 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
|
||||
<uni-collapse-item title="上机转入单" :open="true">
|
||||
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" disabled type="text" @confirm="scanJobCode"
|
||||
v-model="jobInForm.pwoJobCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
|
||||
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="工位编码" :labelWidth='90' name="stationCode">
|
||||
<uni-easyinput suffixIcon="scan" type="text" v-model="stationCode"
|
||||
@iconClick="scanBarStationCode" @input="scanStationCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" :disabled=flag ref="equipmentCode" @iconClick="scanBar1"
|
||||
type="text" v-model="equipmentCode">
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="show" :labelWidth='90' style="text-align: center;" name="">
|
||||
<button type="primary" size="mini" style=" text-align: center;font-size: 18px;"
|
||||
@click="eqpBind">绑定</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="选择状态" :labelWidth='90'>
|
||||
<u-radio-group v-model="radiovalue1" placement="row">
|
||||
<u-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name"
|
||||
:name="item.name">
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item :label="radiovalue1+'时间'" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="value1" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作人编码" :labelWidth='90' name="operateByCode">
|
||||
<uni-easyinput suffixIcon="scan" @confirm="scanBarOperateBy" @iconClick="scanBar2" type="text"
|
||||
v-model="operateByCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作人" :labelWidth='90' name="operateBy">
|
||||
<uni-easyinput disabled type="text" v-model="operateBy"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
|
||||
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth='90' name="remark">
|
||||
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="上机转入单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions"
|
||||
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList" :key="index"
|
||||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||||
<!-- <uni-badge :text="index+1" type="primary"><u-tag text="未核销" size="large" type="error" plain
|
||||
plainFill></u-tag></uni-badge> -->
|
||||
<!-- <div><u-tag text="未核销" size="mini" type="error" plain plainFill></u-tag></div> -->
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标仓库" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
|
||||
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标库位" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
|
||||
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="可转入数量" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.availableNum'">
|
||||
<uni-easyinput type="text" disabled v-model="item.availableNum"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移数量" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
|
||||
<uni-easyinput type="text" v-model="item.number"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<view style="text-align: center;margin: 10px 0;" v-show="jobInForm.mesPwoJobCvDetailList.length>0">
|
||||
<button type="primary" size="mini" style=" text-align: center;font-size: 18px;"
|
||||
@click="byDetailAdd">照单领</button>
|
||||
</view>
|
||||
<u-button type="primary" @click="jobInSubmit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
handleConvert,
|
||||
getEquipment,
|
||||
addConversion,
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion,
|
||||
pwoStart,
|
||||
pwoStop
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
updatePwoJob,
|
||||
listEquipment,
|
||||
getPwoJob,
|
||||
listPwoJob
|
||||
} from "@/api/mes/jobReport.js"
|
||||
import {
|
||||
listStation,
|
||||
addCustomizeEsop
|
||||
} from "@/api/esop/esop.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
value1: null,
|
||||
radiolist1: [{
|
||||
name: '开工',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: '暂停',
|
||||
disabled: false
|
||||
}
|
||||
],
|
||||
radiovalue1: '开工',
|
||||
stationCode: null,
|
||||
jobInForm: {
|
||||
mesPwoJobCvDetailList: [],
|
||||
},
|
||||
stationId: null,
|
||||
number: null,
|
||||
equipmentCode: null,
|
||||
flag: true,
|
||||
show: false,
|
||||
operateBy: null,
|
||||
operateByCode: null,
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
// materialName: [{
|
||||
// required: false,
|
||||
// errorMessage: '请输入物料名称!'
|
||||
// }],
|
||||
// number: [{
|
||||
// required: true,
|
||||
// errorMessage: '请输入转移数量!'
|
||||
// }],
|
||||
// equipmentCode: {
|
||||
// rules: [{
|
||||
// pattern: '^[A-Z0-9]+$',
|
||||
// errorMessage: '请输入正确格式的设备编码!',
|
||||
// trigger: 'blur',
|
||||
// }]
|
||||
// }
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
listEquipment().then(response => {
|
||||
this.equipmentList = response.rows
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//照单领
|
||||
byDetailAdd() {
|
||||
if (this.jobInForm.mesPwoJobCvDetailList.length > 0) {
|
||||
for (var i in this.jobInForm.mesPwoJobCvDetailList) {
|
||||
this.jobInForm.mesPwoJobCvDetailList[i].number = this.jobInForm.mesPwoJobCvDetailList[i]
|
||||
.availableNum;
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
reset(code) {
|
||||
this.jobInForm = {
|
||||
pwoJobCode: code,
|
||||
mesPwoJobCvDetailList: [],
|
||||
};
|
||||
this.equipmentCode = null;
|
||||
this.operateBy = null;
|
||||
this.operateByCode = null;
|
||||
},
|
||||
eqpBind() {
|
||||
|
||||
let id = Number(this.jobInForm.pwoJobCode.substring(4));
|
||||
//判断是否有该设备
|
||||
if (this.equipmentCode != "" && this.equipmentCode) {
|
||||
let query = {
|
||||
equipmentCode: this.equipmentCode
|
||||
}
|
||||
listEquipment(query).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
//绑定设备
|
||||
let data = {
|
||||
id: this.jobInForm.pwoJobCode.slice(4),
|
||||
eqpId: res.rows[0].id
|
||||
}
|
||||
this.$modal.loading('提交中')
|
||||
updatePwoJob(data).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("绑定成功!");
|
||||
this.show = false;
|
||||
this.flag = true;
|
||||
this.scanJobCode(this.jobInForm.pwoJobCode);
|
||||
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("未查询到该设备编码!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入设备编码!");
|
||||
}
|
||||
|
||||
},
|
||||
scanJobCode(code) {
|
||||
if (code) {
|
||||
this.reset(code);
|
||||
// let id = Number(code.substring(4));
|
||||
listPwoJob({
|
||||
code: code
|
||||
}).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
if (!res.rows[0].eqpId) {
|
||||
//未绑定设备,设备编码框可用,绑定按钮显示
|
||||
this.$modal.msg("该作业未绑定设备,请绑定设备!");
|
||||
this.flag = false;
|
||||
this.show = true;
|
||||
} else {
|
||||
//已绑定设备,
|
||||
handleConvert(res.rows[0].id).then(async response => {
|
||||
this.equipmentCode = this.equipmentList.find(item => item.id ==
|
||||
response.jobInfo.eqpId).equipmentCode; //赋值设备编码
|
||||
listEmpEqpHistory({
|
||||
equipmentCode: this.equipmentCode
|
||||
}).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
//取上机且未下机的人员
|
||||
if (res.rows[res.rows.length -
|
||||
1].startTime && !res.rows[res.rows
|
||||
.length -
|
||||
1].endTime) {
|
||||
this.operateBy = res.rows[res.rows
|
||||
.length -
|
||||
1].empName;
|
||||
this.operateByCode = res.rows[res.rows
|
||||
.length - 1].empCode;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.jobInForm.pwoJobId = response.jobInfo.id;
|
||||
this.jobInForm.powJobCode = response.jobInfo.code;
|
||||
this.jobInForm.pwoId = response.jobInfo.pwoId;
|
||||
this.jobInForm.pwoCode = response.jobInfo.pwoCode;
|
||||
this.jobInForm.type = 2;
|
||||
|
||||
if (response.materials != null && response.materials.length >
|
||||
0) {
|
||||
for (let i in response.materials) {
|
||||
let obj = {};
|
||||
obj.materialCode = response.materials[i].cPtNo;
|
||||
obj.materialName = response.materials[i].cTitle;
|
||||
obj.materialBatch = response.materials[i].batchNo;
|
||||
obj.whCodeDest = "op-" + response.jobInfo.opCode;
|
||||
obj.availableNum = response.materials[i].availableNum;
|
||||
obj.locCodeDest = this.equipmentCode + "-01";
|
||||
obj.number = null;
|
||||
this.jobInForm.mesPwoJobCvDetailList.push(obj);
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("未查询到可转入的原材料!");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBarOperateBy() {
|
||||
let obj = {
|
||||
empCode: this.operateByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.operateBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
},
|
||||
//工位编码
|
||||
scanBarStationCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.stationCode = res.result;
|
||||
_this.scanStationCode(_this.stationCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanStationCode(code) {
|
||||
let obj = {
|
||||
stationCode: code
|
||||
}
|
||||
listStation(obj).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
this.stationId = res.rows[0].id
|
||||
} else {
|
||||
this.$modal.msg("未查询到该工位,无法同步ESOP!")
|
||||
}
|
||||
});
|
||||
},
|
||||
jobInSubmit() {
|
||||
//判断是否输入工位,并进行同步esop
|
||||
if (this.stationCode && this.stationCode != '' && this.stationId && this.stationId != '') {
|
||||
addCustomizeEsop({
|
||||
pwoJobId: this.jobInForm.pwoJobId,
|
||||
stationId: this.stationId,
|
||||
stationCode: this.stationCode,
|
||||
pwoJobCode: this.jobInForm.pwoJobCode
|
||||
}).then(resp => {
|
||||
this.$modal.msgSuccess("ESOP同步成功!");
|
||||
});
|
||||
}
|
||||
//判断是否输入时间
|
||||
if (this.value1 && this.value1 != '') {
|
||||
switch (this.radiovalue1) {
|
||||
case '开工':
|
||||
pwoStart(this.jobInForm.pwoJobId, this.value1).then(res => {
|
||||
this.$modal.msgSuccess("作业开工成功!");
|
||||
});
|
||||
break;
|
||||
case '暂停':
|
||||
pwoStop(this.jobInForm.pwoJobId, this.value1).then(res => {
|
||||
this.$modal.msgSuccess("作业暂停成功!");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.jobInForm.operateBy = this.operateBy;
|
||||
this.$refs["jobInForm"].validate().then(valid => {
|
||||
//作业转入
|
||||
this.$modal.loading('提交中')
|
||||
addConversion(this.jobInForm).then(response => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("转入成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
//作业编码
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.jobInForm.pwoJobCode = res.result;
|
||||
_this.scanJobCode(_this.jobInForm.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
//设备编码
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.equipmentCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//操作人编码
|
||||
scanBar2() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.operateByCode = res.result;
|
||||
_this.scanBarOperateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
436
pages/mes/jobCv/jobIn.vue
Normal file
436
pages/mes/jobCv/jobIn.vue
Normal file
@@ -0,0 +1,436 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
|
||||
<uni-collapse-item title="上机转入单" :open="true">
|
||||
<uni-forms-item label="作业编码" :labelWidth="90" name="pwoJobCode">
|
||||
<!-- <utils-input prefixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
|
||||
v-model="jobInForm.pwoJobCode" @focus="focus" :focus='true' @click="focus" @input="handleInput" :key="input.boolean"></utils-input> -->
|
||||
<uni-easyinput
|
||||
prefixIcon="scan"
|
||||
@iconClick="scanBar"
|
||||
type="text"
|
||||
@confirm="scanJobCode"
|
||||
v-model="jobInForm.pwoJobCode"
|
||||
@click="focus"
|
||||
@input="handleInput"
|
||||
:key="input.boolean"
|
||||
></uni-easyinput>
|
||||
<!-- <uni-easyinput type="text" prefixIcon="scan"
|
||||
ref="saleCode"
|
||||
class="Number"
|
||||
placeholder="请扫描销售单号!"
|
||||
placeholderStyle="color:black"
|
||||
v-model="getCode.saleCode"
|
||||
@iconClick="iconClick('number')"
|
||||
@input="getNumberCode"
|
||||
:focus='open'
|
||||
clearable
|
||||
/> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="工单" :labelWidth="90" name="pwoCode">
|
||||
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="工位编码" :labelWidth="90" name="stationCode">
|
||||
<uni-easyinput suffixIcon="scan" type="text" v-model="stationCode" @iconClick="scanBarStationCode" @input="scanStationCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth="90" name="equipmentCode">
|
||||
<uni-easyinput suffixIcon="scan" :disabled="flag" ref="equipmentCode" @iconClick="scanBar1" type="text" v-model="equipmentCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="show" :labelWidth="90" style="text-align: center" name="">
|
||||
<button type="primary" size="mini" style="text-align: center; font-size: 18px" @click="eqpBind">绑定</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="选择状态" :labelWidth="90">
|
||||
<u-radio-group v-model="radiovalue1" placement="row">
|
||||
<u-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name"></u-radio>
|
||||
</u-radio-group>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item :label="radiovalue1 + '时间'" :labelWidth="90">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="value1" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作人编码" :labelWidth="90" name="operateByCode">
|
||||
<uni-easyinput suffixIcon="scan" @confirm="scanBarOperateBy" @iconClick="scanBar2" type="text" v-model="operateByCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="操作人" :labelWidth="90" name="operateBy">
|
||||
<uni-easyinput disabled type="text" v-model="operateBy"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移单类型" :labelWidth="90" name="type">
|
||||
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth="90" name="remark">
|
||||
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="上机转入单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item
|
||||
:rightOptions="rightOptions"
|
||||
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
|
||||
:key="index"
|
||||
@click="(data) => clickDetail(index, data)"
|
||||
@change="swipChange"
|
||||
>
|
||||
<!-- <uni-badge :text="index+1" type="primary"><u-tag text="未核销" size="large" type="error" plain
|
||||
plainFill></u-tag></uni-badge> -->
|
||||
<!-- <div><u-tag text="未核销" size="mini" type="error" plain plainFill></u-tag></div> -->
|
||||
<uni-forms-item label="物料编码" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.materialBatch'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标仓库" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.whCodeDest'">
|
||||
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标库位" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.locCodeDest'">
|
||||
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="可转入数量" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.availableNum'">
|
||||
<uni-easyinput type="text" disabled v-model="item.availableNum"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移数量" :labelWidth="90" :name="'mesPwoJobCvDetailList.' + index + '.number'">
|
||||
<uni-easyinput type="text" v-model="item.number"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<view style="text-align: center; margin: 10px 0" v-show="jobInForm.mesPwoJobCvDetailList.length > 0">
|
||||
<button type="primary" size="mini" style="text-align: center; font-size: 18px" @click="byDetailAdd">照单领</button>
|
||||
</view>
|
||||
<u-button type="primary" @click="jobInSubmit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { handleConvert, getEquipment, addConversion, listEmpEqpHistory, listEmployee, listConversion, pwoStart, pwoStop } from '@/api/mes/jobIn.js';
|
||||
import { updatePwoJob, listEquipment, getPwoJob, listPwoJob } from '@/api/mes/jobReport.js';
|
||||
import { listStation, addCustomizeEsop } from '@/api/esop/esop.js';
|
||||
import { listPwoLike } from '@/api/mes/pwoIn.js';
|
||||
import utilsInput from '@/utils/uniapp/utilsInput.vue';
|
||||
export default {
|
||||
components: {
|
||||
utilsInput
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
input: {
|
||||
boolean: 0,
|
||||
inputValue: ''
|
||||
},
|
||||
value1: null,
|
||||
radiolist1: [
|
||||
{
|
||||
name: '开工',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: '暂停',
|
||||
disabled: false
|
||||
}
|
||||
],
|
||||
radiovalue1: '开工',
|
||||
stationCode: null,
|
||||
jobInForm: {
|
||||
mesPwoJobCvDetailList: []
|
||||
},
|
||||
stationId: null,
|
||||
number: null,
|
||||
equipmentCode: null,
|
||||
flag: true,
|
||||
show: false,
|
||||
operateBy: null,
|
||||
operateByCode: null,
|
||||
rightOptions: [
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}
|
||||
]
|
||||
}
|
||||
// materialName: [{
|
||||
// required: false,
|
||||
// errorMessage: '请输入物料名称!'
|
||||
// }],
|
||||
// number: [{
|
||||
// required: true,
|
||||
// errorMessage: '请输入转移数量!'
|
||||
// }],
|
||||
// equipmentCode: {
|
||||
// rules: [{
|
||||
// pattern: '^[A-Z0-9]+$',
|
||||
// errorMessage: '请输入正确格式的设备编码!',
|
||||
// trigger: 'blur',
|
||||
// }]
|
||||
// }
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
listEquipment().then((response) => {
|
||||
this.equipmentList = response.rows;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//照单领
|
||||
byDetailAdd() {
|
||||
if (this.jobInForm.mesPwoJobCvDetailList.length > 0) {
|
||||
for (var i in this.jobInForm.mesPwoJobCvDetailList) {
|
||||
this.jobInForm.mesPwoJobCvDetailList[i].number = this.jobInForm.mesPwoJobCvDetailList[i].availableNum;
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, { position, index }) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
reset(code) {
|
||||
this.jobInForm = {
|
||||
pwoJobCode: code,
|
||||
mesPwoJobCvDetailList: []
|
||||
};
|
||||
this.equipmentCode = null;
|
||||
this.operateBy = null;
|
||||
this.operateByCode = null;
|
||||
},
|
||||
eqpBind() {
|
||||
let id = Number(this.jobInForm.pwoJobCode.substring(4));
|
||||
//判断是否有该设备
|
||||
if (this.equipmentCode != '' && this.equipmentCode) {
|
||||
let query = {
|
||||
equipmentCode: this.equipmentCode
|
||||
};
|
||||
listEquipment(query).then(async (res) => {
|
||||
if (res.rows.length != 0) {
|
||||
//绑定设备
|
||||
let data = {
|
||||
id: this.jobInForm.pwoJobCode.slice(4),
|
||||
eqpId: res.rows[0].id
|
||||
};
|
||||
this.$modal.loading('提交中');
|
||||
updatePwoJob(data).then((res) => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess('绑定成功!');
|
||||
this.show = false;
|
||||
this.flag = true;
|
||||
this.scanJobCode(this.jobInForm.pwoJobCode);
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg('未查询到该设备编码!');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg('请输入设备编码!');
|
||||
}
|
||||
},
|
||||
scanJobCode(code) {
|
||||
if (code) {
|
||||
this.reset(code);
|
||||
// let id = Number(code.substring(4));
|
||||
listPwoJob({
|
||||
code: code
|
||||
}).then(async (res) => {
|
||||
if (res.rows.length != 0) {
|
||||
if (!res.rows[0].eqpId) {
|
||||
//未绑定设备,设备编码框可用,绑定按钮显示
|
||||
this.$modal.msg('该作业未绑定设备,请绑定设备!');
|
||||
this.flag = false;
|
||||
this.show = true;
|
||||
} else {
|
||||
//已绑定设备,
|
||||
handleConvert(res.rows[0].id).then(async (response) => {
|
||||
this.equipmentCode = this.equipmentList.find((item) => item.id == response.jobInfo.eqpId).equipmentCode; //赋值设备编码
|
||||
listEmpEqpHistory({
|
||||
equipmentCode: this.equipmentCode
|
||||
}).then(async (res) => {
|
||||
if (res.rows.length != 0) {
|
||||
//取上机且未下机的人员
|
||||
if (res.rows[res.rows.length - 1].startTime && !res.rows[res.rows.length - 1].endTime) {
|
||||
this.operateBy = res.rows[res.rows.length - 1].empName;
|
||||
this.operateByCode = res.rows[res.rows.length - 1].empCode;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.jobInForm.pwoJobId = response.jobInfo.id;
|
||||
this.jobInForm.powJobCode = response.jobInfo.code;
|
||||
this.jobInForm.pwoId = response.jobInfo.pwoId;
|
||||
this.jobInForm.pwoCode = response.jobInfo.pwoCode;
|
||||
this.jobInForm.type = 2;
|
||||
|
||||
if (response.materials != null && response.materials.length > 0) {
|
||||
for (let i in response.materials) {
|
||||
let obj = {};
|
||||
(obj.type = response.materials[i].type),
|
||||
(obj.materialBatchNo = response.materials[i].batchNo),
|
||||
(obj.productionVersion = response.materials[i].productionVersion),
|
||||
(obj.materialCode = response.materials[i].cPtNo);
|
||||
obj.materialName = response.materials[i].cTitle;
|
||||
obj.materialBatch = response.materials[i].batchNo;
|
||||
obj.whCodeDest = 'op-' + response.jobInfo.opCode;
|
||||
obj.availableNum = response.materials[i].availableNum;
|
||||
obj.locCodeDest = this.equipmentCode + '-01';
|
||||
obj.number = null;
|
||||
this.jobInForm.mesPwoJobCvDetailList.push(obj);
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg('未查询到可转入的原材料!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBarOperateBy() {
|
||||
let obj = {
|
||||
empCode: this.operateByCode
|
||||
};
|
||||
listEmployee(obj).then(async (res) => {
|
||||
if (res.rows.length != 0) {
|
||||
this.operateBy = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg('未查询到该人员信息!');
|
||||
}
|
||||
});
|
||||
},
|
||||
//工位编码
|
||||
scanBarStationCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function (res) {
|
||||
_this.stationCode = res.result;
|
||||
_this.scanStationCode(_this.stationCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanStationCode(code) {
|
||||
let obj = {
|
||||
stationCode: code
|
||||
};
|
||||
listStation(obj).then((res) => {
|
||||
if (res.rows.length > 0) {
|
||||
this.stationId = res.rows[0].id;
|
||||
} else {
|
||||
this.$modal.msg('未查询到该工位,无法同步ESOP!');
|
||||
}
|
||||
});
|
||||
},
|
||||
jobInSubmit() {
|
||||
//判断是否输入工位,并进行同步esop
|
||||
if (this.stationCode && this.stationCode != '' && this.stationId && this.stationId != '') {
|
||||
addCustomizeEsop({
|
||||
pwoJobId: this.jobInForm.pwoJobId,
|
||||
stationId: this.stationId,
|
||||
stationCode: this.stationCode,
|
||||
pwoJobCode: this.jobInForm.pwoJobCode
|
||||
}).then((resp) => {
|
||||
this.$modal.msgSuccess('ESOP同步成功!');
|
||||
});
|
||||
}
|
||||
//判断是否输入时间
|
||||
if (this.value1 && this.value1 != '') {
|
||||
switch (this.radiovalue1) {
|
||||
case '开工':
|
||||
pwoStart(this.jobInForm.pwoJobId, this.value1).then((res) => {
|
||||
this.$modal.msgSuccess('作业开工成功!');
|
||||
});
|
||||
break;
|
||||
case '暂停':
|
||||
pwoStop(this.jobInForm.pwoJobId, this.value1).then((res) => {
|
||||
this.$modal.msgSuccess('作业暂停成功!');
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.jobInForm.operateBy = this.operateBy;
|
||||
this.$refs['jobInForm'].validate().then((valid) => {
|
||||
//作业转入
|
||||
this.$modal.loading('提交中');
|
||||
addConversion(this.jobInForm).then((response) => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess('转入成功!');
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab('/pages/work/index');
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
//作业编码
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function (res) {
|
||||
_this.jobInForm.pwoJobCode = res.result;
|
||||
_this.scanJobCode(_this.jobInForm.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
//设备编码
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function (res) {
|
||||
_this.equipmentCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//操作人编码
|
||||
scanBar2() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function (res) {
|
||||
_this.operateByCode = res.result;
|
||||
_this.scanBarOperateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 隐藏软键盘
|
||||
*/
|
||||
focus() {
|
||||
uni.hideKeyboard();
|
||||
},
|
||||
/**
|
||||
* 不让手动输入
|
||||
* @param {Object} value
|
||||
*/
|
||||
handleInput(value) {
|
||||
const { inputValue } = this.input;
|
||||
if (value.length - inputValue.length == 1 || inputValue.length - value.length == 1) {
|
||||
this.$modal.msg('请扫描');
|
||||
this.jobInForm.pwoJobCode = null;
|
||||
this.input.inputValue = value;
|
||||
this.input.boolean = this.input.boolean == 0 ? 10 : 0;
|
||||
return;
|
||||
}
|
||||
this.input.inputValue = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
86
pages/mes/jobCv/pieceIn.vue
Normal file
86
pages/mes/jobCv/pieceIn.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="物料件号" :labelWidth='90' name="pieceNo">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pieceNo" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addPiece
|
||||
} from "@/api/mes/jobReport.js";
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pieceNo: null,
|
||||
},
|
||||
|
||||
rules: {
|
||||
pieceNo: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入件号!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
_this.scanBarCode(_this.formData.pieceNo);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定转入吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
console.log(_this.formData.pieceNo);
|
||||
_this.$modal.loading('提交中')
|
||||
addPiece(_this.formData.pieceNo).then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("件号转入成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
83
pages/mes/jobCv/pieceReport.vue
Normal file
83
pages/mes/jobCv/pieceReport.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="物料件号" :labelWidth='90' name="pieceNo">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pieceNo" type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
pieceReport
|
||||
} from "@/api/mes/jobReport.js";
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pieceNo: null,
|
||||
},
|
||||
|
||||
rules: {
|
||||
pieceNo: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入件号!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定报工吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
_this.$modal.loading('提交中')
|
||||
pieceReport(_this.formData.pieceNo, {}).then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("件号报工成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
355
pages/mes/jobCv/pieceReportOper/index.vue
Normal file
355
pages/mes/jobCv/pieceReportOper/index.vue
Normal file
@@ -0,0 +1,355 @@
|
||||
<template>
|
||||
<view>
|
||||
<div class="head">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<uni-easyinput type="text" prefixIcon="scan"
|
||||
placeholder="请扫描作业!"
|
||||
v-model="machineCode"
|
||||
@iconClick="iconClick('machineCode')"
|
||||
@change="changeInput('machineCode',$event)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>作业编码:{{form.pwoJobCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>制  程:{{form.opTitle}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料编码:{{form.pwoCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料名称:{{form.ptTitleTar}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div @click="clickButton('qualified')" :class="{bgColor:bgColor === 'qualified'}">合格</div>
|
||||
<div @click="clickButton('bad')" :class="{bgColor:bgColor === 'bad'}">不良</div>
|
||||
<div @click="clickButton('scrap')" :class="{bgColor:bgColor === 'scrap'}">报废</div>
|
||||
<view class="uni-px-5 uni-pb-5" v-show="bgColor === 'bad'">
|
||||
<uni-data-checkbox mode="button" v-model="form.reason" :localdata="reason.bad"></uni-data-checkbox>
|
||||
</view>
|
||||
<view class="uni-px-5 uni-pb-5" v-show="bgColor === 'scrap'">
|
||||
<uni-data-checkbox mode="button" v-model="form.reason" :localdata="reason.scrap"></uni-data-checkbox>
|
||||
</view>
|
||||
</div>
|
||||
<div class="body">
|
||||
<uni-easyinput type="text" prefixIcon="scan"
|
||||
placeholder="请扫描件号!"
|
||||
v-model="pieceNo"
|
||||
@iconClick="iconClick('pieceNo')"
|
||||
@change="changeInput('pieceNo',$event)"
|
||||
/>
|
||||
<uni-table ref="table" border stripe>
|
||||
<uni-tr>
|
||||
<uni-th align="center">序号</uni-th>
|
||||
<uni-th style="width: 80%"align="center">件号</uni-th>
|
||||
</uni-tr>
|
||||
<uni-tr v-for="(item, index) in pieceNoList" :key="index">
|
||||
<uni-td align="center">{{ index+1 }}</uni-td>
|
||||
<uni-td align="center"> {{item}} </uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
</div>
|
||||
|
||||
|
||||
<uni-popup ref="message" type="message">
|
||||
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
|
||||
</uni-popup>
|
||||
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
|
||||
<!-- 加载动画 -->
|
||||
<loding-vue/>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob
|
||||
} from '@/api/mes/jobReport.js'
|
||||
import {
|
||||
getDicts
|
||||
} from '@/api/system/dict/dictData.js'
|
||||
import {
|
||||
addReport,listEquipment
|
||||
} from '@/api/mes/jobReport.js'
|
||||
//引入加载动画
|
||||
import lodingVue from "@/utils/loding/loding.vue";
|
||||
export default {
|
||||
components:{
|
||||
lodingVue
|
||||
},
|
||||
//页面加载生命周期
|
||||
onLoad: async function (option) { //option为object类型,会序列化上个页面传递的参数
|
||||
const _self = this;
|
||||
if(option.status) _self.state = true
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
machineCode: null , //扫描作业
|
||||
isPieceIn: true, //判断哪个路由进来
|
||||
form:{
|
||||
}, //头部展示数据
|
||||
message:{
|
||||
msgType:'warn',
|
||||
messageText:'请先查询设备信息'
|
||||
},
|
||||
bgColor: null,//决定按钮颜色
|
||||
reason:{},//不良以及报废原因
|
||||
pieceNo:null,//件号
|
||||
pieceNoList:new Set(), //table展示数据
|
||||
listEquipment:[],//设备信息
|
||||
}
|
||||
},
|
||||
/**
|
||||
* vue生命周期
|
||||
* 当组件挂载后触发
|
||||
*/
|
||||
async mounted() {
|
||||
const _self = this;
|
||||
const data = await Promise.all([
|
||||
//获取不良品原因
|
||||
_self.getApi('getDicts','mes_job_report_defect'),
|
||||
//报废品
|
||||
_self.getApi('getDicts','mes_job_report_scrap'),
|
||||
_self.getApi('listEquipment')
|
||||
])
|
||||
const [bad,scrap,listEquipment] = data
|
||||
bad.forEach(item=>{
|
||||
item.text = item.dictLabel,
|
||||
item.value = item.dictValue
|
||||
});
|
||||
scrap.forEach(item=>{
|
||||
item.text = item.dictLabel,
|
||||
item.value = item.dictValue
|
||||
})
|
||||
_self.listEquipment = listEquipment
|
||||
_self.reason = Object.assign({},{bad,scrap})
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 扫码方法
|
||||
* @param {string} value {'equipment' || }
|
||||
*/
|
||||
iconClick(value){
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
// 是否只能从相机扫码,不允许从相册选择图片
|
||||
onlyFromCamera:true,
|
||||
// 扫码类型
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
const obj = {
|
||||
machineCode:getMachineCode,
|
||||
pieceNo:getPieceNo,
|
||||
}
|
||||
_self.obj(value)(res.result)
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* input框change事件
|
||||
* @param {string} key
|
||||
* @param {Object} value
|
||||
*/
|
||||
changeInput(key,value){
|
||||
if(value === null || value === '') return
|
||||
const _self = this;
|
||||
const obj = {
|
||||
machineCode : 'getMachineCode',
|
||||
pieceNo: 'getPieceNo',
|
||||
}
|
||||
_self[obj[key]](value)
|
||||
},
|
||||
/**
|
||||
* 扫描作业方法
|
||||
* @param {Object} value
|
||||
*/
|
||||
async getMachineCode(value){
|
||||
if(value === null) return
|
||||
const _self = this;
|
||||
//清空数据
|
||||
_self.bgColo =null;
|
||||
_self.pieceNoList = new Set();
|
||||
|
||||
const rows = await _self.getApi('listPwoJob',{code:value})
|
||||
if(rows.length != 0){
|
||||
const {code : pwoJobCode,opTitle,pwoCode,ptTitleTar,ptNoTar,opCode,batchNo,eqpId} = rows[0]
|
||||
_self.form = Object.assign({},{
|
||||
pwoJobCode,opTitle,pwoCode,ptTitleTar,ptNoTar,opCode,batchNo,
|
||||
isPieceIn:_self.state
|
||||
})
|
||||
//获取设备信息,并选择该作业的设备
|
||||
const listEquipment = _self.listEquipment
|
||||
for(let i in listEquipment){
|
||||
if(listEquipment[i].id === eqpId)return _self.form.machineId = listEquipment[i].equipmentCode
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 扫描件号方法
|
||||
* @param {Object} value
|
||||
*/
|
||||
async getPieceNo(value){
|
||||
const _self = this;
|
||||
_self.pieceNo = null
|
||||
if(_self.form.reason === null && _self.form.type != '合格品'){
|
||||
_self.messageType({
|
||||
msgType:'warn',
|
||||
messageText:'请选择一个问题'
|
||||
})
|
||||
return
|
||||
}
|
||||
const pieceNoList = _self.pieceNoList
|
||||
if(pieceNoList.has(value)){
|
||||
_self.messageType({
|
||||
msgType:'error',
|
||||
messageText:'该件号已被扫描'
|
||||
})
|
||||
return
|
||||
}
|
||||
_self.submit(value).then(res=>{
|
||||
if(res != undefined) return pieceNoList.add(value)
|
||||
}).finally(()=>{
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 按钮点击方法
|
||||
* @param {Object} key
|
||||
* @param {Object} evnet
|
||||
*/
|
||||
clickButton(key){
|
||||
const _self = this;
|
||||
_self.clickState(key)
|
||||
},
|
||||
/**
|
||||
* 产品状态按钮点击事件
|
||||
* @param {Object} key
|
||||
*/
|
||||
clickState(key){
|
||||
const _self = this;
|
||||
_self.bgColor = key
|
||||
const obj = {
|
||||
qualified:'合格品',
|
||||
bad:'不良品',
|
||||
scrap:'报废'
|
||||
}
|
||||
_self.form.reason = null
|
||||
_self.form.type = obj[key]
|
||||
},
|
||||
/**
|
||||
* 件号扫描后提交事件
|
||||
* @param {Object} value 当前扫描的值
|
||||
*/
|
||||
async submit(pieceNo){
|
||||
const _self = this;
|
||||
// 获取当前北京时间的时间戳(单位为毫秒)
|
||||
var stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
|
||||
var endTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
|
||||
//获取账户名
|
||||
const createByName = uni.getStorageSync('HBusername');
|
||||
const reportNumber = 1;
|
||||
const way = "人工报工";
|
||||
const form = Object.assign(_self.form,{
|
||||
endTime,createByName,reportNumber,way,pieceNo
|
||||
})
|
||||
return await _self.getApi('addReport',form)
|
||||
},
|
||||
/**
|
||||
* 接口调用管理方法
|
||||
* 所有向后端发送的请求全部从这里调用
|
||||
* @param {Object} api api接口
|
||||
* @param {Object} value 带入的参数
|
||||
*/
|
||||
async getApi(api,value){
|
||||
const _self = this;
|
||||
const objApi = {
|
||||
listPwoJob,
|
||||
getDicts,
|
||||
addReport,
|
||||
listEquipment
|
||||
}
|
||||
try{
|
||||
//打开蒙层
|
||||
_self.$refs.popup.open()
|
||||
//查询接口
|
||||
const data = await objApi[api](value)
|
||||
if(api === 'addReport'){
|
||||
return data
|
||||
}
|
||||
return data.rows ? data.rows : data.data
|
||||
}catch(e){
|
||||
_self.messageType({
|
||||
msgType:'error',
|
||||
messageText:'接口请求出错'
|
||||
})
|
||||
}finally{
|
||||
//关闭蒙层
|
||||
_self.$refs.popup.close()
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 提示信息
|
||||
* @param {Object} obj
|
||||
*/
|
||||
messageType(obj){
|
||||
const _self = this;
|
||||
let message ={}
|
||||
if(obj === undefined){
|
||||
message = {
|
||||
msgType:'error',
|
||||
messageText:'请填写设备代码'
|
||||
}
|
||||
}else{
|
||||
message = {
|
||||
msgType:obj.msgType,
|
||||
messageText:obj.messageText
|
||||
}
|
||||
}
|
||||
_self.message = Object.assign({},message)
|
||||
return _self.$refs.message.open()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
color: #585858;
|
||||
font-size: 4vw;
|
||||
}
|
||||
view {
|
||||
width: 95vw;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
table{
|
||||
width: 100%;
|
||||
}
|
||||
&>div{
|
||||
border: 1vw solid #21cfff;
|
||||
border-radius: 20%;
|
||||
width: 20vw;
|
||||
text-align:center;
|
||||
line-height: 8vw;
|
||||
}
|
||||
}
|
||||
.body{
|
||||
margin-top: 1vw;
|
||||
&>* {
|
||||
margin-top: 2vw;
|
||||
}
|
||||
.td{
|
||||
text-align:center;
|
||||
}
|
||||
}
|
||||
.bgColor {
|
||||
background-color: #c4ffd0;
|
||||
}
|
||||
</style>
|
||||
111
pages/mes/jobCv/pwoClose.vue
Normal file
111
pages/mes/jobCv/pwoClose.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode" type="text"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">关闭工单</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPwo,
|
||||
listPwo,
|
||||
pwoAtificialClose
|
||||
} from "@/api/mes/pwoDraw.js";
|
||||
import {
|
||||
listWarehouse
|
||||
} from "@/api/wms/pdcIn.js";
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pwoCode: null,
|
||||
},
|
||||
id: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
status: null,
|
||||
rules: {
|
||||
pwoCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产工单!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scanBarCode() {
|
||||
const _this = this;
|
||||
if (_this.formData.pwoCode) {
|
||||
let obj = {
|
||||
pwoCode: _this.formData.pwoCode
|
||||
}
|
||||
listPwo(obj).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
_this.id = res.rows[0].id;
|
||||
_this.status = res.rows[0].status;
|
||||
} else {
|
||||
_this.$modal.msg("未找到该工单!")
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoCode = res.result;
|
||||
_this.scanBarCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定关闭该生产工单吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
//判断工单是否能关闭
|
||||
if (_this.status >= 7) {
|
||||
_this.$modal.msg("该工单无法关闭!")
|
||||
} else {
|
||||
_this.$modal.loading('提交中')
|
||||
pwoAtificialClose('"' + _this.id + '"').then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("工单关闭成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
208
pages/mes/jobCv/pwoDraw.vue
Normal file
208
pages/mes/jobCv/pwoDraw.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
|
||||
<uni-collapse-item title="领料转移单" :open="true">
|
||||
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
|
||||
<view class="uni-flex uni-row">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
|
||||
v-model="jobInForm.pwoCode"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
|
||||
<uni-data-select v-model="jobInForm.type" :localdata="typeOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth='90' name="remark">
|
||||
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="领料转移单明细" :labelWidth='90' :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
|
||||
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
|
||||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatchNo'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialBatchNo"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="生产车间" :labelWidth='90' :rules="rules.workshopCode"
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.workshopCode'">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarworkshopCode(index)" type="text"
|
||||
v-model="item.workshopCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标仓库" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
|
||||
<uni-easyinput type="text" v-model="item.whCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标库位" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
|
||||
<uni-easyinput type="text" v-model="item.locCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移数量" :labelWidth='90' :rules="rules.number"
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
|
||||
<u-number-box button-size="36" inputWidth="120" v-model="item.number"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
|
||||
<u-button type="primary" @click="jobInSubmit" v-if="!isPwoRoute">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getDrawMat,
|
||||
addConversion
|
||||
} from "@/api/mes/pwoDraw.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
console.log(option);
|
||||
if (option) {
|
||||
this.jobInForm.pwoCode = option.pwoCode;
|
||||
this.jobInForm.type = option.type
|
||||
this.jobInForm.mesPwoJobCvDetailList = JSON.parse(decodeURIComponent(option.mesPwoJobCvDetailList));
|
||||
this.isPwoRoute = true;
|
||||
}
|
||||
getDicts("mes_conv_type").then(res => {
|
||||
this.typeOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isPwoRoute: false,
|
||||
typeOptions: [],
|
||||
jobInForm: {
|
||||
pwoCode: "",
|
||||
mesPwoJobCvDetailList: [],
|
||||
},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
pwoCode: [{
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入工单!'
|
||||
}]
|
||||
}],
|
||||
type: [{
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入转移单类型!',
|
||||
}]
|
||||
}],
|
||||
materialCode: [{
|
||||
required: true,
|
||||
errorMessage: '请输入物料编码!'
|
||||
}],
|
||||
materialName: [{
|
||||
required: true,
|
||||
errorMessage: '请输入物料名称!'
|
||||
}],
|
||||
number: [{
|
||||
required: true,
|
||||
errorMessage: '请输入转移数量!'
|
||||
}],
|
||||
workshopCode: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产车间!'
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteDetail(index) {
|
||||
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
submit() {},
|
||||
reset(code) {
|
||||
this.jobInForm = {
|
||||
pwoCode: code,
|
||||
mesPwoJobCvDetailList: [],
|
||||
};
|
||||
},
|
||||
scanJobCode(code) {
|
||||
if (code) {
|
||||
getDrawMat(code).then(res => {
|
||||
this.reset(code);
|
||||
this.jobInForm.type = 1;
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
let obj = {};
|
||||
obj.materialCode = res.rows[i].materialCode;
|
||||
obj.materialName = res.rows[i].materialName;
|
||||
obj.materialBatchNo = res.rows[i].materialBatchNo;
|
||||
this.jobInForm.mesPwoJobCvDetailList.push(obj);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
jobInSubmit() {
|
||||
this.$refs["jobInForm"].validate().then(valid => {
|
||||
this.$modal.loading('提交中')
|
||||
addConversion(this.jobInForm).then(response => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("工单领料成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.jobInForm.pwoCode = res.result;
|
||||
_this.scanJobCode(_this.jobInForm.pwoCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarworkshopCode(index) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.jobInForm.mesPwoJobCvDetailList[index].workshopCode = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
152
pages/mes/jobCv/pwoIn.vue
Normal file
152
pages/mes/jobCv/pwoIn.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
|
||||
<uni-collapse-item title="完工转移单" :open="true">
|
||||
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
|
||||
v-model="jobInForm.pwoCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="转移单类型" :labelWidth='90' name="type">
|
||||
<uni-easyinput type="text" disabled v-model="jobInForm.type"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth='90' name="remark">
|
||||
<uni-easyinput autoHeight type="textarea" v-model="jobInForm.remark"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="完工转移单明细" :open="true">
|
||||
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
|
||||
<u-button type="primary" @click="submit">确认</u-button> -->
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
|
||||
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
|
||||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="目标仓库" :name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
|
||||
<uni-easyinput type="text" v-model="item.whCodeDest"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标库位" :name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
|
||||
<uni-easyinput type="text" v-model="item.locCodeDest"></uni-easyinput>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="转移数量" :labelWidth='90' :rules="rules.number"
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="jobInSubmit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getInMat,
|
||||
addConversion
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
jobInForm: {
|
||||
mesPwoJobCvDetailList: [],
|
||||
},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
materialCode: [{
|
||||
required: true,
|
||||
errorMessage: '请输入物料编码!'
|
||||
}],
|
||||
materialName: [{
|
||||
required: true,
|
||||
errorMessage: '请输入物料名称!'
|
||||
}],
|
||||
number: [{
|
||||
required: true,
|
||||
errorMessage: '请输入转移数量!'
|
||||
}],
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addDetail() {
|
||||
this.jobInForm.mesPwoJobCvDetailList.push({});
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
submit() {},
|
||||
reset(code) {
|
||||
this.jobInForm = {
|
||||
pwoCode: code,
|
||||
mesPwoJobCvDetailList: [],
|
||||
};
|
||||
},
|
||||
scanJobCode(code) {
|
||||
if (code) {
|
||||
getInMat(code).then(res => {
|
||||
this.reset(code);
|
||||
console.log(res);
|
||||
this.jobInForm.type = 3;
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
let obj = {};
|
||||
obj.materialCode = res.rows[i].materialCode;
|
||||
obj.materialName = res.rows[i].materialName;
|
||||
obj.number = res.rows[i].number;
|
||||
this.jobInForm.mesPwoJobCvDetailList.push(obj);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
jobInSubmit() {
|
||||
this.$refs["jobInForm"].validate().then(valid => {
|
||||
this.$modal.loading('提交中')
|
||||
addConversion(this.jobInForm).then(response => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("工单领料成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.jobInForm.pwoCode = res.result;
|
||||
_this.scanJobCode(_this.jobInForm.pwoCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
441
pages/mes/jobCv/pwoSearch.vue
Normal file
441
pages/mes/jobCv/pwoSearch.vue
Normal file
@@ -0,0 +1,441 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode" type="text"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="状态" :labelWidth='90'>
|
||||
<uni-tag :text="pwotag(status)" type="warning"></uni-tag>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<uni-row style="margin-top: 20px;" :gutter="10">
|
||||
<uni-col :span="8" style="text-align: center;">
|
||||
<u-button type="warning" @click="selectPwoStock(formData.pwoCode)">物料核销</u-button>
|
||||
</uni-col>
|
||||
<uni-col :span="8" style="text-align: center;">
|
||||
<u-button type="success" @click="submitIn" :disabled="disabledIn">入库</u-button>
|
||||
</uni-col>
|
||||
<uni-col :span="8" style="text-align: center;">
|
||||
<u-button type="primary" @click="submitClose" :disabled="disabledClose">关闭工单</u-button>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
</uni-collapse>
|
||||
<view class="cu-card article ">
|
||||
<view class="cu-item shadow borderBottom" v-for="(item,index) in pwoJobList" :key="index">
|
||||
<view class="content">
|
||||
<view class="desc">
|
||||
<view class="text-content" style="font-size: 15px;">
|
||||
<view><strong>生产工单作业编码</strong> : {{item.code}}</view>
|
||||
<view><strong>制程编码</strong> : {{item.opCode}}</view>
|
||||
<view><strong>制程名称</strong> : {{item.opTitle}}</view>
|
||||
<view><strong>开工状态</strong> :
|
||||
<uni-tag :text="jobtag(item.status)" type="success"></uni-tag>
|
||||
</view>
|
||||
<view><strong>目标产量</strong> : {{item.targetNum}}</view>
|
||||
<view><strong>已完成数量</strong> : {{item.finishQty}}</view>
|
||||
<view><strong>合格总数</strong> : {{item.totalOutput}}</view>
|
||||
<view><strong>不良总数</strong> : {{item.totalDefect}}</view>
|
||||
<view><strong>报废总数</strong> : {{item.totalScrap}}</view>
|
||||
<view><strong>损耗总数</strong> : {{item.totalLoss}}</view>
|
||||
<uni-row>
|
||||
<uni-col :span="18">
|
||||
<view><strong>在制数量</strong> : {{item.makingNum}}</view>
|
||||
<view><strong>结存数量</strong> : {{item.surplusNum}}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="6"> <u-button type="primary" @click="report(item.code)"
|
||||
v-show="item.status<5">报工</u-button></uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-popup :show="show" @close="close" @open="getMaterialStock" :closeable="true">
|
||||
<view class="cu-card article ">
|
||||
<view class="cu-item shadow borderBottom" v-for="(item,index) in materialStockList" :key="index">
|
||||
<view class="content">
|
||||
<view class="desc">
|
||||
<view class="text-content" style="font-size: 15px;">
|
||||
<view><strong>物料</strong> : {{item.materialCode+':'+item.materialName}}</view>
|
||||
<view><strong>批号</strong> : {{item.batchNo}}</view>
|
||||
<view><strong>类型</strong> :
|
||||
<uni-tag :text="typetag(item.type)" :type="colortag(item.type)"></uni-tag>
|
||||
</view>
|
||||
<view><strong>数量</strong> : {{item.number}}</view>
|
||||
<view><strong>仓库</strong> :
|
||||
<picker @change="val => {warehouseConfirm(val,item);}" :value="tyindex"
|
||||
:range="range" range-key="warehouseName">
|
||||
<view>选择:{{item.whName}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPwo,
|
||||
listPwo,
|
||||
pwoAtificialClose,
|
||||
handleIn,
|
||||
listCirculateBalance,
|
||||
listSimpleCirculateBalance
|
||||
} from "@/api/mes/pwoDraw.js";
|
||||
import {
|
||||
listWarehouse
|
||||
} from "@/api/wms/pdcIn.js";
|
||||
import {
|
||||
listStock
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
export default {
|
||||
mounted() {
|
||||
listWarehouse().then(async res => {
|
||||
this.range = res.rows
|
||||
// for (var i = 0; i < res.rows.length; i++) {
|
||||
// this.range[0][i].value = res.rows[i].warehouseCode;
|
||||
// this.range[0][i].text = res.rows[i].warehouseName;
|
||||
// }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tyindex: null,
|
||||
index: 0,
|
||||
show: false,
|
||||
materialStockList: [],
|
||||
wmsOpTransferOutStockList: [],
|
||||
disabledIn: false,
|
||||
disabledClose: false,
|
||||
formData: {
|
||||
pwoCode: null,
|
||||
},
|
||||
id: null,
|
||||
value: null,
|
||||
range: [],
|
||||
status: null,
|
||||
pwoJobList: [],
|
||||
rules: {
|
||||
pwoCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产工单!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
typeCancel() {
|
||||
this.warehouseshow = false;
|
||||
},
|
||||
typeConfirm(e, item) {
|
||||
item.warehouseName = this.range[e.detail.value].warehouseName;
|
||||
item.warehouseCode = this.range[e.detail.value].warehouseCode;
|
||||
this.tyindex = e.detail.value
|
||||
},
|
||||
typeClose() {
|
||||
this.warehouseshow = false;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
/** 获取物料信息 */
|
||||
getMaterialStock(ids) {
|
||||
// 清空物料库存信息
|
||||
this.materialStockList = [];
|
||||
listStock({
|
||||
pwoBelongCode: this.formData.pwoCode
|
||||
}).then((resp) => {
|
||||
this.materialStockList = this.materialStockList.concat(resp.rows);
|
||||
});
|
||||
},
|
||||
stockConvertion(code) {
|
||||
this.selectPwoStock(code)
|
||||
|
||||
},
|
||||
selectPwoStock(pwoCode) {
|
||||
listStock({
|
||||
pwoBelongCode: pwoCode
|
||||
}).then((res) => {
|
||||
if (res.rows.length > 0) {
|
||||
this.wmsOpTransferOutStockList = res.rows.map(obj => {
|
||||
return {
|
||||
stockId: obj.id,
|
||||
materialCode: obj.materialCode,
|
||||
materialName: obj.materialName,
|
||||
batchNo: obj.batchNo,
|
||||
lotNo: obj.lotNo,
|
||||
pieceNo: obj.pieceNo,
|
||||
storageLocationCode: obj.storageLocationCode,
|
||||
type: obj.type,
|
||||
num: obj.number
|
||||
}
|
||||
});
|
||||
console.log(this.wmsOpTransferOutStockList)
|
||||
if (this.wmsOpTransferOutStockList && this.wmsOpTransferOutStockList != []) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mes/jobCv/stockConvertion?wmsOpTransferOutStockList=' +
|
||||
encodeURIComponent(
|
||||
JSON.stringify(this.wmsOpTransferOutStockList))
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("未查询到该工单工序消耗信息!")
|
||||
}
|
||||
});
|
||||
},
|
||||
colortag(type) {
|
||||
switch (Number(type)) {
|
||||
case 1:
|
||||
return 'success';
|
||||
break;
|
||||
case 2:
|
||||
return 'warning';
|
||||
break;
|
||||
case 3:
|
||||
return 'error';
|
||||
break;
|
||||
case 4:
|
||||
return 'primary';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
},
|
||||
typetag(type) {
|
||||
switch (Number(type)) {
|
||||
case 1:
|
||||
return '合格品';
|
||||
break;
|
||||
case 2:
|
||||
return '不良品';
|
||||
break;
|
||||
case 3:
|
||||
return '报废品';
|
||||
break;
|
||||
case 4:
|
||||
return '待退料';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
},
|
||||
jobtag(status) {
|
||||
switch (Number(status)) {
|
||||
case 1:
|
||||
return '计划中';
|
||||
break;
|
||||
case 2:
|
||||
return '材料转入';
|
||||
break;
|
||||
case 3:
|
||||
return '作业开工';
|
||||
break;
|
||||
case 4:
|
||||
return '作业暂停';
|
||||
break;
|
||||
case 5:
|
||||
return '作业完工';
|
||||
break;
|
||||
case 6:
|
||||
return '完成品转出';
|
||||
break;
|
||||
case 7:
|
||||
return '取消';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
pwotag(status) {
|
||||
switch (Number(status)) {
|
||||
case 1:
|
||||
return '计划中';
|
||||
break;
|
||||
case 2:
|
||||
return '已生成作业';
|
||||
break;
|
||||
case 3:
|
||||
return '已投料';
|
||||
break;
|
||||
case 4:
|
||||
return '已领料';
|
||||
break;
|
||||
case 5:
|
||||
return '已开工';
|
||||
break;
|
||||
case 6:
|
||||
return '暂停';
|
||||
break;
|
||||
case 7:
|
||||
return '已完成';
|
||||
break;
|
||||
case 8:
|
||||
return '结案';
|
||||
break;
|
||||
case 9:
|
||||
return '取消';
|
||||
break;
|
||||
case 10:
|
||||
return '待入库';
|
||||
break;
|
||||
case 11:
|
||||
return '待转出';
|
||||
break;
|
||||
case 12:
|
||||
return '已转出';
|
||||
break;
|
||||
case 13:
|
||||
return '其他';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
},
|
||||
scanBarCode() {
|
||||
const _this = this;
|
||||
_this.disabledClose = false;
|
||||
_this.disabledIn = false;
|
||||
if (_this.formData.pwoCode) {
|
||||
let obj = {
|
||||
pwoCode: _this.formData.pwoCode
|
||||
}
|
||||
listPwo(obj).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
_this.id = res.rows[0].id;
|
||||
_this.status = res.rows[0].status;
|
||||
if (_this.status >= 7) {
|
||||
_this.disabledClose = true;
|
||||
} else if (_this.status != 10) {
|
||||
_this.disabledIn = true;
|
||||
}
|
||||
} else {
|
||||
_this.$modal.msg("未找到该工单!")
|
||||
}
|
||||
});
|
||||
_this.$modal.loading('提交中')
|
||||
listSimpleCirculateBalance(obj).then((response) => {
|
||||
_this.pwoJobList = response.rows;
|
||||
}).finally(()=>{
|
||||
_this.$modal.closeLoading();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoCode = res.result;
|
||||
_this.scanBarCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
submitClose() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定关闭该生产工单吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
//判断工单是否能关闭
|
||||
if (_this.status >= 7) {
|
||||
_this.$modal.msg("该工单无法关闭!")
|
||||
} else {
|
||||
_this.$modal.loading('提交中')
|
||||
pwoAtificialClose('"' + _this.id + '"').then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("工单关闭成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
report(code) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mes/jobReport/onceReport?code=' + code
|
||||
});
|
||||
},
|
||||
async submitIn() {
|
||||
this.materialStockList = [];
|
||||
this.$modal.loading('提交中')
|
||||
await listStock({
|
||||
pwoBelongCode: this.formData.pwoCode
|
||||
}).then((resp) => {
|
||||
this.$modal.closeLoading();
|
||||
this.materialStockList = this.materialStockList.concat(resp.rows);
|
||||
uni.navigateTo({
|
||||
url: '/pages/mes/jobCv/pwoWarehousing?pwoCode=' + this.formData.pwoCode +
|
||||
'&materialStockList=' + encodeURIComponent(JSON.stringify(
|
||||
this.materialStockList))
|
||||
});
|
||||
});
|
||||
|
||||
// const _this = this;
|
||||
// this.$refs.form.validate().then(res => {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '您确定入库该生产工单吗?',
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {
|
||||
// if (_this.status != 10) {
|
||||
// console.log(_this.status);
|
||||
// _this.$modal.msg("该工单不是‘待入库’状态,请重新输入!")
|
||||
// } else {
|
||||
// _this.formData.warehouseCode = _this.value
|
||||
// console.log(_this.formData)
|
||||
// handleIn(Number(_this.formData.pwoCode.slice(4)), _this.formData
|
||||
// .warehouseCode).then(res => {
|
||||
// _this.$modal.msgSuccess("入库成功!");
|
||||
// setTimeout(() => {
|
||||
// _this.$tab.switchTab("/pages/work/index");
|
||||
// }, 500);
|
||||
// });
|
||||
// }
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.cu-card.article>.cu-item .content .text-content {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.cu-card>.cu-item {
|
||||
margin: 13px 0;
|
||||
}
|
||||
</style>
|
||||
271
pages/mes/jobCv/pwoWarehousing.vue
Normal file
271
pages/mes/jobCv/pwoWarehousing.vue
Normal file
@@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<uni-collapse>
|
||||
|
||||
<uni-forms :modelValue="formData" ref="form" :rules="rules">
|
||||
|
||||
<uni-collapse-item title="工单入库单" :open="true">
|
||||
<uni-forms-item label="生产工单" :labelWidth='90' name="pwoCode">
|
||||
<uni-easyinput suffixIcon="scan" v-model="formData.pwoCode" @iconClick="scanBar" type="text"
|
||||
@confirm="scanBarCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
</uni-collapse-item>
|
||||
<!-- <u-divider text="工单入库单明细"></u-divider> -->
|
||||
<!-- <uni-collapse-item title="工单入库单明细" :open="true"> -->
|
||||
<view :key="item.id" v-for="(item, index) in materialStockList" style="over-flowe">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'. materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="类型" :labelWidth="90">
|
||||
<uni-tag :text="typetag(item.type)" :type="colortag(item.type)"
|
||||
@click="showConfirm(index)"></uni-tag>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="数量" :labelWidth='90' :rules="rules.number"
|
||||
:name="'mesPwoJobCvDetailList.'+ index +'.number'">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="仓库" :labelWidth="90">
|
||||
<!-- <view class="item" catchtap="hidekeyborad">
|
||||
<picker @change="val => {typeConfirm(val,item);}" :value="tyindex" :range="range"
|
||||
range-key="label">
|
||||
<uni-easyinput type="text" v-model="item.whName" @focus="focus" />
|
||||
</picker>
|
||||
</view> -->
|
||||
<uni-data-select v-model="item.whCode" :localdata="range"></uni-data-select>
|
||||
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
<!-- </uni-collapse-item> -->
|
||||
|
||||
</uni-forms>
|
||||
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="submit">入库</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPwo,
|
||||
listPwo,
|
||||
handleIn
|
||||
} from "@/api/mes/pwoDraw.js";
|
||||
import {
|
||||
listWarehouse
|
||||
} from "@/api/wms/pdcIn.js";
|
||||
import {
|
||||
listStock
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
console.log(option);
|
||||
if (option) {
|
||||
this.formData.pwoCode = option.pwoCode;
|
||||
this.materialStockList = JSON.parse(decodeURIComponent(option.materialStockList));
|
||||
this.status = 10;
|
||||
this.isSearchRoute = true;
|
||||
this.scanBarCode()
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
listWarehouse().then(async res => {
|
||||
// this.range = [res.rows]
|
||||
console.log(this.range)
|
||||
// res.rows.map(item => {
|
||||
// item.label = item.warehouseCode + ':' + item.warehouseName;
|
||||
// return item
|
||||
// })
|
||||
this.range = res.rows.map(item => {
|
||||
return {
|
||||
text: item.warehouseCode + ':' + item.warehouseName,
|
||||
value: item.warehouseCode,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
whName: null,
|
||||
flag: false,
|
||||
isSearchRoute: false,
|
||||
selectedWarehouseName: [],
|
||||
materialStockList: [],
|
||||
formData: {
|
||||
pwoCode: null,
|
||||
},
|
||||
tyindex: null,
|
||||
value: 0,
|
||||
range: [],
|
||||
status: null,
|
||||
rules: {
|
||||
pwoCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产工单'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
focus() {
|
||||
console.log('key')
|
||||
if (this.flag) {
|
||||
return
|
||||
} else {
|
||||
console.log('key')
|
||||
// plus.key.hideSoftKeybord()
|
||||
uni.hideKeyboard()
|
||||
}
|
||||
},
|
||||
typetag(type) {
|
||||
switch (Number(type)) {
|
||||
case 1:
|
||||
return '合格品';
|
||||
break;
|
||||
case 2:
|
||||
return '不良品';
|
||||
break;
|
||||
case 3:
|
||||
return '报废品';
|
||||
break;
|
||||
case 4:
|
||||
return '待退料';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
},
|
||||
colortag(type) {
|
||||
switch (Number(type)) {
|
||||
case 1:
|
||||
return 'success';
|
||||
break;
|
||||
case 2:
|
||||
return 'warning';
|
||||
break;
|
||||
case 3:
|
||||
return 'error';
|
||||
break;
|
||||
case 4:
|
||||
return 'primary';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
},
|
||||
change(e) {
|
||||
console.log("e:", e);
|
||||
},
|
||||
scanBarCode() {
|
||||
console.log(this.formData.pwoCode);
|
||||
const _this = this;
|
||||
console.log(_this.formData.pwoCode);
|
||||
if (_this.formData.pwoCode) {
|
||||
let obj = {
|
||||
pwoCode: _this.formData.pwoCode
|
||||
}
|
||||
console.log(1);
|
||||
listPwo(obj).then(async res => {
|
||||
console.log(res.rows[0].id);
|
||||
_this.pwoId = res.rows[0].id;
|
||||
_this.status = res.rows[0].status;
|
||||
})
|
||||
}
|
||||
/** 获取物料信息 */
|
||||
|
||||
// 清空物料库存信息
|
||||
this.materialStockList = [];
|
||||
console.log(this.formData.pwoCode);
|
||||
listStock({
|
||||
pwoBelongCode: this.formData.pwoCode
|
||||
}).then((resp) => {
|
||||
console.log(3);
|
||||
this.materialStockList = this.materialStockList.concat(resp.rows);
|
||||
});
|
||||
|
||||
},
|
||||
typeConfirm(e, item) {
|
||||
this.tyindex = null;
|
||||
console.log(item)
|
||||
item.whName = this.range[e.detail.value].warehouseName;
|
||||
item.whCode = this.range[e.detail.value].warehouseCode;
|
||||
this.tyindex = e.detail.value
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoCode = res.result;
|
||||
_this.scanBarCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定入库该生产工单吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
if (_this.status != 10) {
|
||||
console.log(_this.status);
|
||||
_this.$modal.msg("该工单不是‘待入库’状态,请重新输入!")
|
||||
} else {
|
||||
// _this.formData.warehouseCode = _this.value;
|
||||
let stockWhList = _this.materialStockList.map((obj) => {
|
||||
return {
|
||||
id: obj.id,
|
||||
whCode: obj.whCode,
|
||||
};
|
||||
});
|
||||
_this.$modal.loading('提交中')
|
||||
handleIn(_this.pwoId, '1', stockWhList).then(res => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("入库成功!");
|
||||
|
||||
if (_this.isSearchRoute = true) {
|
||||
setTimeout(() => {
|
||||
_this.$tab.navigateBack();
|
||||
}, 500);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index");
|
||||
}, 500);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
upLoadSelect /deep/ .uni-select__selector-scroll {
|
||||
overflow: hidden;
|
||||
height: 1500px; //调整为合适的高度即可
|
||||
}
|
||||
</style>
|
||||
102
pages/mes/jobCv/stockConvertion.vue
Normal file
102
pages/mes/jobCv/stockConvertion.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<view class="cu-card article ">
|
||||
<uni-row>
|
||||
<uni-col :span="6">
|
||||
<u-button type="success" @click="restore">还原</u-button>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<view class="cu-item shadow borderBottom" v-for="(item,index) in wmsOpTransferOutStockList" :key="index">
|
||||
<view class="content">
|
||||
<view class="desc">
|
||||
<view class="text-content" style="font-size: 15px;">
|
||||
<view><strong>物料编码</strong> : {{item.materialCode}}</view>
|
||||
<view><strong>物料名称</strong> : {{item.materialName}}</view>
|
||||
<view><strong>批号</strong> : {{item.batchNo}}</view>
|
||||
<view><strong>件号</strong> : {{item.pieceNo}}</view>
|
||||
<view><strong>库位</strong> : {{item.storageLocationCode}}</view>
|
||||
<view><uni-row>
|
||||
<uni-col :span="3">
|
||||
<strong>数量</strong> :
|
||||
</uni-col>
|
||||
<uni-col :span="21"> <u-number-box v-model="item.num" @change="valChange"
|
||||
inputWidth="120"></u-number-box></uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<view><strong>单位</strong> : {{item.unitId}}</view>
|
||||
<uni-row>
|
||||
<uni-col :span="18">
|
||||
<view><strong>备注</strong> : {{item.remark}}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<u-button size="small" type="error" icon="trash"
|
||||
@click="deleteList(index)">删除</u-button></uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
customizeConvert
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
console.log(option);
|
||||
this.wmsOpTransferOutStockList = JSON.parse(decodeURIComponent(
|
||||
option.wmsOpTransferOutStockList));
|
||||
this.formerWmsOpTransferOutStockList = JSON.parse(decodeURIComponent(
|
||||
option.wmsOpTransferOutStockList));
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wmsOpTransferOutStockList: [],
|
||||
formerWmsOpTransferOutStockList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteList(i) {
|
||||
this.formerWmsOpTransferOutStockList = [...this.formerWmsOpTransferOutStockList];
|
||||
this.wmsOpTransferOutStockList.splice(i, 1);
|
||||
console.log(this.wmsOpTransferOutStockList);
|
||||
},
|
||||
restore() {
|
||||
this.wmsOpTransferOutStockList = this.formerWmsOpTransferOutStockList;
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定核销吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let requestData = {
|
||||
wmsOpTransferOutStockList: _this.wmsOpTransferOutStockList
|
||||
}
|
||||
console.log(_this.wmsOpTransferOutStockList);
|
||||
_this.$modal.loading('提交中')
|
||||
customizeConvert(requestData).then((response) => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$modal.msgSuccess("核销成功!");
|
||||
setTimeout(() => {
|
||||
_this.$tab.navigateBack();
|
||||
}, 500);
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.cu-card.article>.cu-item .content .text-content {
|
||||
height: 100% !important;
|
||||
}
|
||||
</style>
|
||||
281
pages/mes/jobCv/transfer/from.vue
Normal file
281
pages/mes/jobCv/transfer/from.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<view id="view">
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>工  单:</td><td>{{from.body.pwoCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料编码:</td><td>{{from.body.ptNoTar}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料名称:</td><td>{{from.body.ptTitleTar}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料规格:</td><td>{{from.body.specification1}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料图号:</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.drawingid}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>客户名称:</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.ks_name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否冲孔:</td><td>{{from.body.dynamicField1 === null ? null : from.body.dynamicField1.zdy5}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总 数 量 :</td><td>{{from.body.num}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>部  门:</td><td>
|
||||
<!-- <uni-easyinput type="text" v-model="from.body.deptCode" /> -->
|
||||
<uni-data-select
|
||||
v-model="from.body.deptCode"
|
||||
:localdata="department"
|
||||
></uni-data-select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>接受仓库:</td><td>
|
||||
<!-- <uni-easyinput type="text" v-model="from.body.whCode" /> -->
|
||||
<uni-data-select
|
||||
v-model="from.body.whCode"
|
||||
:localdata="listWarehouse"
|
||||
></uni-data-select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>物料转移单明细信息</p>
|
||||
</div>
|
||||
<scroll-view scroll-y="true" class="scroll" >
|
||||
<view v-for="(item,index) in from.list" :key="index">
|
||||
<table>
|
||||
<tr>
|
||||
<td>物料编码:</td><td>{{item.materialCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料名称:</td><td>{{item.materialName}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料规格:</td><td>{{item.specification1}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料类型:</td><td>{{item.typeText}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总 数 量 :</td><td>{{item.inNumber}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>入库数量</td><td><uni-easyinput type="number" v-model="item.number" @input="inputInNumber($event,item)" :key="item.number+item.materialCode"/></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<button id="button" type="primary" @click="submit" :disabled="!getOpen">提交</button>
|
||||
<uni-popup ref="message" type="message">
|
||||
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addConversion
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
from:{
|
||||
body:{
|
||||
},
|
||||
list:{}
|
||||
},
|
||||
department:[],
|
||||
listWarehouse:[],
|
||||
message:{
|
||||
msgType:'warn',
|
||||
messageText:'请先查询设备信息'
|
||||
},
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 挂载前执行
|
||||
*/
|
||||
beforeMount() {
|
||||
//把查询页面查询到的数据放入进来
|
||||
//处理详情数据
|
||||
const {body, list} = this.$store.state.pwo.data
|
||||
const typeObj = {
|
||||
1:'合格品',
|
||||
2:'不良品',
|
||||
3:'报废品'
|
||||
}
|
||||
for(let i in list){
|
||||
list[i].inNumber = list[i].number
|
||||
list[i].typeText =typeObj[list[i].type]
|
||||
}
|
||||
this.from = Object.assign({},{body,list})
|
||||
console.log(this.from)
|
||||
this.from.body.dynamicField1 = JSON.parse(this.from.body.dynamicField1)
|
||||
//接收完后清空vuex里面的数据清空
|
||||
this.$store.commit('updatData',{})
|
||||
|
||||
//处理部门数据
|
||||
const department = this.$store.state.pwo.department
|
||||
for(let i in department){
|
||||
const item = department[i]
|
||||
item.value = item.departmentCode
|
||||
item.text = item.departmentCode + "-" + item.departmentTitle
|
||||
}
|
||||
this.department = department
|
||||
|
||||
//处理仓库数据
|
||||
const listWarehouse = this.$store.state.pwo.listWarehouse
|
||||
for(let i in listWarehouse){
|
||||
const item = listWarehouse[i]
|
||||
item.value = item.warehouseCode
|
||||
item.text = item.warehouseCode + '-' + item.warehouseName
|
||||
}
|
||||
this.listWarehouse = listWarehouse
|
||||
},
|
||||
mounted() {
|
||||
//获取屏幕宽高
|
||||
updateCss(resSize())
|
||||
},
|
||||
computed:{
|
||||
getOpen(){
|
||||
return Boolean(this.from.list.length)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 提交按钮点击事件
|
||||
*/
|
||||
async submit(){
|
||||
try{
|
||||
const {body,list} = this.from;
|
||||
const { pwoCode ,id ,status,deptCode, whCode} = body
|
||||
const data = {
|
||||
deptCode,
|
||||
whCode,
|
||||
type:"3",
|
||||
delStatus:"0",
|
||||
genRedraw: false,
|
||||
mesPwoJobCvDetailList:list,
|
||||
dynamicField1:JSON.stringify(body.dynamicField1),
|
||||
pwoCode:pwoCode,
|
||||
pwoId:id,
|
||||
status,
|
||||
}
|
||||
addConversion(data).then(res => {
|
||||
if(res.code === 200){
|
||||
this.messageType({
|
||||
msgType:'success',
|
||||
messageText:'提交成功'
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 2100); // 3000毫秒 = 3秒
|
||||
|
||||
}
|
||||
})
|
||||
}catch(e){
|
||||
this.messageType({
|
||||
msgType:'error',
|
||||
messageText:'提交失败,失败原因‘' + e +'’'
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 提示信息
|
||||
* @param {Object|undefined} value
|
||||
* {msgType,messageText} 参数里面需要包含这两个键
|
||||
*/
|
||||
messageType(obj){
|
||||
const _self = this;
|
||||
let message ={}
|
||||
if(obj === undefined){
|
||||
message = {
|
||||
msgType:'error',
|
||||
messageText:'请填写设备代码'
|
||||
}
|
||||
}else{
|
||||
message = {
|
||||
msgType:obj.msgType,
|
||||
messageText:obj.messageText
|
||||
}
|
||||
}
|
||||
_self.message = Object.assign({},message)
|
||||
return _self.$refs.message.open()
|
||||
},
|
||||
/**
|
||||
* 入库数量输入事件
|
||||
* @param {number} value,输入的值
|
||||
* @param {Object} item,当前的明细信息
|
||||
*/
|
||||
inputInNumber(value,item){
|
||||
const { number } = item
|
||||
if(number > value){
|
||||
item.inNumber = number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕宽高
|
||||
*/
|
||||
function resSize(){
|
||||
let width = 0;
|
||||
let height = 0;
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
width = res.windowWidth; // 窗口宽度
|
||||
height = res.windowHeight; // 窗口高度
|
||||
}
|
||||
});
|
||||
return {width,height}
|
||||
}
|
||||
/**
|
||||
* 设置元素高度
|
||||
* @param {Object} size
|
||||
*/
|
||||
function updateCss(size){
|
||||
document.querySelector("#view>div").style.height = size.height * 0.35 + 'px'
|
||||
document.querySelector(".scroll").style.height = size.height * 0.65 - 46 + 'px'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
padding-top: 1vw;
|
||||
#view {
|
||||
--heightSize : 0;
|
||||
width: 100%;
|
||||
& > div {
|
||||
width: 100%;
|
||||
};
|
||||
& > .scroll {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 95%;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 14px;
|
||||
margin:0 auto;
|
||||
tr td:first-child{
|
||||
width: 30%;
|
||||
}
|
||||
};
|
||||
p {
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
167
pages/mes/jobCv/transfer/index.vue
Normal file
167
pages/mes/jobCv/transfer/index.vue
Normal file
@@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="form" label-width="25%" label-align="right" :rules="rules">
|
||||
<uni-forms-item label="工单编号:" name="pwoCode" >
|
||||
<uni-easyinput v-model="form.pwoCode" placeholder="请输入不小于5位的工单编号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label='批号:' name='batchNo'>
|
||||
<uni-easyinput v-model="form.batchNo" placeholder="请输入不小于5位的批号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料编码:" >
|
||||
<uni-easyinput v-model="form.ptNoTar" placeholder="请输入物料编码" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称:" >
|
||||
<uni-easyinput v-model="form.ptTitleTar" placeholder="请输入物料名称" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料规格:" >
|
||||
<uni-easyinput v-model="form.specification1" placeholder="请输入物料规格" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button type="primary" @click="clickSubmit(form)" :disabled="formComputed">查询</button>
|
||||
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
|
||||
<!-- 加载动画 -->
|
||||
<loding-vue/>
|
||||
</uni-popup>
|
||||
<uni-popup ref="message" type="message">
|
||||
<uni-popup-message :type="message.type" :message="message.messageText" :duration="message.duration"></uni-popup-message>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoLike
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
import {listDepartment} from"@/api/basic/department.js"
|
||||
import {
|
||||
hasValue
|
||||
} from "@/utils/judge"
|
||||
import {listWarehouse} from "@/api/wms/pdcIn.js"
|
||||
//引入加载动画
|
||||
import lodingVue from "@/utils/loding/loding.vue";
|
||||
export default {
|
||||
components:{
|
||||
lodingVue
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/**表单数据 */
|
||||
form:{
|
||||
/** 工单编号 */
|
||||
pwoCode : null,
|
||||
/** 批号 */
|
||||
batchNo : null,
|
||||
/** 物料编码 */
|
||||
ptNoTar : null,
|
||||
/** 物料名称 */
|
||||
ptTitleTar : null,
|
||||
/** 物料规格 */
|
||||
specification1 : null
|
||||
},
|
||||
/** 校验规则 */
|
||||
rules:{
|
||||
pwoCode:{
|
||||
rules:[
|
||||
{
|
||||
required : true,
|
||||
},
|
||||
]
|
||||
},
|
||||
batchNo:{
|
||||
rules:[
|
||||
{
|
||||
required : true,
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
/** 提示信息 */
|
||||
message:{
|
||||
//类型 succes成功,warn警告error失败inf消息
|
||||
type:'error',
|
||||
//提示信息
|
||||
messageText:'没有符合条件的数据',
|
||||
//显示时间
|
||||
duration:1500
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted(){
|
||||
//在页面挂载的时候获取部门数据
|
||||
const data = await Promise.all([ listDepartment(), listWarehouse()])
|
||||
this.$store.commit('updateDepartment',data[0].rows)
|
||||
this.$store.commit('updateWarehouse',data[1].rows)
|
||||
},
|
||||
/**
|
||||
* 计算属性
|
||||
*/
|
||||
computed:{
|
||||
/**
|
||||
* 判断form值是否符合要求
|
||||
* 如果符合则可以点击按钮,没有不能点击
|
||||
*/
|
||||
formComputed(){
|
||||
const {pwoCode,batchNo} = this.form
|
||||
//判断工单编号和批号是否有值
|
||||
//如果有值且长度大于5位则必填标志消失,并且提交按钮可以点击
|
||||
if((hasValue(pwoCode) && pwoCode.length >= 5) || (hasValue(batchNo) && batchNo.length >= 5)){
|
||||
if(hasValue(pwoCode) && pwoCode.length >= 5) this.rules.batchNo.rules[0].required = false
|
||||
if(hasValue(batchNo) && batchNo.length >= 5) this.rules.pwoCode.rules[0].required = false
|
||||
return false
|
||||
}
|
||||
this.rules.batchNo.rules[0].required = this.rules.pwoCode.rules[0].required = true
|
||||
return true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 提交按钮点击事件
|
||||
*/
|
||||
async clickSubmit(){
|
||||
const _self = this
|
||||
try{
|
||||
//打开蒙层
|
||||
this.$refs.popup.open()
|
||||
//查询接口
|
||||
const res = await listPwoLike(this.form)
|
||||
//关闭蒙层
|
||||
//当没有查到数据给一个提示
|
||||
if(res.total === 0 || res.rows.length === 0) {
|
||||
this.$refs.message.open()
|
||||
return
|
||||
}
|
||||
//通过vuex把获取到的数据保存下来 this.$store.state.pwo
|
||||
this.$store.commit('updatData',res.rows)
|
||||
uni.navigateTo({
|
||||
url:'/pages/mes/jobCv/transfer/table'
|
||||
})
|
||||
}catch{
|
||||
this.message.messageText="请求超时"
|
||||
this.$refs.message.open()
|
||||
}finally{
|
||||
this.$refs.popup.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 页面卸载的时候清空数据
|
||||
*/
|
||||
onUnload(){
|
||||
this.$store.commit('updateDepartment',[])
|
||||
this.$store.commit('updateWarehouse',[])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
//设置页面背景颜色
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
padding-top: 1vw;
|
||||
}
|
||||
view {
|
||||
width: 98%;
|
||||
margin: 2% auto;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
108
pages/mes/jobCv/transfer/table.vue
Normal file
108
pages/mes/jobCv/transfer/table.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view>
|
||||
<div v-for="(item,index) in data" :key="index">
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>工  单:</td><td>{{item.pwoCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料编码:</td><td>{{item.ptNoTar}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料名称:</td><td>{{item.ptTitleTar}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料规格:</td><td>{{item.specification1}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>物料图号:</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>客户名称:</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否冲孔:</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总 数 量 </td><td>{{item.num}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<u-button class="uButton" @click="clickButton(item)">入库</u-button>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPwoByCode,
|
||||
getDetailData
|
||||
} from "@/api/mes/pwoIn.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data:{}
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
//把查询页面查询到的数据放入进来
|
||||
this.data =this.$store.state.pwo.data
|
||||
//接收完后清空vuex里面的数据清空
|
||||
this.$store.commit('updatData',{})
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 入库按钮点击事件
|
||||
* @param {Object} item 当前点击按钮的数据
|
||||
*/
|
||||
async clickButton(item){
|
||||
const {pwoCode,id} = item
|
||||
const obj = {
|
||||
delStatus : "0",
|
||||
genRedraw : true,
|
||||
pwoCode,
|
||||
pwoI : id,
|
||||
status : '0',
|
||||
type : "3"
|
||||
}
|
||||
const res = await Promise.all([getPwoByCode(pwoCode),getDetailData(obj)])
|
||||
this.$store.commit("updatData",{body:res[0].data,list:res[1].data})
|
||||
uni.navigateTo({
|
||||
url:"/pages/mes/jobCv/transfer/from"
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$fontSize : 14px ;
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
padding-top: 1vw;
|
||||
view > div {
|
||||
position: relative;
|
||||
width: 95%;
|
||||
border-width: 1px 2px;
|
||||
border-style: solid;
|
||||
border: 2px solid #e0fff9;
|
||||
margin: 1px 2.5% 2px 2.5%;
|
||||
display: flex;
|
||||
div:first-child {
|
||||
width: 85%;
|
||||
margin-right:2%
|
||||
};
|
||||
div:last-child {
|
||||
margin-right: auto;
|
||||
width: 13%;
|
||||
& > .uButton{
|
||||
height: 1.65 * 8 * $fontSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user