工器具退料

This commit is contained in:
hayu 2025-05-30 13:34:07 +08:00
parent a1935dbdc6
commit 38fe60ebc5
7 changed files with 269 additions and 132 deletions

View File

@ -9,8 +9,6 @@
left-text="返回" left-text="返回"
:title="title" :title="title"
@clickLeft="back" @clickLeft="back"
right-icon="scan"
@clickRight="rightClick"
/> />
<div class="content"> <div class="content">
<uni-section title="任务信息" type="line"></uni-section> <uni-section title="任务信息" type="line"></uni-section>
@ -308,6 +306,14 @@ const changeProd = (e) => {
// //
const changeEquipment = (e) => { const changeEquipment = (e) => {
console.log('🚀 ~ changeEquipment ~ e:', e) console.log('🚀 ~ changeEquipment ~ e:', e)
if (e.manageType !== '1') {
//
uni.showToast({
icon: 'none',
title: '请选择数量设备',
})
return
}
// equipmentList.value id typeName // equipmentList.value id typeName
const equipment = findEquipmentById(equipmentList.value, e.parentId) const equipment = findEquipmentById(equipmentList.value, e.parentId)
tableData.value.push({ tableData.value.push({

View File

@ -61,7 +61,7 @@
<div>工程名称: {{ item.proName }}</div> <div>工程名称: {{ item.proName }}</div>
<div>退料人: {{ item.backPerson }}</div> <div>退料人: {{ item.backPerson }}</div>
<div>联系电话: {{ item.phone }}</div> <div>联系电话: {{ item.phone }}</div>
<div>已退数量: {{item.status == 2 ? item.backNum : 0}}</div> <div>已退数量: {{item.backNum}}</div>
<div>备注: {{ item.remark }}</div> <div>备注: {{ item.remark }}</div>
<div> <div>
状态: 状态:
@ -81,7 +81,7 @@
</template> </template>
<script setup> <script setup>
import { onLoad } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { getBackListAPI, deleteLeaseApplyApi } from '@/services/picking/outbound.js' import { getBackListAPI, deleteLeaseApplyApi } from '@/services/picking/outbound.js'
import { backSubmit, deleteBackApi } from '../../services/back' import { backSubmit, deleteBackApi } from '../../services/back'
@ -244,6 +244,10 @@ onLoad((options) => {
console.log('🚀 ~ onLoad ~ options:', options) console.log('🚀 ~ onLoad ~ options:', options)
getList() getList()
}) })
onShow(()=>{
getList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -17,12 +17,9 @@
<uni-forms-item label="退料班组:" name="teamName"> <uni-forms-item label="退料班组:" name="teamName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.teamName }}</span> <span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.teamName }}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="退料工程:" name="proName"> <uni-forms-item label="工程名称" name="proName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span> <span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="退料单号:" name="code">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson"> <uni-forms-item label="退料人员:" name="backPerson">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span> <span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item> </uni-forms-item>
@ -34,9 +31,9 @@
<div class="card" style="margin-top: 10px;"> <div class="card" style="margin-top: 10px;">
<uni-row :gutter="24"> <uni-row :gutter="24">
<uni-col :span="6">接收方式</uni-col> <uni-col :span="6">接收方式</uni-col>
<uni-col :span="6"> <!-- <uni-col :span="6">-->
<view class="coding-btn" @click="onCodeIdentify">编码识别</view> <!-- <view class="coding-btn" @click="onCodeIdentify">编码识别</view>-->
</uni-col> <!-- </uni-col>-->
<uni-col :span="6"> <uni-col :span="6">
<view class="coding-btn" @click="scanStart">二维码识别</view> <view class="coding-btn" @click="scanStart">二维码识别</view>
</uni-col> </uni-col>
@ -75,13 +72,13 @@
</uni-row> </uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;"> <uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">外观判定</uni-col> <uni-col :span="6">损坏价值判定</uni-col>
<uni-col :span="16"> <uni-col :span="16">
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> --> <uni-easyinput placeholder="请输入内容" v-model="apDetection"/>
<radio-group @change="changeRadio"> <!-- <radio-group @change="changeRadio">-->
<radio value="完好" checked style="margin-right: 5px;">完好</radio> <!-- <radio value="完好" checked style="margin-right: 5px;">完好</radio>-->
<radio value="损坏">损坏</radio> <!-- <radio value="损坏">损坏</radio>-->
</radio-group> <!-- </radio-group>-->
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;"> <uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
@ -105,17 +102,18 @@
<script setup> <script setup>
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { getMachine,insertApp } from '../../services/back.js'; import { editBack, getMachine, insertApp } from '../../services/back.js'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
const title = ref('退料任务') const title = ref('退料任务')
const taskInfo = ref({}) const taskInfo = ref({})
const tableList = ref({})
const maId = ref("") // const maId = ref("") //
const maCode = ref("") // const maCode = ref("") //
const typeName = ref("")// const typeName = ref("")//
const materialName = ref("") // const materialName = ref("") //
const typeId = ref("") //id const typeId = ref("") //id
const maStatusName = ref("") // const maStatusName = ref("") //
const apDetection = ref("完好") // const apDetection = ref("") //
const imgBeseUrl = ref("") // const imgBeseUrl = ref("") //
const bmFileInfos = ref([])// const bmFileInfos = ref([])//
@ -126,10 +124,11 @@ const changeRadio = (e) => {
// //
const getMaInfo = () => { const getMaInfo = () => {
resetFormFields();
console.log(maCode.value) console.log(maCode.value)
let param={ let param={
"maCode":maCode.value, "maCode":maCode.value,
"unitId":taskInfo.value.unitId, "teamId":taskInfo.value.teamId,
"proId":taskInfo.value.proId "proId":taskInfo.value.proId
} }
getMachine(param).then(res => { getMachine(param).then(res => {
@ -144,6 +143,7 @@ const getMaInfo = () => {
}else{ }else{
uni.showToast({ title: '该编码非该班组工程领用,不可退料!', icon: 'none' }) uni.showToast({ title: '该编码非该班组工程领用,不可退料!', icon: 'none' })
} }
} else {
} }
}).catch(error => { }).catch(error => {
console.log(error) console.log(error)
@ -152,50 +152,115 @@ const getMaInfo = () => {
const qrCode = ref("") // const qrCode = ref("") //
// //
const scanStart = async () => { const scanStart = async () => {
qrCode.value="" try {
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module") resetFormFields();
mpaasScanModule.mpaasScan({ // uni-appAPI
// qrCodebarCode const res = await uni.scanCode({
'scanType': ['qrCode','barCode'], onlyFromCamera: false, //
// false scanType: ['qrCode', 'barCode'] //
'hideAlbum': false, });
//ios zh-Hansen
'language' : 'en', console.log('扫码结果:', res);
//(ios)
'failedMsg': '未识别到二维码,请重试', //
//Android if (res.result) {
'screenType': 'full' qrCode.value = res.result;
},(ret) => { console.log('扫码内容:', qrCode.value);
console.log(ret)
if(ret.resp_code==10){ let param = {
uni.showToast({ title: '用户取消', icon: 'none' }) "qrCode": qrCode.value,
} "teamId": taskInfo.value.teamId,
if(ret.resp_code==11){ "proId": taskInfo.value.proId
uni.showToast({ title: '扫码失败', icon: 'none' }) };
} console.log(param)
if(ret.resp_code==1000){ //
qrCode.value = ret.resp_result; getMachine(param).then(res => {
console.log(qrCode.value) console.log('接口返回:', res);
let param={ if (res.data && res.data.length > 0) {
"qrCode":qrCode.value, const machineInfo = res.data[0];
"unitId":taskInfo.value.unitId, maCode.value = machineInfo.maCode;
"proId":taskInfo.value.proId typeName.value = machineInfo.typeName;
} materialName.value = machineInfo.typeModelName;
getMachine(param).then(res => { maStatusName.value = machineInfo.maStatusName;
console.log(res) maId.value = machineInfo.maId;
console.log(res.data[0]) typeId.value = machineInfo.typeId;
maCode.value = res.data[0].maCode } else {
typeName.value = res.data[0].typeName; uni.showToast({
materialName.value = res.data[0].typeModelName; title: '未找到对应设备信息',
maStatusName.value = res.data[0].maStatusName; icon: 'none'
maId.value = res.data[0].maId; });
typeId.value = res.data[0].typeId; }
}).catch(error => { }).catch(error => {
console.log(error) console.error('接口请求错误:', error);
}) uni.showToast({
} title: '获取设备信息失败',
}) icon: 'none'
} });
});
}
} catch (err) {
console.error('扫码错误:', err);
//
if (err.errMsg.includes('cancel')) {
uni.showToast({
title: '用户取消扫码',
icon: 'none'
});
} else {
uni.showToast({
title: '扫码失败,请重试',
icon: 'none'
});
}
}
};
// const scanStart = async () => {
// qrCode.value=""
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// mpaasScanModule.mpaasScan({
// // qrCodebarCode
// 'scanType': ['qrCode','barCode'],
// // false
// 'hideAlbum': false,
// //ios zh-Hansen
// 'language' : 'en',
// //(ios)
// 'failedMsg': '',
// //Android
// 'screenType': 'full'
// },(ret) => {
// console.log(ret)
// if(ret.resp_code==10){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==11){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==1000){
// qrCode.value = ret.resp_result;
// console.log(qrCode.value)
// let param={
// "qrCode":qrCode.value,
// "teamId":taskInfo.value.teamId,
// "proId":taskInfo.value.proId
// }
// getMachine(param).then(res => {
// console.log(res)
// console.log(res.data[0])
// maCode.value = res.data[0].maCode
// typeName.value = res.data[0].typeName;
// materialName.value = res.data[0].typeModelName;
// maStatusName.value = res.data[0].maStatusName;
// maId.value = res.data[0].maId;
// typeId.value = res.data[0].typeId;
// }).catch(error => {
// console.log(error)
// })
// }
// })
// }
// // // //
// const scanStart = () => { // const scanStart = () => {
// console.log('--') // console.log('--')
@ -224,49 +289,97 @@ const onCodeIdentify = () => {
} }
// //
const submitCode = () => { const submitCode = () => {
console.log(taskInfo.value) console.log('提交数据:', taskInfo.value);
if(maId.value==""){
uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' }) // maId
}else{ if (!maId.value) {
// console.log(typeList.value) uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' });
let obj = { return;
"maId":maId.value, }
"maCode":maCode.value,
"typeId":typeId.value, // tableListmaIdmaCode
"apDetection":apDetection.value, let isDuplicate = false;
goodNum: apDetection.value == '完好' ? 1 : 0,
badNum: apDetection.value == '损坏' ? 1 : 0, // tableListmaCodeList
"bmFileInfos":bmFileInfos.value tableList.value.forEach(item => {
} if (item.maCodeList && item.maCodeList.length > 0) {
let param = { const duplicateItem = item.maCodeList.find(codeItem =>
"backApplyInfo":taskInfo.value, codeItem.maId === maId.value || codeItem.maCode === maCode.value
"backApplyDetails":obj );
}
insertApp(param).then(res => { if (duplicateItem) {
console.log(res) isDuplicate = true;
if(res.code==200){ }
uni.showToast({ title: '添加成功!', icon: 'none' }) }
typeName.value=""; });
materialName.value="";
maStatusName.value=""; if (isDuplicate) {
typeId.value=""; uni.showToast({
maId.value="" title: '该设备已存在退料列表中,请勿重复添加!',
maCode.value="" icon: 'none',
typeId.value="" duration: 2000
apDetection.value="完好" });
bmFileInfos.value=[] return;
imgBeseUrl.value = "" }
// uni.navigateBack({
// delta: 1 // //
// }); let obj = {
}else{ "maId": maId.value,
uni.showToast({ title: res.msg, icon: 'none' }) "maCode": maCode.value,
} "typeId": typeId.value,
}).catch(error => { "apDetection": apDetection.value,
console.log(error) "bmFileInfos": bmFileInfos.value,
}) "preNum":1
} };
}
let param = {
"backApplyInfo": taskInfo.value,
"backApplyDetailsList": [...tableList.value, obj]
};
console.log("提交:",param)
//
editBack(param).then(res => {
console.log('接口返回:', res);
if (res.code == 200) {
uni.showToast({
title: '保存成功!',
icon: 'success',
duration: 1500
});
//
resetFormFields();
} else {
uni.showToast({
title: res.msg || '保存失败',
icon: 'none',
duration: 2000
});
}
}).catch(error => {
console.error('提交错误:', error);
uni.showToast({
title: '提交失败,请稍后重试',
icon: 'none',
duration: 2000
});
});
};
//
const resetFormFields = () => {
typeName.value = "";
materialName.value = "";
maStatusName.value = "";
typeId.value = "";
maId.value = "";
maCode.value = "";
typeId.value = "";
apDetection.value = "";
bmFileInfos.value = [];
imgBeseUrl.value = "";
};
// //
const uploadImg = () => { const uploadImg = () => {
@ -288,7 +401,6 @@ const uploadImg = () => {
success: (res) => { success: (res) => {
res = JSON.parse(res.data) res = JSON.parse(res.data)
console.log('上传成功', res.code); console.log('上传成功', res.code);
console.log('上传成功', res.data);
if(res.code&&res.code==200){ if(res.code&&res.code==200){
let obj = { let obj = {
"name":res.data.name, "name":res.data.name,
@ -321,7 +433,8 @@ const back = () => {
onLoad((options)=>{ onLoad((options)=>{
console.log(options) console.log(options)
taskInfo.value = JSON.parse(options.taskInfo) taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value) tableList.value = JSON.parse(options.tableList)
console.log(tableList.value)
}) })
</script> </script>

View File

@ -41,7 +41,7 @@
<!-- 表头行 --> <!-- 表头行 -->
<uni-tr> <uni-tr>
<uni-th width="160px" style="font-size: 24rpx;" align="center">设备编码</uni-th> <uni-th width="160px" style="font-size: 24rpx;" align="center">设备编码</uni-th>
<uni-th width="130px" style="font-size: 24rpx;" align="center">外观</uni-th> <uni-th width="130px" style="font-size: 24rpx;" align="center">损坏价值判定</uni-th>
<!-- <uni-th width="70px" style="font-size: 24rpx;" align="center">创建人</uni-th>--> <!-- <uni-th width="70px" style="font-size: 24rpx;" align="center">创建人</uni-th>-->
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">创建时间</uni-th>--> <!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">创建时间</uni-th>-->
<uni-th width="80px" style="font-size: 24rpx;" align="center">操作</uni-th> <uni-th width="80px" style="font-size: 24rpx;" align="center">操作</uni-th>
@ -50,9 +50,9 @@
<uni-tr v-for="(item,index) in codeList" :key="item.id"> <uni-tr v-for="(item,index) in codeList" :key="item.id">
<uni-td style="font-size: 24rpx;text-align: center;">{{item.maCode}}</uni-td> <uni-td style="font-size: 24rpx;text-align: center;">{{item.maCode}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;"> <uni-td style="font-size: 24rpx;text-align: center;">
<!-- <span>{{item.apDetection}}</span> --> <span>{{item.apDetection}}</span>
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> --> <!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
<span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span> <!-- <span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span>-->
</uni-td> </uni-td>
<!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>--> <!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>-->
<!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>--> <!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>-->

View File

@ -187,14 +187,28 @@ const getMaCode = () => {
} }
// //
const selectMaCode = (e) => { const selectMaCode = (e) => {
console.log(e) console.log(e);
maCodeSelectList.value.forEach(item=>{
console.log(item) // maCodeSelectList
if(item.typeId==e){ const selectedItem = maCodeSelectList.value.find(item => item.typeId === e);
typeList.value.push(item) if (!selectedItem) return;
}
}) // typeListtypeId
console.log(typeList.value) const existsInTypeList = typeList.value.some(item => item.typeId === selectedItem.typeId);
// tableListtypeId
const existsInTableList = tableList.value.some(item => item.typeId === selectedItem.typeId);
if (existsInTypeList || existsInTableList) {
uni.showToast({
title: '该规格型号已存在,请勿重复添加',
icon: 'none'
});
return;
}
// typeList
typeList.value.push(selectedItem);
console.log(typeList.value);
} }
// //
const submitNum = () => { const submitNum = () => {
@ -216,7 +230,7 @@ const submitNum = () => {
icon: 'none', icon: 'none',
}) })
return return
} else if (typeList.value[i].preNum< typeList.value[i].num) { } else if (typeList.value[i].preNum>typeList.value[i].num) {
uni.showToast({ uni.showToast({
title: `${i + 1}行退料数量不能大于在用数量`, title: `${i + 1}行退料数量不能大于在用数量`,
icon: 'none', icon: 'none',

View File

@ -52,9 +52,9 @@
<uni-td style="font-size: 24rpx;text-align: center;"> <uni-td style="font-size: 24rpx;text-align: center;">
<span>{{item.preNum}}</span> <span>{{item.preNum}}</span>
</uni-td> </uni-td>
<!-- &lt;!&ndash; <uni-td style="font-size: 24rpx;text-align: center;">--> <uni-td style="font-size: 24rpx;text-align: center;">
<!-- <span>{{item.apDetection}}</span> --> <span>{{item.apDetection}}</span>
<!-- </uni-td> &ndash;&gt;--> </uni-td>
<!-- <uni-td style="font-size: 24rpx;text-align: center;">--> <!-- <uni-td style="font-size: 24rpx;text-align: center;">-->
<!-- <span>{{item.goodNum}}</span> --> <!-- <span>{{item.goodNum}}</span> -->
<!-- </uni-td>--> <!-- </uni-td>-->

View File

@ -29,7 +29,7 @@
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container"> <scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)"> <div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)">
<uni-swipe-action class="swipe-action"> <uni-swipe-action class="swipe-action">
<uni-swipe-action-item @click="onClick($event, item)" :right-options="item.manageType==1 ? options:options2"> <uni-swipe-action-item @click="onClick($event, item)" :right-options="(item.status == 2) ? options2 : (item.manageType == 1 ? options : options2)">
<div class="title"> <div class="title">
<span style="font-size: 15px; font-weight: 800">退料任务</span> <span style="font-size: 15px; font-weight: 800">退料任务</span>
<!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> --> <!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> -->
@ -47,7 +47,7 @@
</uni-row> </uni-row>
<uni-row :gutter="24"> <uni-row :gutter="24">
<uni-col :span="8">已退数量</uni-col> <uni-col :span="8">已退数量</uni-col>
<uni-col :span="16"><div class="cont">{{ item.status === '2' ? item.preNum : 0 }}</div></uni-col> <uni-col :span="16"><div class="cont">{{ item.preNum}}</div></uni-col>
</uni-row> </uni-row>
<uni-row :gutter="24"> <uni-row :gutter="24">
<uni-col :span="8">单位</uni-col> <uni-col :span="8">单位</uni-col>
@ -136,7 +136,7 @@ const search = () => {
} }
// //
const goCode = () => { const goCode = () => {
uni.navigateTo({ url: `/pages/toolsBack/toolsBackCode?taskInfo=${JSON.stringify(taskInfo.value)}` }) uni.navigateTo({ url: `/pages/toolsBack/toolsBackCode?taskInfo=${JSON.stringify(taskInfo.value)}&tableList=${JSON.stringify(tableList.value)}` })
} }
// //
const goNum = () => { const goNum = () => {