工器具退料

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

View File

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

View File

@ -17,12 +17,9 @@
<uni-forms-item label="退料班组:" name="teamName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.teamName }}</span>
</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>
</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">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item>
@ -34,9 +31,9 @@
<div class="card" style="margin-top: 10px;">
<uni-row :gutter="24">
<uni-col :span="6">接收方式</uni-col>
<uni-col :span="6">
<view class="coding-btn" @click="onCodeIdentify">编码识别</view>
</uni-col>
<!-- <uni-col :span="6">-->
<!-- <view class="coding-btn" @click="onCodeIdentify">编码识别</view>-->
<!-- </uni-col>-->
<uni-col :span="6">
<view class="coding-btn" @click="scanStart">二维码识别</view>
</uni-col>
@ -75,13 +72,13 @@
</uni-row>
<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-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
<radio-group @change="changeRadio">
<radio value="完好" checked style="margin-right: 5px;">完好</radio>
<radio value="损坏">损坏</radio>
</radio-group>
<uni-easyinput placeholder="请输入内容" v-model="apDetection"/>
<!-- <radio-group @change="changeRadio">-->
<!-- <radio value="完好" checked style="margin-right: 5px;">完好</radio>-->
<!-- <radio value="损坏">损坏</radio>-->
<!-- </radio-group>-->
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
@ -104,18 +101,19 @@
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getMachine,insertApp } from '../../services/back.js';
import { onLoad } from '@dcloudio/uni-app'
import { editBack, getMachine, insertApp } from '../../services/back.js'
import { baseURL } from '@/utils/http'
const title = ref('退料任务')
const taskInfo = ref({})
const taskInfo = ref({})
const tableList = ref({})
const maId = ref("") //
const maCode = ref("") //
const typeName = ref("")//
const materialName = ref("") //
const typeId = ref("") //id
const maStatusName = ref("") //
const apDetection = ref("完好") //
const apDetection = ref("") //
const imgBeseUrl = ref("") //
const bmFileInfos = ref([])//
@ -126,10 +124,11 @@ const changeRadio = (e) => {
//
const getMaInfo = () => {
resetFormFields();
console.log(maCode.value)
let param={
"maCode":maCode.value,
"unitId":taskInfo.value.unitId,
"teamId":taskInfo.value.teamId,
"proId":taskInfo.value.proId
}
getMachine(param).then(res => {
@ -144,58 +143,124 @@ const getMaInfo = () => {
}else{
uni.showToast({ title: '该编码非该班组工程领用,不可退料!', icon: 'none' })
}
} else {
}
}).catch(error => {
console.log(error)
console.log(error)
})
}
const qrCode = ref("") //
//
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,
"unitId":taskInfo.value.unitId,
"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)
})
}
})
}
try {
resetFormFields();
// uni-appAPI
const res = await uni.scanCode({
onlyFromCamera: false, //
scanType: ['qrCode', 'barCode'] //
});
console.log('扫码结果:', res);
//
if (res.result) {
qrCode.value = res.result;
console.log('扫码内容:', qrCode.value);
let param = {
"qrCode": qrCode.value,
"teamId": taskInfo.value.teamId,
"proId": taskInfo.value.proId
};
console.log(param)
//
getMachine(param).then(res => {
console.log('接口返回:', res);
if (res.data && res.data.length > 0) {
const machineInfo = res.data[0];
maCode.value = machineInfo.maCode;
typeName.value = machineInfo.typeName;
materialName.value = machineInfo.typeModelName;
maStatusName.value = machineInfo.maStatusName;
maId.value = machineInfo.maId;
typeId.value = machineInfo.typeId;
} else {
uni.showToast({
title: '未找到对应设备信息',
icon: 'none'
});
}
}).catch(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 = () => {
// console.log('--')
@ -224,49 +289,97 @@ const onCodeIdentify = () => {
}
//
const submitCode = () => {
console.log(taskInfo.value)
if(maId.value==""){
uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' })
}else{
// console.log(typeList.value)
let obj = {
"maId":maId.value,
"maCode":maCode.value,
"typeId":typeId.value,
"apDetection":apDetection.value,
goodNum: apDetection.value == '完好' ? 1 : 0,
badNum: apDetection.value == '损坏' ? 1 : 0,
"bmFileInfos":bmFileInfos.value
}
let param = {
"backApplyInfo":taskInfo.value,
"backApplyDetails":obj
}
insertApp(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '添加成功!', icon: 'none' })
typeName.value="";
materialName.value="";
maStatusName.value="";
typeId.value="";
maId.value=""
maCode.value=""
typeId.value=""
apDetection.value="完好"
bmFileInfos.value=[]
imgBeseUrl.value = ""
// uni.navigateBack({
// delta: 1 //
// });
}else{
uni.showToast({ title: res.msg, icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
}
console.log('提交数据:', taskInfo.value);
// maId
if (!maId.value) {
uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' });
return;
}
// tableListmaIdmaCode
let isDuplicate = false;
// tableListmaCodeList
tableList.value.forEach(item => {
if (item.maCodeList && item.maCodeList.length > 0) {
const duplicateItem = item.maCodeList.find(codeItem =>
codeItem.maId === maId.value || codeItem.maCode === maCode.value
);
if (duplicateItem) {
isDuplicate = true;
}
}
});
if (isDuplicate) {
uni.showToast({
title: '该设备已存在退料列表中,请勿重复添加!',
icon: 'none',
duration: 2000
});
return;
}
//
let obj = {
"maId": maId.value,
"maCode": maCode.value,
"typeId": typeId.value,
"apDetection": apDetection.value,
"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 = () => {
@ -288,7 +401,6 @@ const uploadImg = () => {
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res.code);
console.log('上传成功', res.data);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
@ -321,7 +433,8 @@ const back = () => {
onLoad((options)=>{
console.log(options)
taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value)
tableList.value = JSON.parse(options.tableList)
console.log(tableList.value)
})
</script>

View File

@ -41,7 +41,7 @@
<!-- 表头行 -->
<uni-tr>
<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="100px" 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-td style="font-size: 24rpx;text-align: center;">{{item.maCode}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<!-- <span>{{item.apDetection}}</span> -->
<span>{{item.apDetection}}</span>
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
<span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span>
<!-- <span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span>-->
</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>-->

View File

@ -186,16 +186,30 @@ const getMaCode = () => {
})
}
//
const selectMaCode = (e) => {
console.log(e)
maCodeSelectList.value.forEach(item=>{
console.log(item)
if(item.typeId==e){
typeList.value.push(item)
}
})
console.log(typeList.value)
}
const selectMaCode = (e) => {
console.log(e);
// maCodeSelectList
const selectedItem = maCodeSelectList.value.find(item => item.typeId === e);
if (!selectedItem) return;
// typeListtypeId
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 = () => {
console.log(taskInfo.value)
@ -216,7 +230,7 @@ const submitNum = () => {
icon: 'none',
})
return
} else if (typeList.value[i].preNum< typeList.value[i].num) {
} else if (typeList.value[i].preNum>typeList.value[i].num) {
uni.showToast({
title: `${i + 1}行退料数量不能大于在用数量`,
icon: 'none',

View File

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

View File

@ -29,7 +29,7 @@
<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)">
<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">
<span style="font-size: 15px; font-weight: 800">退料任务</span>
<!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> -->
@ -47,7 +47,7 @@
</uni-row>
<uni-row :gutter="24">
<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 :gutter="24">
<uni-col :span="8">单位</uni-col>
@ -136,7 +136,7 @@ const search = () => {
}
//
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 = () => {