<template>
|
<!-- 组盘 -->
|
<view style="padding-bottom:100px">
|
<u-form labelPosition="left" label-width="150rpx" :model="formData" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="托盘号:" prop="plateCode" required class="itemWB">
|
<u-input v-model.trim="formData.plateCode" placeholder="请扫码录入"
|
@confirm="getMaterialDetails" @focus="formData.plateCode = ''"
|
style="font-weight: bolder;margin-left: 15rpx;" class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label-width="200rpx" label="占用空间(%):" class="itemWB">
|
<u-input v-model="formData.percentAge" type="number" ref="percentAge" :min="1" :max="100"
|
placeholder="请输入占用空间" style="font-weight: bolder;margin-left: 15rpx;"
|
class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<modal-code :rescode='rescode' :resmessage='resmessage' ref="resmodal" />
|
<view style="margin-bottom: 200rpx;" class="margin_top10rpx">
|
<view v-for="(item, eindex) in tableData" :key="eindex" class="margin_bottom10rpx">
|
<u-swipe-action :show="item.show" :index="eindex" @click="longpress" @open="open" @close='close'
|
:options="options" style="width: 100vw;">
|
<view class="title-wrap fontSize32rpx background_fff padding10"
|
:class="item.enAbled==0? 'bg_item' : '' ">
|
<u-row>
|
<u-col span="12" class="flex">
|
<text class="flex justify-center align-center circkle06">{{ eindex + 1 }}</text>
|
<text class="color_f18202 padding_left10rpx">
|
{{item.productCode}}
|
</text>
|
<!-- <u-icon name="plus-circle" v-if="item.enAbled!=1"></u-icon> -->
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<text class="color_80">
|
物料名称:{{ item.productName }}
|
</text>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<text class="color_80">
|
跟踪号:{{ item.extendField04 }}
|
</text>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="color_80 flex" style="vertical-align: middle;align-items: center;">
|
是否需要助力臂:
|
<!-- @change="change" -->
|
<!-- <view style="margin-top: 2rpx;"> -->
|
<u-switch size="40" v-model="item.isBoosterArm"></u-switch>
|
<!-- </view> -->
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<text class="color_80">
|
标签条码:{{ item.extendField06 }}
|
</text>
|
</u-col>
|
</u-row>
|
|
<u-row>
|
<u-col span="6">
|
<text class="color_80">
|
库存单位:{{item.smallUnit}}
|
</text>
|
</u-col>
|
<u-col span="6" class="flex color_f18202">
|
<view class="color_80">
|
数量:
|
</view>
|
{{ item.finishedQuantity }}
|
<!-- <input :class="item.enAbled?'':'border_bottom_f18202 inputGray'"
|
class="text-left color_f18202 fontSize32rpx inputGray2" v-model="item.quantity"
|
type="number" :disabled="item.enAbled==1" @blur="changeNum(item)"
|
@click="clicki(item)" placeholder="0" /> -->
|
</u-col>
|
</u-row>
|
|
</view>
|
</u-swipe-action>
|
</view>
|
</view>
|
<!-- <button-modal :BottomModal="true" :issueShow='true' issueTitle="重置" subTitle='组盘' restTiltle='入库' @reset='goWarhouse'
|
@submit='submit' @issue="reset" /> -->
|
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow = false" mode="bottom">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<scroll-view scroll-y="true" style="height: 550rpx;">
|
|
<view class="line flex justify-between">
|
<text class="text-gray">采购单号</text>
|
<text>{{ materlist.poCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">采购项号</text>
|
<text>{{ materlist.itemNumber }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">销售单号</text>
|
<text>{{ materlist.saleCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">销售项号</text>
|
<text>{{ materlist.extendField08 }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">到期日期</text>
|
<text>{{ materlist.limitDate }}</text>
|
</view>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">重量</text>
|
<text>{{ materlist.totalWeight }}</text>
|
</view> -->
|
</scroll-view>
|
</u-popup>
|
|
<button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='确认上架' @submit='saveCheck' @reset='rest' />
|
|
</view>
|
</template>
|
<script>
|
import ButtonModal from '@/components/BottomModal.vue'
|
import ModalCode from '@/components/ModalCode.vue'
|
import {
|
addGroupDisk,
|
getContainDetail,
|
getBhbMaterialList,
|
isPlate,
|
getArea
|
} from '@/src/api/artificial.js'
|
import {
|
getAttrValue
|
} from '@/src/untils/tool.js'
|
export default {
|
data() {
|
return {
|
creator:"",
|
curFoucus: true,
|
curFoucus2: true,
|
rescode: 0,
|
resmessage: "",
|
putCode: '', //容器二维码
|
detailshow: false,
|
operator: '',
|
focu: false, //清空按钮隐显
|
focuM: false, //物料隐显按钮
|
// Datetime: getDate(),
|
tableData: [], //物料详情
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
},
|
// {
|
// text: '删除',
|
// style: {
|
// backgroundColor: '#fc4b4b'
|
// }
|
// }
|
],
|
materlist: {},
|
formData: {
|
plateCode: '',
|
extendField06: '',
|
percentAge: 100,
|
},
|
gridable: true,
|
gridFocus: false,
|
detailable: false,
|
detailableZb: false,
|
batchNo: '', //扫码到的当前物料的批次
|
warehouseRules: {
|
plateCode: [{
|
required: true,
|
message: '托盘号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
orderType: 1,
|
warhouseTph: '',
|
timerPrint: null,
|
kwbhAllowed: false, //是否禁用库位编号
|
arrD: [],
|
disabled_extendField06: false,
|
// 当前正在扫描的数据 {}
|
currentRow: null,
|
// SKU列表
|
findProductList: [],
|
productPosition_Id:"",
|
existRows: [],//
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onLoad(option) {},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
let tokenInfouser = uni.getStorageSync('$tokenInfouser');
|
if(!tokenInfouser){
|
uni.navigateTo({
|
url: '../Login/login?id=1'
|
})
|
}
|
// formatTime("2024-01-16")
|
// this.formatTime("2024-1-16")
|
|
this.addDate("2024-1-16 16:28:01");
|
|
let creator = uni.getStorageSync('creator') || ''
|
if(creator){
|
this.creator = JSON.parse(creator) || ''//修改人
|
}
|
},
|
methods: {
|
|
//物料查询
|
getMaterialDetails() {
|
|
this.timerPrint = setTimeout(() => {
|
this.getProductInfo()
|
clearTimeout(this.timerPrint)
|
this.timerPrint = null
|
}, 300);
|
},
|
|
// 获取物料信息
|
getProductInfo() {
|
var _this = this;
|
var params = {
|
plateCode: this.formData.plateCode
|
}
|
isPlate(params).then((resWm) => {
|
//debugger
|
if (resWm.data.result) { //200
|
let res = resWm.data;
|
if (res.result) {
|
if (res.data == null) {
|
this.rescode = 400
|
this.resmessage = '没有物料绑定'
|
this.$refs.resmodal.show = true
|
return
|
} else {
|
if (res.data.length == 0) {
|
this.rescode = 400
|
this.resmessage = '没有物料绑定'
|
this.$refs.resmodal.show = true
|
return
|
} else {
|
this.commonLoadPlateDataToTable(res.data);
|
}
|
}
|
} else {
|
this.resmessage = res.message
|
this.rescode = res.code
|
this.$refs.resmodal.show = true
|
}
|
} else {
|
/*
|
this.resmessage = resWm.data.msg;
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
//*/
|
//替换提示
|
this.rescode = 400
|
this.resmessage = '没有物料绑定'
|
this.$refs.resmodal.show = true
|
return
|
}
|
})
|
},
|
// 公共 将托盘上的库存装载到列表中
|
commonLoadPlateDataToTable(listData){
|
this.tableData = listData
|
this.formData.plateCode = listData[0].plateCode
|
let i = 0
|
this.tableData = this.tableData.map(row => {
|
//debugger
|
row.finishedQuantity = listData[i].productStorage
|
i++
|
return row
|
})
|
},
|
//客户要求 扫码后 清空数值 自动聚焦focus
|
autoFocusPdaInput(){
|
//客户要求 扫码后 清空数值在聚焦
|
// #ifdef H5
|
try {
|
document.getElementById('materialRef').querySelector('input').focus()
|
} catch (e) {}
|
// #endif
|
|
// #ifdef APP
|
try{
|
this.curFoucus2 = false
|
this.timerPrint = setTimeout(()=>{
|
this.curFoucus2 = true
|
clearTimeout(this.timerPrint)
|
this.timerPrint = null
|
}, 2000)
|
}catch(e){
|
//TODO handle the exception
|
}
|
// #endif
|
//客户要求 扫码后 清空数值在聚焦
|
},
|
//删除详情
|
longpress(index, eindex) {
|
this.tableData[index].cardNum = true
|
if (eindex == 1) {
|
uni.showModal({
|
title: '提示',
|
content: '是否确认删除?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
this.tableData[index].cardNum = true
|
if (eindex == 0) { //删除
|
this.tableData.splice(index, 1)
|
} else {
|
this.materlist = this.tableData[index]
|
this.detailshow = true
|
}
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
} else {
|
this.materlist = this.tableData[index]
|
this.detailshow = true
|
}
|
},
|
|
|
//编辑状态样式
|
dc(e) {
|
e.cardNum = true
|
this.$forceUpdate()
|
},
|
//卡片选中
|
clicki(e) {
|
e.cardNum = true
|
this.$forceUpdate()
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.tableData[index].cardNum = true;
|
this.$forceUpdate()
|
this.tableData[index].show = true;
|
this.tableData.map((val, idx) => {
|
if (index != idx) this.tableData[idx].show = false;
|
})
|
},
|
close(index) {
|
this.tableData[index].show = false;
|
this.tableData[index].cardNum = false;
|
this.$forceUpdate()
|
},
|
//改变组盘数量
|
changeNum(val) {
|
val.cardNum = false
|
if (!val.quantity) {
|
uni.showModal({
|
title: '提示',
|
content: '组盘数量不能为空',
|
showCancel: false
|
})
|
}
|
if (val.quantity < 0) {
|
uni.showModal({
|
title: '提示',
|
content: '组盘数量必须大于0',
|
showCancel: false
|
})
|
}
|
|
},
|
|
//重置页面信息
|
rest() {
|
this.formData.extendField06 = ''
|
this.formData.plateCode = ''
|
this.formData.percentAge = 100
|
this.tableData = [];
|
this.$refs.warehouseRef.resetFields();
|
},
|
|
|
// 确认入库
|
saveCheck() {
|
// if (!window.confirm('当前扫描要确认码盘吗?')) return
|
if (!this.formData.plateCode) {
|
this.$u.toast('请输入码盘的母托盘号!')
|
return
|
}
|
//这个验证去掉 【Editby shaocx,2024-03-23】
|
/*
|
var emptyPositionName = this.tableData.filter(item => item.product_Id && item.finishedQuantity > 0 && !item
|
.positionName)
|
if (emptyPositionName.length) {
|
this.$u.toast('条形码[' + emptyPositionName.join(',') + ']货位不能为空!')
|
return
|
}
|
//*/
|
var dataList = this.tableData.filter(item => item.position_Id && item.finishedQuantity > 0).map(item => {
|
return {
|
storage_Id: 87,
|
storageName: '立体库',
|
product_Id: item.product_Id,
|
productCode: item.productCode,
|
productName: item.productName,
|
finishedQuantity: item.finishedQuantity,
|
positionName: item.positionName,
|
produceDate: item.produceDate,
|
purchasePrice: item.purchasePrice,
|
batchNumber: null,
|
productSpec: item.productSpec,
|
plateCode: item.plateCode,
|
enterMode: '',
|
isBoosterArm: item.isBoosterArm || 0,
|
quantity: item.quantity,
|
poCode: item.poCode,
|
extendField04: item.extendField04,
|
saleCode: item.saleCode,
|
itemNumber: item.itemNumber,
|
extendField08: item.extendField08,
|
limitDate: item.limitDate,
|
totalWeight: item.totalWeight,
|
extendField06: item.extendField06
|
}
|
});
|
//debugger
|
var dataListss = this.tableData.filter(item => item.finishedQuantity > item.quantity)
|
const detailList = JSON.stringify(
|
dataListss.map(m => {
|
return {
|
poCode: m.poCode,
|
productCode: m.productCode,
|
number: m.finishedQuantity - m.quantity,
|
saleCode: m.saleCode,
|
trackting: m.extendField04
|
}
|
})
|
)
|
dataList = this.tableData;
|
if (dataList.length === 0) {
|
this.$u.toast('至少录入一条数据')
|
return
|
}
|
//增加对重复条形码的验证
|
// for (var i = 0; i < dataList.length; i++) {
|
// for (var j = i + 1; j < dataList.length; j++) {
|
// if (dataList[i].extendField06 == dataList[j].extendField06) {
|
// this.$u.toast('检测到列表中有重复的标签条码' + dataList[j].extendField06 + ',请重新刷新界面重新扫码!')
|
// return
|
// }
|
// }
|
// }
|
//增加对重复条形码的验证 【Editby shaocx,2022-08-27】
|
for (var i=0; i<dataList.length; i++) {
|
for (var j=i+1; j<dataList.length; j++) {
|
//拼盘上架 单独过滤掉为NULL的,因为从db中获取的竟然不带extendField06 【Editby shaocx,2022-08-30】
|
if (dataList[i].extendField06!=null && dataList[j].extendField06!=null &&dataList[i].extendField06 == dataList[j].extendField06) {
|
this.$message.error('检测到列表中有重复的标签条码'+dataList[j].extendField06+',请重新刷新界面重新扫码!')
|
return
|
}
|
}
|
}
|
|
var msg = '当前拼盘上架共' + dataList.length + '条物料明细,请确认数量是否跟现场实物一致?,如果不一致请点取消按钮!';
|
var params = {
|
creator:this.creator,
|
datalist: dataList,
|
plateCode: this.formData.plateCode,
|
percentAge: this.formData.percentAge,
|
productPosition_Id: this.productPosition_Id,
|
detailList: detailList,
|
shelveType: '拼盘上架'
|
}
|
//debugger
|
uni.showModal({
|
title: '提示',
|
//content: '是否确认拼盘上架?',
|
content: msg,
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
addGroupDisk(params).then(res => {
|
if (res.data.result) { //200
|
this.rescode = 200
|
this.resmessage = "拼盘上架成功!"
|
this.$refs.resmodal.show = true
|
this.rest()
|
} else {
|
this.resmessage = res.data.msg || "";
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
}
|
})
|
} else if (res.cancel) {}
|
})
|
});
|
},
|
|
// 排序高亮行靠前
|
sortRow() {
|
this.tableData.forEach(element => {
|
element.sortIndex = 0
|
})
|
this.currentRow.sortIndex = 1
|
this.tableData = this.tableData.sort(function(a, b) {
|
return b.sortIndex - a.sortIndex
|
})
|
this.tableData.forEach(element => {
|
element.sortIndex = 0
|
})
|
},
|
|
// formatTime (strDate){
|
// let dateFormat = new Date(strDate);
|
// dateFormat = dateFormat.setDate(dateFormat.getDate() + 1);
|
// dateFormat = new Date(dateFormat);
|
// let y = dateFormat.getFullYear();
|
// let m = (dateFormat.getMonth() + 1).tostring().padstart(2, '0');
|
// let d = dateFormat.getDate().tostring().padstart(2, '0');
|
// return `${y} - ${m} - ${d}`
|
// },
|
|
|
addDate(dateC, days) {
|
if (days == undefined || days == '') {
|
days = 1;
|
}
|
const date = new Date(dateC);
|
date.setDate(date.getDate() + days);
|
const month = date.getMonth() + 1;
|
const day = date.getDate();
|
return date.getFullYear() + '-' + getFormatDate(month) + '-' + getFormatDate(day);
|
|
function getFormatDate(arg) {
|
if (arg == undefined || arg == '') {
|
return '';
|
}
|
let re = arg + '';
|
if (re.length < 2) {
|
re = '0' + re;
|
}
|
return re;
|
}
|
|
}
|
|
}
|
}
|
</script>
|
|
|
<style lang="scss" scoped>
|
page {
|
width: 100%;
|
min-height: 100vh;
|
background-color: #F2F2F2;
|
box-sizing: border-box;
|
}
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
|
.inputGray2 {
|
line-height: 30px;
|
border-top: 10rpx solid transparent;
|
}
|
|
.inputGray {
|
border-top: 0rpx solid transparent;
|
|
}
|
</style>
|