货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

383 lines
9.3 KiB

2 years ago
<template>
<!-- <u-navbar title="配置包条码" placeholder border=true :autoBack="true" leftIconSize='35'></u-navbar> -->
<u-navbar title="配置包条码"
bgColor='#D3832A' leftIconColor='#ffffff'
titleStyle='color:#ffffff' placeholder
:autoBack="true" leftIconSize='35'></u-navbar>
2 years ago
<view class="head">
<view class="type1">
<view>物品<view style="color: #092C4D;">{{items.materialName}}</view></view>
</view>
<view class="type1">
<view>货位<view style="color: #092C4D;">{{orderpackgedetails.warehouseArea}}</view></view>
2 years ago
<view>SKU<view style="color: #092C4D;">{{items.sku}}</view></view>
</view>
<view class="type1">
2 years ago
<view>规格<view style="color: #092C4D;">{{items.cargoNorms}}</view></view>
<view>单位<view style="color: #092C4D;">{{items.cargoUnit}}</view></view>
2 years ago
</view>
<view class="type1">
<view>计划数量<view style="color: #092C4D;">{{items.planNum}}</view></view>
<view>已扫数量<view style="color: #092C4D;">{{codelist.length}}</view></view>
2 years ago
</view>
2 years ago
</view>
2 years ago
<view class="butsbx">
<view v-if="items.unpack==0" @click="setstockPrint(1)">采集原包条码</view>
<view @click="setstockPrint(2)">扫描打印包条</view>
2 years ago
<view @click="showmd">新生成包码</view>
</view>
<scroll-view scroll-y="true" class="scrollv">
<view class="mabxs">
<view class="ite" v-for="(item,index) in codelist">
<view>
<view>序号{{index+1}}</view>
<view>作业时间{{item.createTime}}</view>
2 years ago
</view>
<view>
<view>包条码{{item.packageCode}}</view>
<view></view>
</view>
</view>
</view>
</scroll-view>
<tiplist ref="tips"></tiplist>
2 years ago
<saomiao2></saomiao2>
2 years ago
</template>
<script lang="ts" setup>
2 years ago
import {
onLoad,
onShow,
onHide,
onUnload
} from '@dcloudio/uni-app'
import {
distributionStockupstockupStockListPackageCode,
distributionStockupstockupScan,
distributionStockuporderInfo
} from '@/api/user.js'
import { detailType } from '@/interfaces/pagesHome/setbarcode'
import { reactive, ref, toRefs,inject } from "vue";
const utils=inject('utils') as any
2 years ago
let details=reactive<detailType>({
items:{},
reservationId:'',
codelist:[],
printlist:[],
packageNum:0,
goodsAreaName:'',
allocationId:'',
stockupId:'',
stockPrint:1,
customer:'',
deliveryAddress:'',
completeStact:false,
orderpackgedetails:{}
2 years ago
})
const tips=ref(null)
2 years ago
// const tiplists=ref(null)
2 years ago
onLoad((op)=>{
details.stockupId=op.stockupId
2 years ago
details.items=JSON.parse(op.item)
details.reservationId=op.reservationId
details.goodsAreaName=op.goodsAreaName
details.allocationId=op.allocationId
if(op.completeStact=='true'){
details.completeStact=true
}
// scandata('1231')
2 years ago
uni.$on('scancodedate', function(code) {
if (code) {
console.log(code);
scandata(code)
}
})
initpage()
})
2 years ago
function showsdqs(){
tips.value.setdetails({
isshow:true,
tipstate:1,
title:'请输入扫描的码',
placeholder:'请输入扫描的码',
2 years ago
inputtext:'',
success:(detail)=>{
// details.scancode=
scandata(detail.inputtext)
tips.value.setdetails({isshow:false})
},
cancel:()=>{
tips.value.setdetails({isshow:false})
},
close:()=>{
tips.value.setdetails({isshow:false})
}
})
}
function setstockPrint(values){
details.stockPrint=values
if(values==1){
utils.ttsspke('请扫描原有包条码')
}else{
utils.ttsspke('请扫描打印的包条码')
}
}
2 years ago
async function initpage(){
let data={
orderStatus:2,
reservationId:details.reservationId,
stockListId:details.items.stockListId,
stockupId:details.stockupId,
allocationId:details.allocationId,
status:details.completeStact?1:0
2 years ago
}
let response=await distributionStockuporderInfo(data)
details.codelist=response.data.stockList
details.customer=response.data.customer
details.deliveryAddress=response.data.deliveryAddress
details.orderpackgedetails=response.data
2 years ago
}
function showmd(){
tips.value.setdetails({
list:details.printlist,
isshow:true,
tipstate:1,
placeholder:'请输入需要生成的包条码数量',
success:(deta)=>{
console.log(deta);
details.packageNum=deta.inputtext
if(Number(details.packageNum)>Number(details.items.planNum)){
uni.showToast({
title:'不能大于计划数量,请重新输入',
icon:'none'
})
tips.value.setdetails({inputtext:''})
return
}
ctokListpackage()
},
cancel:(details)=>{
tips.value.setdetails({isshow:false})
},
close:(details)=>{
tips.value.setdetails({isshow:false})
}
})
}
async function ctokListpackage(){
let data={
reservationId:details.reservationId,
stockListId:details.items.stockListId,
packageNum:details.packageNum,
allocationId:details.allocationId,
status:details.completeStact?1:0
2 years ago
}
let response=await distributionStockupstockupStockListPackageCode(data)
console.log(response);
details.printlist=response.data
let checklist=[]
response.data.map((item,index)=>{
checklist.push(index)
})
2 years ago
tips.value.setdetails({
title:'请选择要打印的包条',
tipstate:2,
list:response.data,
checklist:checklist,
2 years ago
inputtext:'',
confirmTxt:'打印',
success:(deta)=>{
if(deta.checklist.length==0){
uni.showToast({
title:'请先选择需要打印的包条码',
icon:'none'
})
return
}
deta.checklist.map(item=>{
print(details.printlist[item])
})
// scandata(response.data[0])
2 years ago
tips.value.setdetails({isshow:false})
},
cancel:(details)=>{
tips.value.setdetails({isshow:false})
},
close:(details)=>{
tips.value.setdetails({isshow:false})
}
})
}
function print(item:string){
// #ifdef APP
// const util=(inject('utils') as any)
let text='! 0 200 200 500 1\r\n'
text+='SETBOLD 2\r\n'
text+=`T 56 0 0 0 ${item}\r\n`
text+='LINE 0 50 420 50 3\r\n'
text+=`T 55 0 0 60 客户\r\n`
text+='LINE 40 50 40 110 3\r\n'
text+=`T 55 0 50 60 ${details.customer}\r\n`
text+='LINE 40 80 420 80 3\r\n'
text+=`T 55 0 50 90 ${details.deliveryAddress}\r\n`
text+='LINE 0 110 420 110 3\r\n'
text+=`T 55 0 0 120 物料\r\n`
text+='LINE 40 110 40 140 3\r\n'
text+=`T 55 0 60 120 ${details.items.materialName}\r\n`
text+='LINE 0 140 420 140 3\r\n'
text+='B QR 150 150 M 2 U 4\r\n'
text+=`MA,${item}\r\n`
text+='ENDQR\r\n'
text+='PRINT\r\n'
// let text='! 0 200 200 500 1\r\n'
// text+='SETBOLD 2\r\n'
// text+='B QR 80 40 M 2 U 8\r\n'
// text+=`MA,${item}\r\n`
// text+='ENDQR\r\n'
// text+=`T 56 0 15 280 ${item}\r\n`
// text+='PRINT\r\n'
let sylist=utils.initbl()
console.log(sylist);
sylist.map(item=>{
console.log(item);
if(item.uuids){
utils.getbl(item,text)
}
})
// #endif
}
2 years ago
async function scandata(code){
let data={
scanType:2,
stockListId:details.items.stockListId,
packetBarCode:code,
stockupArea:details.goodsAreaName,
reservationId:details.reservationId,
stockupId:details.stockupId,
stockPrint:details.stockPrint,
allocationId:details.allocationId,
status:details.completeStact?1:0,
id:details.orderpackgedetails.stockListId
2 years ago
}
// utils.ttsspke('stockPrint是'+details.stockPrint)
let res=await distributionStockupstockupScan(data)
console.log(res);
if(res.code==200){
initpage()
}
2 years ago
}
const { orderpackgedetails,items,codelist,printlist }=toRefs(details)
2 years ago
</script>
<style lang="scss">
2 years ago
.scrollv{
width: 686upx;
height: 60vh;
2 years ago
// padding: 10upx;
box-sizing: border-box;
background-color: #ffffff;
margin: auto;
margin-top: 20upx;
padding: 20upx;
box-sizing: border-box;
border-radius: 10upx;
.mabxs{
display: flex;
flex-direction: column;
align-items: center;
padding-top: 5upx;
.ite{
width: 96%;
// width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding: 20upx 15upx;
box-sizing: border-box;
border-radius: 8upx;
box-shadow: 0upx 2upx 10upx 0upx #e2e2e3;
margin-bottom: 20upx;
padding-bottom: 10upx;
font-size: 26upx;
&:nth-last-child(1){
margin-bottom: 5upx;
}
>view{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-bottom: 20upx;
&:nth-last-child(1){
margin-bottom: none !important;
}
>view{
// width: 50%;
// flex: 1;
font-size: 26upx;
font-weight: 400;
color: #092C4D;
}
}
}
}
}
.butsbx{
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 25upx;
>view{
width: 204upx;
height: 64upx;
background: #FFFFFF;
border-radius: 8upx;
opacity: 1;
font-size: 28upx;
display: flex;
align-items: center;
justify-content: center;
border: 2upx solid #D3832A;
color: #D3832A;
&:nth-of-type(2){
// margin-left: 10upx;
}
}
}
.head{
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
padding: 20upx;
// height: 176upx;
2 years ago
box-sizing: border-box;
// border-bottom: 1upx solid #ececec;
background-color: #ffffff;
>.type1{
width: 100%;
// height: 60upx;
display: flex;
align-items: flex-start;
justify-content: space-between;
font-size: 28upx;
font-weight: 400;
color: #90A0AF;
margin-bottom: 10upx;
2 years ago
>view{
flex: 1;
2 years ago
display: flex;
align-items: flex-start;
>view:nth-of-type(1){
flex: 1;
}
}
}
}
2 years ago
</style>