This commit is contained in:
赵正易 2024-04-30 13:23:49 +08:00
parent bc6d16086c
commit ce4550f9bb
3 changed files with 533 additions and 321 deletions

View File

@ -17,7 +17,8 @@
<view v-if="searchType === 2" class="color2 aciton-box">请扫箱码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo"></PdaScanInput>
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo">
</PdaScanInput>
</view>
</view>
</view>
@ -25,9 +26,11 @@
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-title">{{this.isStrict?'':'外协'}}入库清单</view>
<view class="scroll-view-last" v-if="newMaterialList.length > 1">上次批次号{{ newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-last" v-if="newMaterialList.length > 1">
上次批次号{{ newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-last" v-if="newMaterialList.length === 1">上次批次号</view>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]"></packageCard>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]">
</packageCard>
<!-- <scroll-view class="scroll-view-box" :scroll-y="true">
<view v-for="(item, index) in oldMaterialList">
<materialItem style="background-color: darkgray" :materialInfo="item"></materialItem>
@ -39,346 +42,368 @@
</view>
<!-- 底部按钮 -->
<view class="button-box">
<button style="width: 40%" type="default" @click="clear">全部重置</button>
<button style="width: 40%" type="default" @click="handlerSubmit">入库</button>
<u-button style="width: 40%" type="error" @click="clear" :disabled="loading"
:loading="loading">全部重置</u-button>
<u-button style="width: 40%" type="success" @click="handlerSubmit" :disabled="loading"
:loading="loading">入库</u-button>
</view>
</view>
</template>
<script>
import materialItem from '@/components/material-item/material-item.vue';
import packageCard from '@/components/package-card/package-card.vue';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
//
export default {
components: {
materialItem,
packageCard
},
data() {
return {
// true false
isStrict:false,
loading: false,
//
touchNum: 0,
clearData: {},
//
warehouseInfo: {
id: '',
warehouse: '',
warehouse_num: '',
location: '',
shelf: '',
layer: '',
number: 0
},
//
lastPackageInfo: {
//
workoderID: '',
// (++)
patchCode: '',
//
partNumner: '',
//
productionDescribe: '',
// /
productionTime: '',
//
quantity: 0
},
//
oldMaterialList: [],
//
newMaterialList: [],
// 1- 2-
searchType: 1
};
},
watch: {},
onLoad(e) {
if(e.isStrict === "true"){
this.isStrict = true;
}else{
this.isStrict = false;
}
console.log(e.isStrict === "true");
},
created() {
this.init();
},
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
num += this.newMaterialList[index].quantity * 1;
import materialItem from '@/components/material-item/material-item.vue';
import packageCard from '@/components/package-card/package-card.vue';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
//
export default {
components: {
materialItem,
packageCard
},
data() {
return {
// true false
isStrict: false,
loading: false,
//
touchNum: 0,
clearData: {},
//
warehouseInfo: {
id: '',
warehouse: '',
warehouse_num: '',
location: '',
shelf: '',
layer: '',
number: 0
},
//
lastPackageInfo: {
//
workoderID: '',
// (++)
patchCode: '',
//
partNumner: '',
//
productionDescribe: '',
// /
productionTime: '',
//
quantity: 0
},
//
oldMaterialList: [],
//
newMaterialList: [],
// 1- 2-
searchType: 1
};
},
watch: {},
onLoad(e) {
if (e.isStrict === "true") {
this.isStrict = true;
} else {
this.isStrict = false;
}
return num;
}
},
methods: {
init() {
// [](35233201041) () +(BNW240312023_18B1)
//
this.clearData.warehouseInfo = JSON.parse(JSON.stringify(this.warehouseInfo));
this.clearData.oldMaterialList = JSON.parse(JSON.stringify(this.oldMaterialList));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 1;
},
clear() {
this.warehouseInfo = JSON.parse(JSON.stringify(this.clearData.warehouseInfo));
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
this.searchType = 1;
created() {
this.init();
},
handleGetInfo(data, type) {
if (type === 1) {
//
this.searchType = 2;
this.warehouseInfo = data?.warehoseInfo;
this.newMaterialList = [];
} else if (type === 2) {
//
//
//
if (this.newMaterialList.length > 0) {
for (let item of this.newMaterialList) {
if (item.patchCode === data.patchCode) {
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
num += this.newMaterialList[index].quantity * 1;
}
return num;
}
},
methods: {
init() {
// [](35233201041) () +(BNW240312023_18B1)
//
this.clearData.warehouseInfo = JSON.parse(JSON.stringify(this.warehouseInfo));
this.clearData.oldMaterialList = JSON.parse(JSON.stringify(this.oldMaterialList));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 1;
},
clear() {
this.warehouseInfo = JSON.parse(JSON.stringify(this.clearData.warehouseInfo));
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
this.searchType = 1;
},
handleGetInfo(data, type) {
if (type === 1) {
//
this.searchType = 2;
this.warehouseInfo = data?.warehoseInfo;
this.newMaterialList = [];
} else if (type === 2) {
//
//
//
if (this.newMaterialList.length > 0) {
for (let item of this.newMaterialList) {
if (item.patchCode === data.patchCode) {
uni.showModal({
title: '提示',
content: '此货物已录入过!',
showCancel: false,
confirmText: '确定'
});
return;
}
}
if (this.newMaterialList[this.newMaterialList.length - 1].workoderID !== data.workoderID) {
uni.showModal({
title: '提示',
content: '此货物已录入过!',
content: '已更换入库批次!',
showCancel: false,
confirmText: '确定'
});
return;
}
}
if (this.newMaterialList[this.newMaterialList.length - 1].workoderID !== data.workoderID) {
uni.showModal({
title: '提示',
content: '已更换入库批次!',
showCancel: false,
confirmText: '确定'
});
}
}
const checkData = {
production_packcode: data.originalCode,
location: this.warehouseInfo.location,
//
isStrict: this.isStrict
};
WarehoseApi.checkWarehousing(checkData).then((res) => {
if (res.code === 200 && res.data) {
this.newMaterialList.push(data);
} else {
uni.showModal({
title: '提示',
content: '不可入库:' + res.msg,
showCancel: false,
confirmText: '确定'
});
}
});
// const checkData = {
// originalCode: data.originalCode
// };
// WarehoseApi.isExistedWarehouse(checkData).then((res) => {
// if (res.code !== 200 || res.data) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: ''
// });
// return;
// }
// //
// //
// //
// if (this.newMaterialList.length > 0) {
// for (let item of this.newMaterialList) {
// if (item.patchCode === data.patchCode) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: ''
// });
// return;
// }
// }
// }
// });
}
},
//
handleDeleteItem(item, index) {
//
this.touchNum++;
setTimeout(() => {
if (this.touchNum >= 2) {
uni.showModal({
title: '删除提示',
content: '是否从列表中删除此货物?',
showCancel: true,
cancelText: '取消',
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
const checkData = {
production_packcode: data.originalCode,
location: this.warehouseInfo.location,
//
isStrict: this.isStrict
};
WarehoseApi.checkWarehousing(checkData).then((res) => {
if (res.code === 200 && res.data) {
this.newMaterialList.push(data);
} else {
uni.showModal({
title: '提示',
content: '不可入库:' + res.msg,
showCancel: false,
confirmText: '确定'
});
}
});
// const checkData = {
// originalCode: data.originalCode
// };
// WarehoseApi.isExistedWarehouse(checkData).then((res) => {
// if (res.code !== 200 || res.data) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: ''
// });
// return;
// }
// //
// //
// //
// if (this.newMaterialList.length > 0) {
// for (let item of this.newMaterialList) {
// if (item.patchCode === data.patchCode) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: ''
// });
// return;
// }
// }
// }
// });
}
this.touchNum = 0;
}, 250);
},
//
handlerSubmit() {
if (this.newMaterialList.length === 0) {
uni.showModal({
title: '提示',
content: '无入库货物!',
showCancel: false,
confirmText: '确定'
});
return;
}
uni.showModal({
title: '入库操作',
content: '是否确认入库?',
showCancel: true,
cancelText: '取消',
confirmText: '确认入库',
success: (res) => {
if (res.confirm) {
let list = [];
for (let item of this.newMaterialList) {
list.push(item.originalCode);
}
const data = {
location: this.warehouseInfo.location,
packagelist: list
};
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (!res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
});
return;
},
//
handleDeleteItem(item, index) {
//
this.touchNum++;
setTimeout(() => {
if (this.touchNum >= 2) {
uni.showModal({
title: '删除提示',
content: '是否从列表中删除此货物?',
showCancel: true,
cancelText: '取消',
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
uni.showToast({
icon: 'success',
title: '入库成功!'
});
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
}
});
}
this.touchNum = 0;
}, 250);
},
//
handlerSubmit() {
if (this.newMaterialList.length === 0) {
uni.showModal({
title: '提示',
content: '无入库货物!',
showCancel: false,
confirmText: '确定'
});
return;
}
});
this.loading = true;
setTimeout(()=>{
this.loading = false;
},30000)
uni.showModal({
title: '入库操作',
content: '是否确认入库?',
showCancel: true,
cancelText: '取消',
confirmText: '确认入库',
success: (res) => {
if (res.confirm) {
let list = [];
for (let item of this.newMaterialList) {
list.push(item.originalCode);
}
const data = {
location: this.warehouseInfo.location,
packagelist: list
};
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (!res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
return;
}
uni.showToast({
icon: 'success',
title: '入库成功!'
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData
.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData
.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
this.loading = false;
}
});
}
}
});
}
}
}
};
};
</script>
<style scoped>
.title-box {
margin-top: 54px;
margin-bottom: 20px;
height: 60px;
font-size: 26px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.warehoseInfo-box {
font-size: 20px;
width: 94%;
margin: 0 auto;
padding-left: 10px;
padding-right: 10px;
background-color: aliceblue;
border-radius: 10px;
display: flex;
flex-direction: column;
}
.warehoseInfo-box .row {
display: flex;
flex-direction: row;
}
.warehoseInfo-box .row .col {
width: 50%;
}
.aciton-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.color1 {
color: brown;
}
.color2 {
color: orange;
}
.pda-search-box {
margin-bottom: 5px;
}
.list-box {
width: 100%;
}
.scroll-view-title {
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
color: #151515;
}
.scroll-view-box {
width: 94%;
margin: 0 auto;
margin-top: 30px;
height: 400px;
padding: 10px;
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-last {
width: 100%;
height: 60px;
font-size: 20px;
color: rgba(0, 9, 0, 0.7);
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
border-radius: 10px;
background-color: white;
}
.button-box {
width: 80%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
</style>
.title-box {
margin-top: 54px;
margin-bottom: 20px;
height: 60px;
font-size: 26px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.warehoseInfo-box {
font-size: 20px;
width: 94%;
margin: 0 auto;
padding-left: 10px;
padding-right: 10px;
background-color: aliceblue;
border-radius: 10px;
display: flex;
flex-direction: column;
}
.warehoseInfo-box .row {
display: flex;
flex-direction: row;
}
.warehoseInfo-box .row .col {
width: 50%;
}
.aciton-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.color1 {
color: brown;
}
.color2 {
color: orange;
}
.pda-search-box {
margin-bottom: 5px;
}
.list-box {
width: 100%;
}
.scroll-view-title {
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
color: #151515;
}
.scroll-view-box {
width: 94%;
margin: 0 auto;
margin-top: 30px;
height: 400px;
padding: 10px;
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-last {
width: 100%;
height: 60px;
font-size: 20px;
color: rgba(0, 9, 0, 0.7);
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
border-radius: 10px;
background-color: white;
}
.button-box {
width: 80%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -94,13 +94,13 @@
<u-text text="起点" size="48"></u-text>
</u-col>
<u-col span="4">
<u-input v-model="end_point" placeholder="请输入起点" clearable></u-input>
<u-input v-model="start_point" placeholder="请输入起点" clearable></u-input>
</u-col>
<u-col span="2">
<u-text text="终点" size="48"></u-text>
</u-col>
<u-col span="4">
<u-input v-model="start_point" placeholder="请输入终点" clearable></u-input>
<u-input v-model="end_point" placeholder="请输入终点" clearable></u-input>
</u-col>
</u-row>
<u-gap height="20"></u-gap>
@ -196,6 +196,8 @@
},
sectionChange(index) {
this.current = index;
this.start_point = '';
this.end_point = '';
},
// scrolltolower() {
// this.loadmore();

View File

@ -0,0 +1,185 @@
<template>
<view>
<view :key="1">
<view class="tip-box">
<u-row :gutter="20">
<u-col span="2">
<u-text text="起点" size="48"></u-text>
</u-col>
<u-col span="4">
<u-input v-model="start_point" placeholder="请输入起点" clearable></u-input>
</u-col>
<u-col span="2">
<u-text text="终点" size="48"></u-text>
</u-col>
<u-col span="4">
<u-input v-model="end_point" placeholder="请输入终点" clearable></u-input>
</u-col>
</u-row>
<u-gap height="20"></u-gap>
<u-row>
<u-col span="6" align="center">
<view class="tip-icon" @click="start_agv"><span>启动</span></view>
</u-col>
<u-col span="6" align="center">
<view class="tip-icon2" @click="stop_agv"><span style="font-size: 0.5rem">紧急终止</span></view>
</u-col>
</u-row>
</view>
</view>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
import {
go_workshop,
emergency_stop_agv
} from '@/api/materialManagement/MaterialRequsition.js';
export default {
data() {
return {
loading: false,
start_point: '',
end_point: '',
reqCode:''
};
},
watch: {},
filters: {
},
mounted() {
this.init();
},
methods: {
init() {
},
start_agv() {
if (this.start_point == '' || this.end_point == '') {
this.$refs.uToast.show({
type: 'error',
message: '起点或者终点不能为空'
});
return;
}
const query = {
start_point: this.start_point,
end_point: this.end_point
};
go_workshop(query).then((res) => {
if (res.code == 200) {
this.reqCode = res.data.data;
this.$refs.uToast.show({
type: 'error',
message: 'agv起动成功' + res.data
});
}
});
},
stop_agv() {
if (this.reqCode == '') {
this.$refs.uToast.show({
type: 'error',
message: '无任务编号'
});
return;
}
const query = {
reqCode: this.reqCode
};
emergency_stop_agv().then((res) => {
if (res.code == 200) {
this.$refs.uToast.show({
type: 'success',
message: '成功取消' + res.data
});
}
});
}
}
};
</script>
<style scoped>
.area {
height: 350px;
background-color: white;
overflow: hidden;
/* 隐藏超出部分 */
overflow-y: scroll;
/* 添加垂直滚动条 */
}
.cartoon-list-item {
background-color: #c8d3db;
/* 设置蓝色背景 */
padding: 10px;
/* 设置内边距 */
border-radius: 10px;
/* 设置圆角边框 */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
/* 添加阴影效果 */
margin-bottom: 10px;
/* 设置底部外边距 */
font-family: 'Comic Sans MS', cursive;
/* 设置卡通化字体 */
color: white;
/* 设置文字颜色为白色 */
}
.cartoon-list-item:hover {
transform: scale(1.05);
/* 鼠标悬停时放大 */
}
.tip-box {
width: 100%;
margin-top: 20px;
background-color: #fff;
/* 白色背景 */
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影 */
}
.tip-icon {
margin-top: 5px;
width: 50px;
height: 50px;
background-color: #00ff00;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影 */
}
.tip-icon2 {
margin-top: 5px;
width: 50px;
height: 50px;
background-color: red;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影 */
}
.tip-text {
margin-top: 10px;
font-size: 16px;
color: #333;
}
</style>