<template>
|
<view class="overflow">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText">
|
</block>
|
<block slot="content">A1/A2分拣(PO)</block>
|
</cu-custom>
|
<view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view>
|
<view v-if="!renameFocus" class="text-bold width fontSize32rpx"
|
style="padding: 10rpx 10rpx;background-color: #d6d6d6;border-bottom: 1px solid #bcbcbc;">
|
<view class="flex justify-between align-center">
|
<text class="width23 padding10">容器编号</text>
|
<text>{{warehouse.containerCode}}</text>
|
</view>
|
</view>
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<u-select v-model="containerVisible" :list="containerList" @confirm="containerConfirm"></u-select>
|
<view class="" v-if="renameFocus">
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="容器编号:" prop="containerCode" required
|
style="font-size: 32rpx;font-weight: bold;padding: 0;">
|
<input v-model="warehouse.containerCode"
|
@focus="containerFocus"
|
style="font-weight: bolder;margin-left: 15rpx;"
|
class="width padding_left25rpx"
|
placeholder="请录入或扫码">
|
</input>
|
<!-- <u-icon name="close-circle-fill" color="#848484" v-if="warehouse.containerCode && focu"
|
@click="warehouse.containerCode=''"></u-icon> -->
|
</u-form-item>
|
</u-col>
|
<!-- <u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx" @click="containerScane"></u-icon>
|
</u-col> -->
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="物料编号:"
|
style="font-size: 32rpx;font-weight: bold;padding: 0 0 10rpx;">
|
<input v-model="materialCode" @focus="materialCode = ''" placeholder="请录入或扫码"
|
@blur="getMaterialDetails" class="width padding_left25rpx"
|
style="font-weight: bolder;margin-left: 30rpx;">
|
</input>
|
</u-form-item>
|
</u-col>
|
<!-- <u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
|
</u-col> -->
|
</u-row>
|
</u-form>
|
<view style="margin-bottom: 180rpx;margin-top: 10rpx;">
|
<view v-for="(item, eindex) in singlist" :key="eindex" style="width: 100vw;display: flex;margin: 15rpx auto;">
|
<u-swipe-action :show="item.show" :index="eindex" @click="longpress" @open="open" :options="options" style="width: 100vw;">
|
<view class="title-wrap fontSize32rpx background_fff" :class="item.showItem ? 'bg_item' : ''" style="width: 100vw;">
|
<u-row>
|
<u-col span="1">
|
<view class="flex justify-center align-center"
|
style="background-color: #f18202;color: #fff;border-radius: 50%;width: 40rpx;height: 40rpx;">
|
{{eindex+1}}
|
</view>
|
</u-col>
|
<u-col span="10">
|
<view class="color_f18202">
|
{{item.wareMaterialCode}} ({{item.batchNo}})
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
分拣需求数:{{item.quantity}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
已分拣数:{{item.sortingQuantity}}
|
</view>
|
</u-col>
|
|
<u-col span="6" class="flex">
|
<view class="" style="color: #808080;">
|
实际分拣数:
|
</view>
|
<input
|
class="border_bottom_f18202 text-left color_f18202 fontSize32rpx"
|
style="background-color: #f2f2f2;height: 70rpx;width: 115rpx;" v-model="item.uncollectedQuantity"
|
type="number" @blur="changeNum(item)" placeholder=""
|
/>
|
</u-col>
|
</u-row>
|
</view>
|
</u-swipe-action>
|
</view>
|
|
</view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
|
<view class="pop ">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<scroll-view scroll-y="true" style="height: 50vh;margin-bottom: 140rpx;">
|
<view class="line flex justify-between">
|
<text class="text-gray">DO单号</text>
|
<text>{{materlist.deliveryNo}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.wareMaterialCode}}</text>
|
</view>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.materialTypeName}}</text>
|
</view> -->
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.wareMaterialName }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">批次</text>
|
<text>{{materlist.batchNo}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">已分拣数</text>
|
<text>{{materlist.sortingQuantity}}</text>
|
</view>
|
</scroll-view>
|
</view>
|
<button-modal :subShow='true' garmenTitle='打印' @submit='init' />
|
</u-popup>
|
<button-modal :empTytowerShow='true' cleaningTitle="回库" garmenTitle='下一步' @submit='next' @reset='rest' />
|
</view>
|
<view class="" v-else>
|
<scroll-view scroll-y="true" style="height: 800rpx;">
|
<view v-for="(item,eindex) in arr" :key="eindex" style="background-color: #fff;" class="fontSize32rpx">
|
<u-row style='padding: 25rpx 15rpx 0; '>
|
<u-col span="12" class="flex">
|
<view class="flex justify-center align-center "
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 40rpx;height: 40rpx;">
|
{{eindex+1}}
|
</view>
|
<view class="padding_left10rpx color_f18202">
|
{{item.wareMaterialCode}}
|
</view>
|
</u-col>
|
|
</u-row>
|
<u-row style='padding: 25rpx 15rpx 0;'>
|
<u-col span="6" class="flex" style="text-align: right;">
|
需求分拣:{{item.quantity}}
|
</u-col>
|
<u-col span="6" class="">
|
已分拣数:{{item.sortingQuantity}}
|
</u-col>
|
</u-row>
|
<u-row style='padding: 25rpx 15rpx 0;'>
|
<u-col span="6" class="color_f18202" >
|
实际分拣:{{item.uncollectedQuantity}}
|
</u-col>
|
<u-col span="6" class="flex">
|
<view class="padding_left45rpx">
|
剩余:{{ Number( item.quantity - item.sortingQuantity - item.uncollectedQuantity).toFixed(3) }}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
<!-- </view> -->
|
</scroll-view>
|
<button-modal :empTytowerShow='true' cleaningTitle="上一步" garmenTitle='分拣完成' @submit='submit' @reset='back' />
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../components/buttonModal.vue'
|
import {getContainDetail} from '../../api/putIn/artificial.js'
|
import ModalCode from '../../components/ModalCode.vue'
|
import {getOutWarehousePO,addWarehouseDetailsPO, getwmsOrderMovementDetails} from '../../api/sort.js'
|
import {getDate} from '../../utils/dateTime.js'
|
import {getAttrValue} from '../../utils/tool.js'
|
import BluePrint from '@/pages/print/bluePrint.js'
|
export default {
|
data() {
|
return {
|
containerVisible: false,
|
containerList: [],
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
resmessage: "",
|
modalshow: false,
|
action: this.$myHOST + '/sysFileInfo/uploadImages',
|
singlist: [
|
// {
|
// "id": 394312061149253,
|
// "quantity": 19.11,
|
// "wareMaterialCode": "18VS020A711-011111",
|
// "wareContainerCode": "A3080201",
|
// "wareMaterialName": "SPACER, X LMG\nSPACER, X LMG BLOCK",
|
// "batchNo": "22222222222",
|
// "materialTypeName": "",
|
// "deliveryNo": "qqq",
|
// "sortingQuantity":2.23
|
// }
|
], //物料详情
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
containerCode: '',
|
},
|
activeIndex: 100,
|
detailable: false,
|
materialCode: '', //物料编号
|
warehouseRules: {
|
containerCode: [{
|
required: true,
|
message: '容器编号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
}],
|
operator: '',
|
Datetime: getDate(),
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
// this.getOrderNo()
|
},
|
computed: {
|
containerCode() {
|
return this.warehouse.containerCode
|
}
|
},
|
watch: {
|
containerCode(val) {
|
if(!val) {
|
this.detailable = false;
|
}
|
}
|
},
|
methods: {
|
//打印
|
init() {
|
const arr = ['warematerialCode','batchNo','uncollectedQuantity'];
|
const arrzw = ['物料编号','批次','实际分拣数']
|
let isAllow = ''
|
Object.keys(this.materlist).forEach(item => {
|
if(arr.includes(item)) {
|
if(!this.materlist[item]) {
|
isAllow = arr.indexOf(item)
|
// this.rescode = 400
|
// this.resmessage = `${item}为空,不能继续打印`
|
// this.$refs.resmodal.show = true
|
return
|
}
|
}
|
})
|
if(isAllow!=''){
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
if(this.materlist.uncollectedQuantity > (this.materlist.quantity - this.materlist.sortingQuantity)){
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `数量不符合规范,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
//物料名称是否换行
|
let name = this.materlist.wareMaterialName
|
let name_1 = name.length > 38 ? name.substr(0, 38) : name
|
let name_2 = name.length > 38 ? name.substr(38) : ''
|
//供应商是否换行
|
let desc = this.materlist.supplier || ''
|
let desc_1 = desc.length > 38 ? desc.substr(0, 38) : desc
|
let desc_2 = desc.length > 38 ? desc.substr(38) : ''
|
let ptintContext = [
|
{type:'text',x:0,y:0,text:'',size:2,rotate:0,bold:0,underline:false,reverse:false},
|
{type:'text',x:0,y:0,text:'',size:2,rotate:0,bold:0,underline:false,reverse:false},
|
{type:'text',x:0,y:0,text:'',size:2,rotate:0,bold:0,underline:false,reverse:false},
|
/* 以上空数据,为防止丢包时打印不正常 */
|
{type:'line',x1:3,y1:3,x2:570,y2: 3,width:2}, //上边线
|
{type:'line',x1:3,y1:3,x2:3,y2: 460,width:2},//左边线
|
{type:'line',x1:3,y1:458,x2:570,y2: 458,width:2}, //最下边线
|
{type:'line',x1:560,y1:3,x2:560,y2:420,width:2}, //右边线
|
{type:'text',x:10,y:15,text:`Part:${this.materlist.wareMaterialCode}`,size:3,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:50,x2:565,y2:50,width:2},
|
{type:'text',x:10,y:60,text:`Descript:${name_1}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'text',x:10,y:95,text:`${name_2}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:130,x2:565,y2:130,width:2},
|
{type:'text',x:10,y:140,text:`Vendor:${desc_1}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'text',x:10,y:175,text:`${desc_2}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:210,x2:565,y2:210,width:2},
|
{type:'text',x:10,y:225,text:`DO:${this.materlist.deliveryNo}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:260,x2:350,y2:260,width:2},
|
{type:'text',x:10,y:280,text:`Qty:${this.materlist.uncollectedQuantity} ${this.materlist.unit == null ? '' : this.materlist.unit}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:315,x2:350,y2:315,width:2},
|
{type:'line',x1:3,y1:360,x2:350,y2:360,width:2},
|
{type:'text',x:10,y:375,text:`Print Date:${this.getCurrentDate().date}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:3,y1:410,x2:350,y2:410,width:2},
|
{type:'text',x:10,y:425,text:`Print Time:${this.getCurrentDate().time}`,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
{type:'line',x1:350,y1:210,x2:350,y2:460,width:2},
|
{type:'qr',x:380,y:230,text:`PARTS NUMBER: ${this.materlist.wareMaterialCode},MATERIAL NAME: ${this.materlist.wareMaterialName},LOT NO: ${this.materlist.batchNo},QUANTITY: ${this.materlist.uncollectedQuantity}`,width:4,level:1},
|
{type:'text',x:405,y:420,text:``,size:2,rotate:0,bold:1,underline:false,reverse:false},
|
]
|
console.log( ptintContext)
|
BluePrint.print(this.$store,ptintContext).then(()=>{
|
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
let curRoute = routes[routes.length - 1].route //获取当前页面路由
|
console.log(curRoute)
|
if (curRoute == 'pages/print/bluetoothConnection') {// 连接蓝牙失败 跳页面
|
return
|
}
|
uni.showToast({
|
title:'打印成功',
|
duration:2000
|
})
|
this.addForm.code = this.materlist.wareMaterialCode;
|
this.addForm.name = this.materlist.wareMaterialName;
|
this.addForm.batchNo = this.materlist.batchNo;
|
this.addForm.specificationModel = this.materlist.specificationModel;
|
//这里不再记录打印记录,因为有了斑马打印 【Editby shaocx,2023-05-22】
|
/*
|
addPrintRecord(this.addForm).then(res => {
|
console.log(res);
|
})
|
//*/
|
}).catch((err)=>{
|
uni.showToast({
|
title:'打印失败',
|
duration: 2000
|
})
|
})
|
},
|
//获取print date print time
|
getCurrentDate() {
|
let date = new Date();
|
let year = date.getFullYear(); //年
|
let month = date.getMonth() + 1; //月
|
month = month >= 10 ? month : '0' + month;
|
let day = date.getDate(); //日
|
day = day >= 10 ? day : '0' + day;
|
let hour = date.getHours() //时
|
hour = hour >= 10 ? hour : '0' + hour;
|
let min = date.getMinutes(); //分
|
min = min >= 10 ? min : '0' + min;
|
let second = date.getSeconds(); //秒
|
second = second >= 10 ? second : '0' + second;
|
return {
|
date: `${day}.${month}.${year}`,
|
time: `${hour}:${min}:${second}`,
|
formate:`${year}/${month}/${day}`
|
}
|
},
|
//容器选择
|
containerConfirm(context){
|
this.warehouse.containerCode = context[0].value
|
this.getOutWarehouse()
|
},
|
//容器聚焦事件
|
containerFocus() {
|
this.getContainerList()
|
},
|
//获取当前区域的需要分拣的容器列表
|
getContainerList() {
|
// //debugger
|
let param = {
|
'locationType':'2'
|
}
|
getwmsOrderMovementDetails(param).then(res => {
|
this.containerList = res.data.reduce((curr,item) => {
|
curr.push({
|
label: item,
|
value: item
|
})
|
return curr;
|
},[])
|
this.containerVisible = true;
|
})
|
},
|
//查询物料
|
getOutWarehouse() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
setTimeout(() => {
|
this.focu = false
|
if (this.warehouse.containerCode !== '') {
|
let params = {
|
WareContainerCode: this.warehouse.containerCode
|
}
|
getOutWarehousePO(params).then((res) => {
|
if (res.code == 200) {
|
if(res.data.length == 0) {
|
this.resmessage = '当前容器无可出物料'
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
}else {
|
|
res.data.map(item => {
|
item.uncollectedQuantity = parseFloat(item.quantity) - parseFloat(item.sortingQuantity)
|
item.showItem = false
|
return item
|
})
|
this.singlist = res.data
|
}
|
|
} else {
|
this.resmessage = res.message
|
this.rescode = res.code
|
this.$refs.resmodal.show = true
|
}
|
})
|
}
|
}, 200)
|
}
|
})
|
},
|
//判断此物料编号是否存在
|
getMaterialDetails() {
|
this.materialCode = getAttrValue(this.materialCode,'PARTSNUMBER')
|
if (this.materialCode !== '') {
|
//获取当前物料 + 批次的所有数据
|
const arr = this.singlist.reduce((curr,item,index) => {
|
if(item.wareMaterialCode == this.materialCode) {
|
curr.push(index)
|
}
|
return curr;
|
},[])
|
|
if(arr.length > 0) {
|
arr.forEach(item => {
|
this.singlist[item].showItem = true;
|
this.singlist.unshift(...this.singlist.splice(item, 1))
|
})
|
}else {
|
uni.showModal({
|
title: '提示',
|
content: '当前分拣单中不需分拣此物料',
|
showCancel: false
|
})
|
}
|
}
|
},
|
//详情
|
longpress(index, eindex) {
|
this.materlist = this.singlist[index]
|
this.activeIndex = index;
|
this.detailshow = true
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
},
|
|
//改变组盘数量
|
changeNum(val) {
|
if (parseFloat(val.uncollectedQuantity) < 0 || val.uncollectedQuantity =='') {
|
uni.showModal({
|
title: '提示',
|
content: '分拣数量不能小于0',
|
showCancel: false
|
})
|
}
|
// val.uncollectedQuantity = Number(val.uncollectedQuantity.toString().match(/^\d+(?:\.\d{0,2})?/)) // 保留两位小数
|
let num1 = Number( Number(val.quantity) - Number(val.sortingQuantity)).toFixed(3) //必须保留3位小数 -否则会造成剩余物料是小数的时候,无法收货
|
if (parseFloat(val.uncollectedQuantity) > Number(num1)) {
|
uni.showModal({
|
title: '提示',
|
content: '分拣数量不能大于需求数和已分拣之差',
|
showCancel: false
|
})
|
}
|
|
},
|
//确认
|
next() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
if(this.singlist.length == 0) {
|
this.rescode = 400
|
this.resmessage = `次容器下没有可分拣的物料`
|
this.$refs.resmodal.show = true
|
return
|
}else {
|
// let count = this.singlist.findIndex(item => item.uncollectedQuantity == '' || parseFloat(item.uncollectedQuantity) <= 0 || parseFloat(item.uncollectedQuantity) > (parseFloat(item.quantity) - parseFloat(item.sortingQuantity) ) )
|
|
// if(count > -1) {
|
// uni.showToast({
|
// title: `${this.singlist[count].wareMaterialCode}分拣数量不合要求`,
|
// icon:'none'
|
// })
|
// return
|
// }
|
this.arr = this.singlist;
|
this.renameFocus = false;
|
}
|
|
}else {
|
this.rescode = 400
|
this.resmessage = `表单验证失败,请检查参数是否符合要求`
|
this.$refs.resmodal.show = true
|
return
|
}
|
});
|
},
|
submit() {
|
let sortingLists = this.arr.reduce((curr,item) => {
|
curr.push({
|
wareMaterialCode: item.wareMaterialCode,
|
wareMaterialName: item.wareMaterialName,
|
quality: item.uncollectedQuantity,
|
betchNo: item.batchNo,
|
id:item.id
|
})
|
return curr
|
},[])
|
let params = {
|
createdTime: this.Datetime,
|
updatedTime: this.Datetime,
|
createdUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
createdUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
updatedUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
updatedUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
wareContainerCode: this.warehouse.containerCode,
|
gridNumber: 1,
|
useNumber: 0,
|
sortingLists
|
}
|
|
uni.showModal({
|
title: '提示',
|
content: '确定是否分拣?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
addWarehouseDetailsPO(params).then((res) => {
|
this.rescode = res.code
|
this.resmessage = res.message
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.renameFocus = true
|
this.resetData();
|
}
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
|
},
|
//数据重置
|
resetData() {
|
this.warehouse.gridNumber = 1;
|
this.warehouse.useNumber = 0;
|
this.warehouse.exitNumber = 0;
|
this.materialCode = '';
|
this.arr = [];
|
this.singlist = [];
|
|
},
|
//回库
|
rest() {
|
uni.navigateTo({
|
url:`/pages/sort/return?containerCode=${this.warehouse.containerCode}`
|
})
|
|
},
|
//上一步
|
back(){
|
// uni.navigateTo({
|
// url:`/pages/sort/return?containerCode=${this.warehouse.containerCode}`
|
// })
|
this.renameFocus=true
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
</style>
|