货无忧
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.
 
 
 
 
 

1919 lines
46 KiB

<template>
<image mode="widthFix" class="bgimg"
src="https://huo5you.oss-cn-chengdu.aliyuncs.com/other/pdaImages/pdaImages/bgby.png"></image>
<BasicContainer :option="option" ref="basicContainer">
<template #head>
<view class="header_top">
<view class="header_box">
<!-- 搜索框 -->
<view class="header_search flex-c-c" @click.stop>
<view class="flex1 search_container">
<MyInput placeholder="请输入包条码或托盘码" v-model.trim="details.searchText" clearable />
</view>
<view class="submitBtn flex-c-c ml20" @click="handleSearch" hover-class="clickClass">
<u-icon name="search" color="#fff" size="36" />
<text class="ml10">
</text>
</view>
</view>
<!-- 托盘信息 -->
<PullDownBox :isShowIcon="true" :ExistenceOrNot="true" @change="handlePullDownChange">
<template #title>
<view class="header_title">
<view class="">
<text class="textTitleColor">托盘名称</text>
<text class="">{{detauser?.trayName || ''}}</text>
</view>
<view class="">
<text class="textTitleColor">托盘码</text>
<text class="">{{detauser?.trayCode || details.trayCode}}</text>
</view>
<view class="">
<text class="textTitleColor">打托方式</text>
<text class="">{{detauser?.trayTypeName || ''}}</text>
</view>
<view class="">
<text class="textTitleColor">名称</text>
<text class="">{{detauser?.name || '暂无数据'}}</text>
</view>
<view style="width: 100%;">
<text class="">备注</text>
<text>{{ details.Remarktext || '暂无数据' }}</text>
</view>
</view>
<view class="flex-c-sb mt10">
<view @click.stop="()=>setshowstate(1)" class="submitBtn flex-c-c rem-0-9"
hover-class="clickClass">
<u-icon name="edit-pen-fill" color="#fff" size="36" />
<text class="ml10">
编辑备注
</text>
</view>
<view @click.stop="print" class="submitBtn flex-c-c rem-0-9" hover-class="clickClass">
<u-icon name="file-text-fill" color="#fff" size="36" />
<text class="ml10">
打印清单
</text>
</view>
</view>
</template>
<template #content>
<view class="pt20">
<view class="header_title header_content">
<view class="">
<view class="textTitleColor text-center">订单在托数量</view>
<view class="text-center mt20 number">{{detauser?.orderlNum || 0}}</view>
</view>
<view class="">
<view class="textTitleColor text-center">订单总数</view>
<view class="text-center mt20 number">{{detauser?.orderTotalNum || 0}}</view>
</view>
<view class="">
<view class="textTitleColor text-center">库存品在托数量</view>
<view class="text-center mt20 number">{{detauser?.stockNum || 0}}</view>
</view>
<view class="">
<view class="textTitleColor text-center">库存品总数</view>
<view class="text-center mt20 number">{{detauser?.stockTotalNum || 0}}</view>
</view>
</view>
</view>
</template>
</PullDownBox>
</view>
<!-- tabbar -->
<view class="tabBar">
<view :class="{tabBar_item: true, active: details.tabBarState === 1}" @click="setTabBarState(1)">
定制品
</view>
<view :class="{tabBar_item: true, active: details.tabBarState === 2}" @click="setTabBarState(2)">
零担
</view>
<view :class="{tabBar_item: true, active: details.tabBarState === 3}" @click="setTabBarState(3)">
库存品
</view>
</view>
</view>
</template>
</BasicContainer>
<view class="scvmabx">
<template v-if="details.tabBarState === 3">
<view class="marketName" @click="chooseMarket">
<u-icon name="bag" color="#2979ff"></u-icon>
<view>商场名称:</view>
<view>
{{ details.stock.marketName || '暂无数据' }}
</view>
</view>
</template>
<view class="maxboxs">
<block v-for="(item, index) in datelist">
<!-- 定制品 -->
<template v-if="details.tabBarState === 1">
<view class="items chuanhuo position-r" @click="godetaillist(item)">
<view class="tophd flex-c-sb" @click.stop.prevent>
<image src="/pagesHome/static/topicons.png"></image>
<view>订单号:</view>
<view :style="item.isFleeing ? 'color: #ff0000;' : ''" class="flex1">
{{ item.dataCode }}
</view>
<image @click="removeitem(item)" src="/pagesHome/static/removeitem.png"></image>
</view>
<view class="tophd">
<view>服务号:</view>
<view>{{ item.serviceNumber }}</view>
</view>
<view class="numbxvie">
<view>
<view class="zhon">{{ item.orderTotalNum }}</view>
<view>总数</view>
</view>
<view>
<view class="yish">{{ item.scanNum }}</view>
<view>已扫</view>
</view>
<view>
<view class="weish">{{ item.orderTotalNum - item.scanNum }}</view>
<view>未扫</view>
</view>
</view>
<!-- 齐套标识 -->
<view :class="{tip: true, completeSet: true, active: item.orderTotalNum === item.scanNum}"></view>
<!-- 窜货标识 -->
<view class="tip fleeingGoods" v-if="item.isFleeing"></view>
</view>
</template>
<!-- 零担 -->
<template v-if="details.tabBarState === 2">
<view class="items">
<view class="tophd" @click.stop.prevent>
<image src="/pagesHome/static/topicons.png"></image>
<view>订单号:</view>
<view class="flex1">{{ item.dataCode }}</view>
<image @click="removeitem(item)" src="/pagesHome/static/removeitem.png"></image>
</view>
<view class="tophd" @click.stop.prevent>
<view>运单号:</view>
<view>{{ item.waybillNo }}</view>
</view>
<view class="numbxvie">
<view>
<view class="zhon">{{ item.orderTotalNum }}</view>
<view>总数</view>
</view>
<view>
<view class="yish">{{ item.scanNum }}</view>
<view>打托数量</view>
</view>
</view>
</view>
</template>
<!-- 库存品 -->
<template v-if="details.tabBarState === 3">
<view class="items">
<view class="tophd1">
<view>
<image src="/pagesHome/static/topicons.png"></image>
<view class="flex1">订单号:</view>
<view>{{ item.dataCode }}</view>
</view>
<image @click="removeitem(item)" src="/pagesHome/static/removeitem.png"></image>
</view>
<view class="tophd">
<image src="/pagesHome/static/uname.png"></image>
<view>物料名称:</view>
<view class="flex1">{{ item.dataName }}</view>
</view>
<view class="tophd">
<image src="/pagesHome/static/uname.png"></image>
<view>批次号:</view>
<view class="flex1">{{ item.incomingBatch }}</view>
</view>
<view class="tophd">
<image src="/pagesHome/static/uname.png"></image>
<view>SKU:</view>
<view class="flex1">{{ item.sku }}</view>
</view>
<view class="tophd">
<image src="/pagesHome/static/uname.png"></image>
<view>物料单位:</view>
<view class="flex1">{{ item.cargoUnit }}</view>
</view>
<view class="numbxvie">
<view>
<view class="zhon">{{ item.orderTotalNum || 0 }}</view>
<view>在库数</view>
</view>
<view>
<view class="yish">{{ item.scanNum || 0 }}</view>
<view>已扫</view>
</view>
</view>
</view>
</template>
</block>
</view>
</view>
<view class="footer">
<view class="footer_container flex">
<view class="button" @click="handleCreateTray">
打印托盘码
</view>
<!-- 零担/库存品继续录入 -->
<template v-if="details.tabBarState !== 1">
<view class="button" @click="setshowstate(details.tabBarState)">继续录入</view>
</template>
</view>
</view>
<template v-if="details.showstate !== 0">
<view class="tanchuangbg" @click="setshowstate(0)" @touchmove.stop v-if="showstate !== 0">
<!-- 备注 -- 修改 -->
<view class="tanbx" @click.stop.prevent v-if="showstate == 1">
<view class="titlran">备注</view>
<view class="textareabx">
<textarea maxlength="-1" placeholder="请输入备注" v-model="details.Remarktext"></textarea>
</view>
<view class="btx">
<view class="cancel" @click="setshowstate(0)">取消</view>
<view class="confirm" @click="checkremaker">确认</view>
</view>
</view>
<!-- 零担 -- 录入 -->
<template v-if="showstate === 2">
<view class="inputbox" @click.stop.prevent>
<view class="inputscan">
<input placeholder="输入运单号" v-model="waybillCode" />
<view class="scanbt" @click="scanlist">搜索</view>
</view>
<scroll-view scroll-y="true" class="scvbw">
<view class="scboxitem">
<view class="items" v-for="(item, index) in codelist">
<view class="type1s">
<view>订单号:</view>
<view>{{ item.dataCode }}</view>
</view>
<view class="type1s">
<view>
<view>总件数:</view>
<view>{{ item.orderTotalNum }}件</view>
</view>
</view>
<view class="type1s">
<view>
<view>剩余件数:</view>
<view>{{ item.residueNum }}件</view>
</view>
</view>
<view class="rksu">
<view>
<view>入库数:</view>
<input placeholder="请输入入库数" v-model="item.number" type="number" @input="inputNum(item)" />
</view>
</view>
<view class="lisbite" v-if="checkinarr.indexOf(index) != -1">
<view class="itembox" v-for="ite in item.positionList">
<view v-if="ite.allocationName">库位码:{{ ite.allocationName }}</view>
<view>托盘码:{{ ite.trayCode }}</view>
<view>数量:{{ ite.num }}</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="btx">
<view class="cancel" @click="setshowstate(0)">取消</view>
<view class="confirm" @click="confirmlist">确认</view>
</view>
</view>
</template>
<!-- 库存品 -- 录入 -->
<template v-if="showstate === 3">
<view class="inputbox" @touchmove.stop @click.stop.prevent>
<view class="flex-c-sb w100 rem-0-9">
<view class="">
搜索方式:
</view>
<view @click="details.stock.activeStatus = 'materialName'"
:class="{checkbtn:true, active: details.stock.activeStatus === 'materialName'}">
物料名称
</view>
<view @click="details.stock.activeStatus = 'materialCode'"
:class="{checkbtn:true, active: details.stock.activeStatus !== 'materialName'}">
物料编码
</view>
</view>
<view class="inputscan mt20">
<input class="flex1" :placeholder="details.stock.activeStatus === 'materialName'?'请输入物料名称':'输入物料编码'"
v-model="details.stock.materialCode" />
<view class="scanbt ml10" @click="stockSearch">搜索</view>
</view>
<!-- <view class="inputscan mt20">
<input class="flex1" placeholder="输入物料名称" v-model="details.stock.materialName" />
</view> -->
<scroll-view scroll-y="true" @touchmove.stop class="scvbw">
<view class="scboxitem">
<view class="items" v-for="(item, index) in details.stock.searchStockList">
<view class="type1s">
<view>
<view>物料编码:</view>
<view>{{ item.cargoNumber }}</view>
</view>
</view>
<view class="type1s">
<view>
<view>物料名称:</view>
<view>{{ item.descriptionGoods }}</view>
</view>
</view>
<view class="type1s">
<view>
<view>订单编号:</view>
<view>{{ item.orderCode }}</view>
</view>
</view>
<view class="type1s">
<view>
<view>物料单位:</view>
<view>{{ item.cargoUnit }}</view>
</view>
<view>
<view>包装数量:</view>
<view>{{ item.cargoNorms }}</view>
</view>
</view>
<view class="type1s">
<view>
<view>剩余数量:</view>
<view>{{ item.quantityStock }}{{ item.cargoUnit }}</view>
</view>
<view>
<view>SKU:</view>
<view>{{ item.sku }}</view>
</view>
</view>
<view class="rksu" @click.stop.prevent>
<view>
<view>数量:</view>
<input placeholder="请输入数量" v-model.trim="item.maknumber" @input="stockInput(item)" />
</view>
</view>
<view class="lisbite" v-if="checkinarr.indexOf(index) != -1">
<view class="itembox" v-for="ite in item.positionList">
<view>
库位:
<text v-if="ite.areaName">{{ ite.areaName }}</text>
<text v-if="ite.allocationName">{{ '-' + ite.allocationName }}</text>
</view>
<view>托盘码:{{ ite.trayCode }}</view>
<view>数量:{{ ite.num }}</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="btx">
<view class="cancel" @click="setshowstate(0)">取消</view>
<view class="confirm" @click="confirmlur">确认</view>
</view>
</view>
</template>
</view>
</template>
<saomiao2 :ishidestop="scanState !== 0"></saomiao2>
<tips ref="tip"></tips>
<tiplist ref="tiplists"></tiplist>
<BluetoothList ref="bluetoothList"></BluetoothList>
</template>
<script lang="ts" setup>
import {
warehouseTrayTypedeleteOrderCode,
warehouseTrayTypeorderScanOrderPackageCode,
warehouseTrayTypeorderScanTrayCode,
warehouseTrayTypedeleteStockByTrayGoodsId,
warehouseTrayTypezeroOrderUpdateRemark,
warehouseTrayenterZeroOrderByTrayCode,
warehouseTrayTypegetZeroOrderByWaybillCode,
warehouseTrayTypeselectStockByMaterialCodeAndMarketId,
warehouseTrayTypeenterStockNoDataMaterialCode,
warehouseTrayTypefindAllMarket,
warehouseTrayTypedeleteZeroOrderByTrayCode,
warehouseTrayTypeSelectStockByMaterialNameAndMarketId
} from '@/api/user.js'
import { onLoad, onShow } from '@dcloudio/uni-app'
import utils from '@/utils/utils.js'
import { reactive, ref, toRefs, nextTick } from 'vue'
import dayjs from 'dayjs'
// 引入Pinia仓库
import useBluetoothStore from '@/store/useBluetoothStore.js'
import useSystemSettingsStore from '@/store/useSystemSettingsStore'
import { storeToRefs } from 'pinia'
const { scanState } = storeToRefs(useSystemSettingsStore())
const option = reactive({
title: '分拣扫描',
haveData: true,
isFixed: true,
pullDownRefreshInitPage() {
return initlist()
},
haveReachBottom: false
})
let details = reactive({
trayCode: '',
trayType: '',
scancode: '',
datelist: [],
codelist: [],
checkinarr: [],
waybillCode: '',
detauser: null as any,
trayCodevalue: '',
iscan: false,
tabBarState: 1,
// 备注
Remarktext: '',
// 零担弹窗开启状态
showstate: 0,
// 库存品
stock: {
// 商城Id
marketId: '',
marketName: '',
// 物料编码
materialCode: '',
// 物料名称
materialName: '',
// 库存品列表
searchStockList: [],
/** 搜索状态 -- 编码 | 名称 */
activeStatus: 'materialName' as 'materialCode' | 'materialName'
},
/** 搜索的值 */
searchText: ''
})
let tip = ref(null)
const tiplists = ref(null)
const bluetoothList = ref(null)
const basicContainer = ref()
const bluetoothStore = useBluetoothStore()
const { bluetoothInfo } = storeToRefs(bluetoothStore)
onLoad(op => {
details.trayCode = op.trayCode
details.trayType = op.trayType
if (op.pageName) utils.ttsspke('当前打托方式为' + op.pageName)
console.log('details.trayType :>> ', details.trayType)
if (!op.trayType) {
uni.showToast({
title: '获取打托方式出错',
icon: 'none',
})
}
})
onShow(async () => {
uni.$off('scancodedate')
uni.$on('scancodedate', function (code) {
if (code) {
console.log(code)
details.scancode = code
if (details.showstate === 2) {
details.waybillCode = code
return
}
if (details.showstate === 3) {
details.stock.materialCode = code
return
}
scandata()
details.iscan = true
}
})
await nextTick()
basicContainer.value.startPullDownRefresh()
})
async function godetaillist(item) {
uni.navigateTo({
url:
'/pagesHome/pages/OrderSortingDetailList/OrderSortingDetailList?orderCode=' +
item.dataCode +
'&trayCode=' +
details.trayCode,
})
}
/** 下拉盒状态变化时 */
const handlePullDownChange = () => {
nextTick(() => {
const timer = setTimeout(() => {
basicContainer.value.handleSetHeaderHeight()
clearTimeout(timer)
}, 500)
})
}
/**
* 删除
*/
function removeitem(item : any) {
// 定制品
if (details.tabBarState === 1) removeOrder(item)
// 零担
else if (details.tabBarState === 2) removeZero(item)
// 库存品
else if (details.tabBarState === 3) removeStock(item)
}
/**
* 删除定制品
*/
function removeOrder(item : any) {
tip.value.setdetails({
title: '提示',
content: '确认删除该订单与托盘码的绑定?',
confirmTxt: '确认',
cancelTxt: '取消',
isshow: true,
isshowcancel: true,
success: async () => {
let data = {
trayCode: details.trayCode,
orderCode: item.dataCode,
}
let res = await warehouseTrayTypedeleteOrderCode(data)
if (res.code !== 200) return
console.log('res :>> ', res)
initlist()
tip.value.setisshow(false)
},
cancel: () => {
tip.value.setisshow(false)
},
close: () => {
tip.value.setisshow(false)
},
})
}
/**
* 删除零担
*/
function removeZero(item : any) {
tip.value.setdetails({
title: '提示',
content: '确认删除该订单和托盘的绑定?',
confirmTxt: '确认',
cancelTxt: '取消',
isshow: true,
isshowcancel: true,
success: async () => {
let data = {
trayCode: details.trayCode,
orderCode: item.dataCode,
}
let response = await warehouseTrayTypedeleteZeroOrderByTrayCode(data)
if (response.code == 200) {
initlist()
}
tip.value.setisshow(false)
},
cancel: () => {
tip.value.setisshow(false)
},
close: () => {
tip.value.setisshow(false)
},
})
}
/**
* 删除库存品
*/
function removeStock(item : any) {
tip.value.setdetails({
isshow: true,
content: '确认删除该数据?',
confirmTxt: '删除',
cancelTxt: '取消',
success: async () => {
let data = {
trayGoodsId: item.trayGoodsId,
}
let res = await warehouseTrayTypedeleteStockByTrayGoodsId(data)
console.log('res :>> ', res)
if (res.code == 200) {
initlist()
}
tip.value.setdetails({ isshow: false })
},
cancel: () => {
tip.value.setdetails({ isshow: false })
},
close: () => {
tip.value.setdetails({ isshow: false })
},
})
}
async function initlist() {
let data = {
trayCode: details.trayCode,
}
let res = await warehouseTrayTypeorderScanTrayCode(data)
console.log(res.data, 'resresresres')
if (res.code == 200) {
details.detauser = {}
details.datelist = []
// 有数据
if (res.data.isHasData == 1) {
// details.datelist = res.data.data.list
details.detauser = res.data.data
details.stock.marketId = res.data.data.marketId
details.stock.marketName = res.data.data.marketName
details.Remarktext = res.data.data.reamrk
console.log(' details.detauser :>> ', details.detauser)
// 正常订单
const _normalArr = []
// 异常订单
const _abnormalArr = []
for (let item of details.detauser.packageList) {
item.isFleeing === 0 ? _normalArr.push(item) : _abnormalArr.push(item)
}
details.detauser.packageList = [..._abnormalArr, ..._normalArr]
if (details.tabBarState === 1) details.datelist = details.detauser.packageList
else if (details.tabBarState === 2) details.datelist = details.detauser.zeroList
else if (details.tabBarState === 3) details.datelist = details.detauser.stockList
}
// 无数据
else {
res.data.data.map(item => {
if (item.dictKey == details.trayType) {
details.trayCodevalue = item.dictValue
}
})
}
}
return res
}
function scandata() {
// 当扫描的码值为托盘码时
if (details.scancode[0] === 'T') scanTray()
// 定制品
else if (details.tabBarState === 1) return scanOrder()
// 零担
else if (details.tabBarState === 2) return
// 库存品
else if (details.tabBarState === 3) return scanStock()
}
const handleSearch = () => {
console.log('details.searchText :>> ', details.searchText);
if (!details.searchText) return utils.handleToast('请输入码值')
details.scancode = details.searchText
scandata()
}
/**
* 扫描托盘码
*/
async function scanTray() {
let data = {
trayCode: details.scancode,
}
let res = await warehouseTrayTypeorderScanTrayCode(data)
if (res.code !== 200) return
console.log('res', res)
if (Number(res.data.isHasData) === 0) {
uni.setStorageSync('trayCodeType', res.data.data)
uni.redirectTo({
url: '/pagesHome/pages/ScanSortingType/ScanSortingType?trayCode=' + details.scancode,
})
} else {
uni.redirectTo({
url:
'/pagesHome/pages/OrderSortingDetail/OrderSortingDetail?trayCode=' +
res.data.data.trayCode +
'&trayType=' +
res.data.data.trayType,
})
}
}
/**
* 扫描包件执行的回调
*/
async function scanOrder() {
let submitData = {
trayType: details.trayType,
trayCode: details.trayCode,
orderPackageCode: details.scancode,
}
let response = await warehouseTrayTypeorderScanOrderPackageCode(submitData)
if (response.code !== 200) return
console.log('response', response)
const res = await initlist()
const { code } = res
console.log('res :>> ', res)
console.log('details.scancode :>> ', details.scancode)
// 判定扫描包件状态是否正常或是否已打托
if (code !== 200) return
if (details?.detauser?.trayNum && details?.detauser?.trayNum > 0) {
if (response.code === 200) utils.ttsspke(details.detauser.trayNum + '件')
const {
data: { orderCode },
} = response
// 查询被扫描的订单, 检测订单内的数量是否齐套
const scanOrder = details.datelist.find(val => val.dataCode === orderCode)
console.log('scanOrder :>> ', scanOrder)
if (scanOrder && scanOrder.orderTotalNum === scanOrder.scanNum) {
// #ifdef APP
utils.ttsspke(`订单${orderCode}已齐套`)
// #endif
}
}
}
/**
* 扫描库存品执行的回调
*/
async function scanStock() {
let data = {
orderPackageCode: details.scancode,
}
const res = warehouseTrayTypeenterStockNoDataMaterialCode(data)
console.log('res :>> ', res)
}
/**
* 修改tabBar选中状态
*/
async function setTabBarState(state : number) {
details.tabBarState = state
// 定制品
if (details.tabBarState === 1)
details.datelist = details.detauser && details.detauser.packageList ? details.detauser.packageList : []
// 零担
else if (details.tabBarState === 2)
details.datelist = details.detauser && details.detauser.zeroList ? details.detauser.zeroList : []
// 库存品
else if (details.tabBarState === 3) {
details.datelist = details.detauser && details.detauser.stockList ? details.detauser.stockList : []
if (!details.stock.marketId) chooseMarket()
}
}
/**
* 库存品 -- 选择商场
*/
async function chooseMarket() {
console.log('111 :>> ', 111)
// 如果没有商场ID, 弹出弹窗选择商场
console.log('details.datelist :>> ', details.datelist.length)
// 没有打托库存品时, 可以选择商场
if (details.datelist.length === 0) {
const res = await warehouseTrayTypefindAllMarket({})
console.log('res :>> ', res)
if (res.code !== 200) return
const _marketArr = res.data
const list = _marketArr.map(val => val.marketName)
tiplists.value.setdetails({
isshow: true,
tipstate: 2,
title: '请选择商场',
list,
isonecheck: true,
success: detail => {
if (detail.checklist.length === 0) {
return uni.showToast({
title: '请选择商场',
icon: 'none',
})
}
console.log('detail :>> ', detail)
details.stock.marketId = _marketArr[detail.checklist[0]].marketId
console.log('_marketName :>> ', _marketArr)
details.stock.marketName = _marketArr[detail.checklist[0]].marketName
tiplists.value.setdetails({ isshow: false })
},
cancel: () => {
tiplists.value.setdetails({ isshow: false })
},
close: () => {
tiplists.value.setdetails({ isshow: false })
},
})
}
}
/**
* 托盘 -- 修改备注
*/
async function checkremaker() {
let data = {
trayCode: details.trayCode,
remark: details.Remarktext,
}
let response = await warehouseTrayTypezeroOrderUpdateRemark(data)
if (response.code == 200) {
initlist()
setshowstate(0)
}
}
/**
* 零担弹框开启状态
*/
function setshowstate(state : number) {
details.showstate = state
}
// 输入防抖并限制输入数字的最大和最小值
let isClick = null
function inputNum(item) {
if (isClick) clearTimeout(isClick)
isClick = setTimeout(() => {
item.number = parseInt(item.number)
// 当值不是数字为NaN时, item.number为0
if (item.number !== item.number) item.number = 0
// 最大限制
if (item.number >= item.residueNum) item.number = item.residueNum
// 最小限制
if (item.number <= 0) item.number = 0
clearTimeout(isClick)
}, 500)
}
// 输入防抖并限制输入数字的最大和最小值
let isClickS = null
function stockInput(item) {
if (isClick) clearTimeout(isClick)
isClickS = setTimeout(() => {
item.maknumber = parseInt(item.maknumber)
// 当值不是数字为NaN时, item.maknumber为0
if (item.maknumber !== item.maknumber) item.maknumber = 0
// 最大限制
if (item.maknumber >= item.quantityStock) item.maknumber = item.quantityStock
// 最小限制
if (item.maknumber <= 0) item.maknumber = 0
clearTimeout(isClickS)
}, 500)
}
async function scanlist() {
let data = {
waybillCode: details.waybillCode,
}
let response = await warehouseTrayTypegetZeroOrderByWaybillCode(data)
if (response.code !== 200) return
console.log(response)
details.codelist = response.data
details.codelist.map(item => {
item['number'] = 0
return item
})
}
/**
* 零担 -- 提交
*/
async function confirmlist() {
let zeroList = []
// 是否退出提交
let isfl = false
console.log('details.codelist :>> ', details.codelist)
// return
isfl = !details.codelist.some(item => {
if (item.number === 0) {
return false
}
if (item.number > item.orderTotalNum) {
isfl = true
uni.showToast({
title: '不能大于订单总数',
icon: 'none',
})
} else {
let obj = {
orderId: item.dataId,
orderCode: item.dataCode,
num: item.number,
}
zeroList.push(obj)
}
return true
})
// 当数据为空或物料数据未修改时, 不进行提交
if (isfl || details.codelist.length === 0) {
return uni.showToast({
title: '最少修改一项物料',
icon: 'none',
})
}
// 不符合提交要求, 退出函数
if (isfl) {
return
}
let data = {
trayType: details.trayType,
trayCode: details.trayCode,
zeroList,
}
let res = await warehouseTrayenterZeroOrderByTrayCode(data)
if (res.code == 200) {
setshowstate(0)
initlist()
details.codelist = []
details.waybillCode = ''
}
}
/**
* 库存品 -- 搜索
*/
async function stockSearch() {
let res = details.stock.activeStatus === 'materialCode' ? await warehouseTrayTypeselectStockByMaterialCodeAndMarketId({
marketId: details.stock.marketId,
materialCode: details.stock.materialCode,
}) : await warehouseTrayTypeSelectStockByMaterialNameAndMarketId({
marketId: details.stock.marketId,
materialName: details.stock.materialCode
})
if (res.code !== 200) {
if (res.code !== 4000) details.stock.searchStockList = []
return
}
// 筛选剩余数大于0的物料
details.stock.searchStockList = res.data.filter(val => val.quantityStock !== 0)
}
/**
* 库存品 -- 提交
*/
async function confirmlur() {
try {
if (details.stock.searchStockList.length === 0) {
return uni.showToast({
title: '最少修改一项物料',
icon: 'none',
})
}
uni.showLoading({
mask: true,
title: '提交中',
})
const submitData = {
trayType: 100,
trayCode: details.trayCode,
noDataStockListDTOS: []
}
for (let i = 0; i < details.stock.searchStockList.length; i++) {
const item = details.stock.searchStockList[i]
if (item.maknumber > 0) {
submitData.noDataStockListDTOS.push({
num: item.maknumber,
marketId: details.stock.marketId,
materialCode: item.cargoNumber,
incomingBatch: item.incomingBatch,
})
}
}
if (submitData.noDataStockListDTOS.length === 0) {
return uni.showToast({
title: '最少修改一项物料',
icon: 'none',
})
}
const res = await warehouseTrayTypeenterStockNoDataMaterialCode(submitData)
const { code, data } = res
if (code !== 200) return
setshowstate(0)
initlist()
details.stock.searchStockList = []
details.stock.materialCode = ''
// const PromiseArr = details.stock.searchStockList.map(async (item, index) => {
// if (item.maknumber > 0) {
// let data = {
// trayType: 100,
// trayCode: details.trayCode,
// num: item.maknumber,
// marketId: details.stock.marketId,
// materialCode: item.cargoNumber,
// incomingBatch: item.incomingBatch,
// }
// return warehouseTrayTypeenterStockNoDataMaterialCode(data)
// }
// })
// // 等待所有请求结束
// Promise.all(PromiseArr).then(res => {
// console.log('res :>> ', res)
// setshowstate(0)
// initlist()
// details.stock.searchStockList = []
// details.stock.materialCode = ''
// })
} catch (err) {
console.log('err :>> ', err)
//TODO handle the exception
} finally {
// 关闭loading动画
uni.hideLoading()
}
}
/**
* 打印
*/
const print = () => {
console.log('bluetoothList :>> ', bluetoothList)
console.log('details.detauser :>> ', details.detauser)
tiplists.value.setdetails({
title: '是否打印',
isshow: true,
tipstate: 2,
list: [],
checklist: [],
inputtext: '',
confirmTxt: '确认打印',
isonecheck: true,
success: () => {
// 没有蓝牙信息时进行蓝牙信息设置
// #ifdef APP
if (!bluetoothInfo.value.name) return bluetoothList.value.setdetails({ isshow: true })
// 打印时间
const time = dayjs().format('YYYY/MM/DD HH:mm:ss')
const data = details.detauser
const _arr = [...data.packageList, ...data.zeroList, ...data.stockList]
let orderListText = ''
// 订单列表初始位置
let _position = 300
// 总件数
let totalOrder = 0
// 总在托数
let totalScanNum = 0
_arr.forEach((value, index) => {
_position += 30
// 订单自编号
if (value.isFleeing)
orderListText += `T 55 0 10 ${_position} ${'(窜)' + value.dataCode}\r\n`
else orderListText += `T 55 0 10 ${_position} ${value.dataCode}\r\n`
// orderListText += `T 55 0 10 ${_position} ${value.dataCode}\r\n`
// 总件数
orderListText += `T 55 0 300 ${_position} ${value.orderTotalNum}\r\n`
// 在托件数
orderListText += `T 55 0 380 ${_position} ${value.scanNum}\r\n`
totalOrder += value.orderTotalNum
totalScanNum += value.scanNum
if (index === _arr.length - 1) {
_position += 30
// 订单自编号
orderListText += `T 55 0 10 ${_position} 总件数\r\n`
// 总件数
orderListText += `T 55 0 300 ${_position} ${totalOrder}\r\n`
// 在托件数
orderListText += `T 55 0 380 ${_position} ${totalScanNum}\r\n`
}
})
// let text = `! 0 400 200 ${_position + 60} 1\r\n`
let text = `! 0 400 200 600 1\r\n`
text += 'SETBOLD 2\r\n'
text += 'T 56 0 10 0 打托清单\r\n'
text += 'B QR 300 0 M 2 U 4\r\n'
text += `MA,${data.trayCode}\r\n`
text += 'ENDQR\r\n'
text += `T 55 0 10 120 打印时间: ${time}\r\n`
text += `T 55 0 300 120 汇通龙泉\r\n`
// 商城
text += `T 55 0 10 150 按${data.trayTypeName}\r\n`
text += `T 55 0 300 150 ${data.name}\r\n`
// 车次号
text += `T 55 0 10 180 车次号\r\n`
text += `T 55 0 300 180 ${''}\r\n`
// 分拣人
text += `T 55 0 10 210 分拣人\r\n`
text += `T 55 0 300 210 ${data.userName || ''}\r\n`
// 备注
text += `T 55 0 10 240 备注:\r\n`
text += `T 55 0 10 270 ${data.reamrk || ''}:\r\n`
// 订单清单
text += `T 55 0 10 300 订单自编号\r\n`
text += `T 55 0 300 300 总件数\r\n`
text += `T 55 0 380 300 在托件数\r\n`
text += orderListText
text += 'FORM\r\n'
text += 'PRINT\r\n'
// 将数据传入打印函数中
utils
.getbl(bluetoothInfo.value, text)
.then(() => {
return tiplists.value.setdetails({ isshow: false })
})
.catch(() => {
return bluetoothList.value.setdetails({ isshow: true })
})
/* const _arr = []
let list = ''
_arr.forEach((value, index) => {
const _position = 280 + (index * 30)
// 是否窜货
if (value.isFleeing) list += `^FO0,${_position}^FD(窜)订单自编号^FS`
else list += `^FO0,${_position}^FD订单自编号^FS`
list += `
^FO300,${_position}^FD总件数^FS
^FO380,${_position}^FD在托件数^FS
`
})
let text = `
^XA
^CF0,20
^FO100,550^BC^FD12345678^FS
^FO0,100^FD打印时间:${time}^FS
^FO350,100^FD汇通龙泉03850^FS
^FO0,130^FD按商场: 江油欧派衣橱^FS
^FO0,160^FD车次号: QYZX231021008^FS
^FO0,190^FD分拣人: 陈勇^FS
^FO0,220^FD分拣完成时间: 2023/10/2318:45:00^FS
^FO0,250^FD备注:^FS
${list}
^XZ
` */
// #endif
},
cancel: details => {
tiplists.value.setdetails({ isshow: false })
},
close: details => {
tiplists.value.setdetails({ isshow: false })
},
})
}
/** 生成新托盘 */
const handleCreateTray = () => {
tip.value.setdetails({
isshow: true,
title: '提示',
content: '是否打印并分拣',
isshowcancel: true,
cancelTxt: '取消',
confirmTxt: '打印',
success: () => {
// #ifdef APP
const handlePrint = () => {
let text = '! 0 200 200 333 1\r\n'
text += 'SETBOLD 1\r\n'
text += `T 56 0 140 0 托盘码\r\n`
text += 'B QR 140 60 M 4 U 4\r\n'
text += `MA,${detauser.value?.trayCode}\r\n`
text += 'ENDQR\r\n'
text += `T 56 0 40 200 托盘码: ${detauser.value?.trayCode}\r\n`
text += `T 56 0 40 240 托盘名称: ${detauser.value?.trayName}\r\n`
text += 'FORM\r\n'
text += 'PRINT\r\n'
const res = utils.getbl(bluetoothInfo.value, text)
res.catch(() => {
bluetoothList.value.setdetails({ isshow: true, success() { handlePrint() } })
})
}
if (!bluetoothInfo.value.name) return bluetoothList.value.setdetails({ isshow: true, success() { handlePrint() } })
handlePrint()
// #endif
tip.value.setdetails({ isshow: false })
},
cancel: () => {
tip.value.setdetails({ isshow: false })
},
close: () => tip.value.setdetails({ isshow: false })
})
}
const { datelist, detauser, showstate, waybillCode, checkinarr, Remarktext, codelist } =
toRefs(details)
</script>
<style lang="scss" scoped>
@import url(@/utils/style/common.scss);
.header_top {
background-color: #f5f5f6;
// width: 100vw;
box-sizing: border-box;
margin: 0 20upx;
}
.header_box {
// margin: 20upx;
background-color: #fff;
border-radius: 20upx;
padding: 20upx;
.header_search {
height: 2rem;
.search_container {
height: inherit;
}
:deep(.input_container) {
background-color: #f5f5f5;
border: none;
}
}
.header_title {
display: flex;
flex-wrap: wrap;
>view {
min-width: 50%;
flex: none;
font-size: 0.8rem;
padding: 10upx;
box-sizing: border-box;
}
}
.header_content {
background-color: #eee;
padding: 20upx;
border-radius: 10upx;
.number {
font-size: 1.2rem;
}
}
.submitBtn {
padding: 0 30upx;
height: 2rem;
background-color: var(--subjectColor);
color: #fff;
box-sizing: border-box;
border-radius: 6upx;
transition: all 0.3s;
}
}
// 背景图
.bgimg {
position: fixed;
left: 0;
top: -100upx;
width: 100%;
}
.scvmabx {
padding: 20upx;
// 商场名称
.marketName {
display: flex;
margin-bottom: 20upx;
align-items: center;
}
}
.maxboxs {
.chuanhuo {
border: #ff0000;
}
.items {
padding: 20upx;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 10upx;
margin-bottom: 20upx;
position: relative;
overflow: hidden;
.tophd {
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 20upx;
box-sizing: border-box;
border-bottom: 4upx solid #eeeeee;
>image {
width: 48upx;
height: 48upx;
margin-right: 10upx;
box-sizing: border-box;
}
>view {
font-size: 0.8rem;
color: #020b18;
word-break: break-all;
}
}
.tophd1 {
width: 100%;
display: flex;
box-sizing: border-box;
padding: 15upx 20upx;
border-bottom: 4upx solid #eeeeee;
&>view {
display: flex;
flex: 1;
align-items: center;
}
image {
width: 64upx;
height: 64upx;
}
}
.numbxvie {
width: 100%;
display: flex;
align-items: center;
justify-content: space-around;
padding: 15upx 25upx;
box-sizing: border-box;
.zhon {
color: var(--subjectColor);
}
.yish {
color: #1197eb;
}
.weish {
color: #020b18;
}
>view {
display: flex;
flex-direction: column;
align-items: center;
>view:nth-of-type(1) {
font-size: 36upx;
margin-bottom: 12upx;
}
>view:nth-of-type(2) {
font-size: 28upx;
}
}
}
}
}
.headtop {
width: 684upx;
padding: 20upx;
display: flex;
align-items: center;
justify-content: space-between;
// margin-top: 20upx;
background-color: #ffffff;
padding: 20upx 30upx;
box-sizing: border-box;
position: relative;
margin: auto;
border-radius: 20upx;
margin-top: 30upx;
>view {
flex: 1;
>input {
flex: 1;
font-size: 28upx;
}
}
}
.hedtopt {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: #ffffff;
padding: 36upx 32upx;
box-sizing: border-box;
.typto {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 28upx;
font-weight: 400;
color: #092c4d;
margin-bottom: 20upx;
&:nth-last-child(1) {
margin-bottom: 0;
}
>view {
flex: 1;
}
}
}
</style>
<style lang="scss" scoped>
// tabBar
.tabBar {
margin-top: 20upx;
display: flex;
&_item {
flex: 1;
flex-basis: 0;
text-align: center;
line-height: 80upx;
background: #fff;
position: relative;
&::after {
content: '';
display: block;
position: absolute;
height: 4upx;
background: var(--subjectColor);
width: 0;
left: 50%;
bottom: 0;
transition: all 0.5s;
}
&.active::after {
left: 0;
width: 100%;
}
}
}
// 录入按钮
.buts {
position: fixed;
bottom: 20upx;
left: 50%;
transform: translateX(-50%);
width: 320upx;
height: 88upx;
border-radius: 8upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 1rem;
font-weight: bold;
color: var(--subjectColor);
border: 4upx solid var(--subjectColor);
}
// 零担弹窗
.tanchuangbg {
width: 100%;
height: 100%;
position: fixed;
z-index: 99;
left: 0;
top: 0;
background-color: #00000050;
display: flex;
align-items: center;
justify-content: center;
transition: all 1s;
.tanbx {
width: 670upx;
// height: 600upx;
background-color: #ffffff;
box-sizing: border-box;
border-radius: 10upx;
display: flex;
flex-direction: column;
align-items: center;
padding: 30upx;
.titlran {
font-size: 32upx;
color: #092c4d;
margin-bottom: 40upx;
}
.textareabx {
width: 560upx;
height: 240upx;
background: #f5f5f6;
border-radius: 8upx;
padding: 20upx 40upx;
box-sizing: border-box;
>textarea {
width: 100%;
height: 100%;
box-sizing: border-box;
font-size: 28upx;
font-weight: 400;
}
}
.btx {
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 50upx;
>view {
display: flex;
align-items: center;
justify-content: center;
width: 260upx;
height: 88upx;
border-radius: 8upx;
font-size: 32upx;
}
>.cancel {
background-color: #f5f5f6;
color: #5a6875;
margin-right: 20upx;
}
>.confirm {
background-color: #d3832a;
color: #ffffff;
}
}
}
.inputbox {
width: 670upx;
// height: 600upx;
background-color: #ffffff;
box-sizing: border-box;
border-radius: 10upx;
display: flex;
flex-direction: column;
align-items: center;
padding: 30upx;
.inputscan {
width: 100%;
display: flex;
align-items: center;
justify-content: space-around;
>input {
width: 440upx;
height: 64upx;
border: 2upx solid #092c4d30;
border-radius: 8upx;
box-sizing: border-box;
font-size: 28upx;
padding: 0upx 20upx;
box-sizing: border-box;
}
.scanbt {
width: 128upx;
height: 64upx;
background: #d3832a;
border-radius: 8upx;
opacity: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 30upx;
font-weight: 400;
color: #ffffff;
}
}
.scvbw {
width: 100%;
height: 450upx;
margin-top: 30upx;
.scboxitem {
display: flex;
flex-direction: column;
align-items: center;
.items {
width: 590upx;
display: flex;
flex-direction: column;
box-shadow: 0upx 2upx 10upx 0upx #e2e2e3;
margin-top: 10upx;
padding: 20upx;
box-sizing: border-box;
position: relative;
>.lisbite {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
// position: absolute;
>.itembox {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
font-size: 28upx;
color: #020b18;
border: 2upx solid #d3832a;
padding: 10upx 20upx;
box-sizing: border-box;
border-radius: 20upx;
color: #d3832a;
>view {
word-wrap: break-word;
word-break: break-all;
}
}
}
>.type1s {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20upx;
>view {
min-width: 50%;
display: flex;
align-items: center;
justify-content: flex-start;
font-size: 28upx;
>view:nth-of-type(1) {
color: #90a0af;
}
>view:nth-of-type(2) {
color: #092c4d;
}
}
}
.rksu {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20upx;
>view {
// width: 50%;
display: flex;
align-items: center;
justify-content: flex-start;
font-size: 28upx;
>view:nth-of-type(1) {
color: #90a0af;
}
>input {
width: 200upx;
padding: 0 15upx;
border: 2upx solid #00000020;
}
}
}
}
}
}
.btx {
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 50upx;
>view {
display: flex;
align-items: center;
justify-content: center;
width: 260upx;
height: 76upx;
border-radius: 7upx;
font-size: 28upx;
}
>.cancel {
background-color: #f5f5f6;
color: #5a6875;
margin-right: 20upx;
}
>.confirm {
background-color: #d3832a;
color: #ffffff;
}
}
}
}
// 选择按钮
.checkbtn {
padding: 10upx 20upx;
background-color: #eee;
transition: all 0.3s;
border-radius: 5upx;
&.active {
background-color: var(--subjectColor);
color: #fff;
}
}
// 标识
.tip {
position: absolute;
padding: 10upx;
border: 4upx solid var(--errColor);
border-radius: 50%;
transform: rotate(-45deg);
&::after {
display: flex;
align-items: center;
justify-content: center;
content: '';
width: 60upx;
height: 60upx;
font-weight: bold;
font-size: 1rem;
border: 2upx solid var(--errColor);
border-radius: 50%;
}
// 窜货
&.fleeingGoods {
bottom: -20upx;
right: -20upx;
&::after {
content: '窜';
color: var(--errColor);
}
}
// 齐套
&.completeSet {
top: -30upx;
right: -30upx;
transform: rotate(315deg);
&::after {
content: '未齐套';
color: var(--errColor);
font-size: 0.7rem;
width: 2.5rem;
height: 2.5rem;
}
&.active {
$color: #62e0ca;
border-color: $color;
&::after {
content: '齐套';
color: $color;
border-color: $color;
}
}
}
}
// 底部
.footer {
$height: 120upx;
height: $height;
.footer_container {
height: inherit;
position: fixed;
width: 100vw;
// background-color: #fff;
bottom: 0;
right: 0;
padding: 10upx 40upx 0;
box-sizing: border-box;
.button {
$buttonHeight: 80upx;
height: $buttonHeight;
line-height: $buttonHeight;
background-color: var(--subjectColor);
color: #fff;
flex: 1;
margin: 0 auto;
text-align: center;
border-radius: calc($buttonHeight / 2);
box-shadow: 0 10upx 5upx 0upx #d3832a60;
margin-left: 20upx;
&:first-child {
margin-left: 0;
background-color: var(--primaryColor);
box-shadow: 0 10upx 5upx 0upx #0086f160;
}
}
}
}
</style>