拆箱功能完成

This commit is contained in:
赵正易 2024-04-19 14:07:40 +08:00
parent 4a49ca5524
commit ab4b9628c2
8 changed files with 632 additions and 19 deletions

View File

@ -54,7 +54,7 @@
background-color: white;
}
/* 存在顶部nav与tab通用主容器 可使用高度 */
/* 存在顶部nav主容器 可使用高度 */
.common-nav-container {
width: 360px;
height: 644px;

View File

@ -5,6 +5,17 @@
<u-tag v-if="index===0" text="主箱" plain size="mini" type="error"></u-tag>
<u-tag v-else text="次箱" plain size="mini" type="info"></u-tag>
</template>
<view class="package-card-body">
<view class="package-card-describe">
<view>零件号{{ materialInfo.partNumner }}</view>
<view>描述{{ materialInfo.productionDescribe }}</view>
</view>
<view class="package-card-time">
<view class="package-card-quantity">数量{{ materialInfo.quantity }}</view>
<view>生产日期</view>
<view>{{ materialInfo.productionTime }}</view>
</view>
</view>
</uni-card>
<!-- <view class="title left">{{materialInfo.patchCode}}</view>
@ -49,5 +60,20 @@
</script>
<style scoped>
.material-box {}
.package-card-body {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
.package-card-describe {
font-size: 16px;
font-weight: 600;
width: 70%;
display: flex;
flex-direction: column;
}
.package-card-quantity{
margin-bottom: 10px;
}
</style>

View File

@ -162,6 +162,22 @@
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/warehoseActionList/warehoseActionList",
"style" :
{
"navigationBarTitleText" : "仓库操作日志",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/unpacking/unpacking",
"style" :
{
"navigationBarTitleText" : "拆箱",
"enablePullDownRefresh" : false
}
}
]

View File

@ -8,7 +8,7 @@
<span class="col">已扫箱数{{ newMaterialList.length }}</span>
</view>
<view>
<view v-if="searchType === 2" class="color2 aciton-box">操作指示-请扫货物码</view>
<view v-if="searchType === 2" class="color2 aciton-box">请扫货物码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :hasFocus="false"></PdaScanInput>
@ -19,7 +19,7 @@
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-title">拼箱清单</view>
<scroll-view class="scroll-view-box" :scroll-y="true">
<scroll-view :scroll-y="true" class="scroll-view-height">
<view v-for="(item, index) in newMaterialList">
<materialItem style="background-color: whitesmoke" :index="index" :materialInfo="item"
@click.native="handleDeleteItem(item, index)"></materialItem>
@ -133,15 +133,19 @@
handleGetInfo(data, type) {
if (type === 2) {
//
// if (this.newMaterialList.length > 1) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: ''
// });
// return;
// }
if (this.newMaterialList.length > 0) {
for(let item of this.newMaterialList){
if(data.patchCode === item.patchCode){
uni.showModal({
title: '提示',
content: '已扫过此箱!',
showCancel: false,
confirmText: '确定'
});
return;
}
}
}
const checkData = {
originalCode: data.originalCode
};
@ -195,7 +199,7 @@
if (res.code === 200) {
uni.showModal({
title: '提示',
content: '拼箱成功!',
content: '拼箱成功!'+res.data.description,
showCancel: false,
confirmText: '确认'
});
@ -287,7 +291,9 @@
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-height{
height: 300px;
}
.scroll-view-last {
width: 100%;
height: 60px;

View File

@ -58,7 +58,7 @@ export default {
data() {
return {
// true false
isStrict:true,
isStrict:false,
loading: false,
//
touchNum: 0,
@ -139,13 +139,21 @@ export default {
if (item.patchCode === data.patchCode) {
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,

View File

@ -133,10 +133,19 @@
isShow: true,
name: '拆箱',
//
url: '',
url: '/pages/unpacking/unpacking',
icon: '',
color: 'linear-gradient(to bottom, #243949 0%, #517fa4 100%)'
},
{
isShowType: 4,
isShow: true,
name: '仓库操作日志',
//
url: '/pages/warehoseActionList/warehoseActionList',
icon: '',
color: 'linear-gradient(to right, #6a11cb 0%, #2575fc 100%)'
},
{
isShowType: 4,
isShow: true,
@ -145,7 +154,8 @@
url: '/pages/watchGoods/watchGoods',
icon: '',
color: 'linear-gradient(to top, #0ba360 0%, #3cba92 100%)'
}
},
]
}
},

View File

@ -0,0 +1,334 @@
<template>
<view class="content">
<view class="title-box">
<!-- <span class="title-text">拆箱</span> -->
<view class="warehoseInfo-box">
<view class="row">
<span class="col">已扫货物数{{ quantityTotal }}</span>
<span class="col">已扫箱数{{ newMaterialList.length }}</span>
</view>
<view>
<view v-if="searchType === 2" class="color2 aciton-box">请扫货物码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :hasFocus="false"></PdaScanInput>
</view>
</view>
</view>
</view>
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-title">拆箱清单</view>
<scroll-view :scroll-y="true" class="scroll-view-height">
<view v-for="(item, index) in newMaterialList">
<materialItem style="background-color: whitesmoke" :index="index" :materialInfo="item"
@click.native="handleDeleteItem(item, index)"></materialItem>
</view>
</scroll-view>
<!-- <packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]"></packageCard> -->
</view>
<!-- 数量选择 -->
<u-modal :show="modalShow" showCancelButton title="请输入拆箱后数量" @confirm="modalConfirm" @cancel="modalCancel">
<view class="slot-content">
<u--input placeholder="请输入第一箱数量" type="number" border="surround" v-model="firstNum"></u--input>
</view>
</u-modal>
<!-- 底部按钮 -->
<view class="button-box">
<button type="default" @click="clear">清空</button>
<button type="default" @click="handlerSubmit">拆箱</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';
import * as GoodsActionApi from '@/api/warehouse/wmGoodsAction.js';
//
export default {
components: {
materialItem,
packageCard
},
data() {
return {
loading: false,
//
touchNum: 0,
clearData: {},
//
packageInfo: {
// id
id: '',
//
workoderID: '',
// (++)
patchCode: '',
//
partNumner: '',
//
goodsNumLogic: 0,
//
goodsNumAction: 0,
//
productionDescribe: '',
// /
productionTime: '',
//
quantity: 0
},
//
newMaterialList: [],
// 1- 2- 3-
searchType: 2,
modalShow:false,
firstNum: 0
};
},
watch: {},
created() {
this.init();
},
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
let _num = parseInt(this.newMaterialList[index].quantity);
_num = _num || 0;
num += _num * 1;
}
return num;
}
},
methods: {
init() {
// [](35233201041) () +(BNW240312023_18B1)
//
this.clearData.packageInfo = JSON.parse(JSON.stringify(this.packageInfo));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 2;
this.firstNum = 0;
},
clear() {
this.packageInfo = JSON.parse(JSON.stringify(this.clearData.packageInfo));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
this.searchType = 2;
this.firstNum = 0;
},
//
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);
}
}
});
}
this.touchNum = 0;
}, 250);
},
//
handleGetInfo(data, type) {
if (type === 2) {
//
if (this.newMaterialList.length > 0) {
for (let item of this.newMaterialList) {
if (data.patchCode === item.patchCode) {
uni.showModal({
title: '提示',
content: '已扫过此箱!',
showCancel: false,
confirmText: '确定'
});
return;
}
}
}
const checkData = {
originalCode: data.originalCode
};
//
WarehoseApi.isExistedWarehouse(checkData).then((res) => {
if (res.code !== 200 || !res.data) {
uni.showModal({
title: '提示',
content: '货物异常或未入库!',
showCancel: false,
confirmText: '确定'
});
return;
}
this.newMaterialList.push(data);
const searchInfoData = {
patchCode: data.patchCode
};
//
WarehoseApi.getInfoByPatchCode(searchInfoData).then((res) => {
if (res.code === 200) {
this.packageInfo = res.data;
} else {
uni.showModal({
title: '提示',
content: '货物数据异常',
showCancel: false,
confirmText: '确定'
});
return;
}
});
});
}
},
modalConfirm() {
let data = {
package: this.newMaterialList[0],
createBy: "admin",
firstNum: this.firstNum || 0
};
GoodsActionApi.doUnpackingGoods(data).then((res) => {
if (res.code === 200) {
uni.showModal({
title: '提示',
content: '拆箱成功!' + res.data.description,
showCancel: false,
confirmText: '确认'
});
this.modalShow = false;
this.clear();
} else {
uni.showToast({
icon: 'error',
title: '拆箱失败!'
});
}
});
},
modalCancel(){
this.modalShow = false;
this.firstNum = 0;
},
//
handlerSubmit() {
this.modalShow = true;
}
}
};
</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: yellowgreen;
}
.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;
}
.scroll-view-box {
width: 94%;
margin: 0 auto;
margin-top: 50px;
height: 360px;
padding: 10px;
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-height {
height: 300px;
}
.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;
flex-direction: row;
}
.changeInput {
font-size: 20px;
background-color: gainsboro;
border: 1px solid grey;
}
</style>

