init project

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

View File

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

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

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

View File

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

View File

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

View File

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

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

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

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

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

View File

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

View File

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

View File

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