View File

@ -0,0 +1,213 @@
<template>
<view class="common-nav-container border">
<u-subsection :list="typeOptions" :current="queryForm.type" key-name="label" @change="subsectionChange"
fontSize="36"></u-subsection>
<u-input v-model="queryForm.description" placeholder="请输入模糊批次号" clearable prefixIcon="search"
prefixIconStyle="font-size: 22px;color: #909399">
<template slot="suffix">
<u-button @click="getList" type="primary" size="mini">搜索</u-button>
</template>
</u-input>
<u-collapse @open="collapseOpen" @close="collapseClose" accordion>
<u-list height="550px" @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in dataList" :key="index">
<u-collapse-item :title="titleParse(item.jsonMsg,item.type)" :name="item.id">
<view slot="icon">
<u-tag :text="typeOptions[item.type].label" :type="typeOptions[item.type].type"></u-tag>
</view>
<view slot="value">
<text>{{quantityParse(item.jsonMsg,item.type)}}</text>
<!-- <u-button text="详情" size="mini" type="primary"></u-button> -->
</view>
<view>
<u-button text="详情" size="mini" type="primary"></u-button>
<text class="u-collapse-content">{{item.description}}</text>
</view>
<!-- <view class="u-collapse-content-box border" v-if="dataJson !== null">
<view v-if="(item2, index2) dataJson.packageList">
<u-cell :title="item2.PatchCode" :value="item2.Quantity">
</view>
<view class="collapse-item" v-for="(item2,index2) in dataJson.packageList">
<u-cell class="u-collapse-content" :title="item2.PatchCode" :value="item2.Quantity">
<u-tag v-if="index2 === 0" slot="icon" text="主箱" type="error"></u-tag>
<u-tag v-else slot="icon" text="次箱" type="info"></u-tag>
</u-cell>
</view>
</view> -->
</u-collapse-item>
<!-- <u-cell :title="dataParse(item.jsonMsg,item.type)" isLink>
<view slot="icon">
<u-tag :text="typeOptions[item.type].label" :type="typeOptions[item.type].type"></u-tag>
</view>
</u-cell> -->
</u-list-item>
</u-list>
</u-collapse>
<u-loadmore fontSize="36" iconSize="36" :status="loadingStatus" />
</view>
</template>
<script>
import * as goodsChangeLogApi from '@/api/warehouse/wmGoodsChangeLog.js';
export default {
data() {
return {
loading: false,
queryForm: {
type: 0,
pageNum: 1,
pageSize: 10,
description: ''
},
typeOptions: [{
label: '全部',
value: 0,
type: 'info'
},
{
label: '拼箱',
value: 1,
type: 'success'
},
{
label: '拆箱',
value: 2,
type: 'warning'
},
{
label: '移库',
value: 3,
type: 'primary'
},
],
dataList: [],
dataJson: null,
total: 0
}
},
computed: {
loadingStatus() {
let page = this.queryForm.pageNum;
let size = this.queryForm.pageSize;
let total = this.total;
if (this.loading) {
return "loading"
}
if (page * size >= total) {
return "nomore"
} else {
return "loadmore"
}
}
},
created() {
this.getList();
},
// mounted() {
// console.log('', uni.getWindowInfo().screenWidth)
// console.log('', uni.getWindowInfo().windowHeight)
// },
methods: {
subsectionChange(index) {
this.queryForm.type = index;
this.getList();
},
getList(isLoadmore = false) {
this.loading = true;
setTimeout(() => {
this.loading = false;
}, 30000)
if (isLoadmore) {
this.queryForm.pageNum += 1;
} else {
this.queryForm.pageNum = 1;
}
const data = this.queryForm;
goodsChangeLogApi.listWmGoodsChangeLog(data).then((res) => {
if (res.code === 200) {
if (isLoadmore) {
this.dataList.push(...res.data.result)
} else {
this.dataList = res.data.result;
}
this.total = res.data.totalNum;
this.loading = false;
}
})
},
// json -
titleParse(jsonStr, type) {
try {
let json = JSON.parse(jsonStr);
//
if (type === 1) {
return json.newPatchCode;
}
//
if (type === 2) {
return "箱1:" + json.newPatchCode1 + "\n箱2:" + json.newPatchCode2;
}
} catch (e) {
return "无法解析,请检查数据是否为测试数据";
}
},
//
quantityParse(jsonStr, type) {
try {
let json = JSON.parse(jsonStr);
//
if (type === 1) {
return json.newQuantityCount || 0;
}
} catch (e) {
return "无法解析,请检查数据是否为测试数据";
}
},
jsonParse(jsonStr) {
try {
return JSON.parse(jsonStr);
} catch (e) {
return null;
}
},
collapseOpen(name) {
let that = this;
let list = this.dataList;
for (let index in list) {
if (name === list[index].id) {
setTimeout(() => {
that.dataJson = that.jsonParse(list[index].jsonMsg);
}, 300)
}
}
},
collapseClose(name) {
setTimeout(() => {
this.dataJson = null;
}, 300)
},
//
scrolltolower() {
let page = this.queryForm.pageNum;
let size = this.queryForm.pageSize;
let total = this.total;
if (page * size < total) {
this.getList(true);
}
}
}
}
</script>
<style scoped>
.collapse-item {
height: 60px;
}
.u-collapse-content-box {
/* margin: 10px; */
height: auto;
}
</style>