370 lines
10 KiB
Vue
Raw Normal View History

2025-04-09 18:55:14 +08:00
<template>
<view class="app status-bar-gap">
<view class="page">
2025-04-29 13:26:19 +08:00
<l-header title="生成装箱" sticky #right>
2025-04-09 18:55:14 +08:00
<view style="margin-right: 32rpx;" @click="dataPushNotification">{{ t('receive.tj') }}</view>
</l-header>
<view class="material-listBox">
<scroll-view id="scroll-box" class="scroll-box" scroll-y="true"
:style="{'height':state.scrollHeight+'px'}">
<view class="list-box-list" v-if="state.dataList.length > 0">
<view class="data-item" v-for="(item, index) in state.dataList"
2025-04-29 13:26:19 +08:00
:style="[{'background-color':'#ffffff'},{'margin-bottom':index + 1 === state.dataList.length ? '80px' : '20px'}]"
2025-04-09 18:55:14 +08:00
:key="index">
<view class="text" style="margin-bottom: 20px;display: flex;">
<view>{{ item.MaterialName }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.djbh')}}</view>
<view class="zongjian"></view>
<view>{{ state.FBillNo }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.wlbm')}}</view>
<view class="zongjian"></view>
<view>{{ item.MaterialNo }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.ph')}}</view>
<view class="zongjian"></view>
<view>{{ item.Lot }}</view>
</view>
<view class="itemBox">
<view>仓库</view>
<view class="zongjian"></view>
<view>{{ item.MultiLanguageText }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.ys')}}</view>
<view class="zongjian"></view>
<view>{{ item.CheckJoinQty }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.ws')}}</view>
<view class="zongjian"></view>
<view>{{ item.NoCheckQty }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.yss')}}</view>
<view class="zongjian"></view>
<view>{{ item.CheckQty }}</view>
</view>
</view>
<view style="text-align: center;color: #F5F5F5;height: 20px;"></view>
</view>
2025-04-29 13:26:19 +08:00
<view v-if="state.dataList.length==0">
2025-04-09 18:55:14 +08:00
<up-empty mode="list"></up-empty>
</view>
</scroll-view>
</view>
</view>
2025-04-29 13:26:19 +08:00
<listPopup ref="listPopupRef" @toViewPopupData="toViewPopupDataFun"/>
<viewPopup ref="viewPopupRef" @listPopupData="getReceiveBillScanData"/>
<scanFrame ref="scanFrameRef" @confirmation="scanFrameCnfirmation"
@scanFrameDataFeedback="(res:object)=>{state.scanFrameDataFeedback = res}"
@fast="(row:any)=>{state.scanFrameDataFeedback = row}" @err="scanFrameErrFun" />
<shortcut ref="shortcutRef" @dataToscanFrame="dataToscanFrameFun" />
<tools ref="toolsRef" type="encasement" @defaultPopup="defaultPopupFun" @scanRecord="scanRecordFun" @alternativeDocument="alternativeDocumentFun"/>
2025-04-09 18:55:14 +08:00
</view>
</template>
<script lang="ts" setup>
import { reactive, nextTick, onMounted, ref, computed, watch } from 'vue';
import { onLoad, onShow, onReachBottom, } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
2025-04-29 13:26:19 +08:00
import { SAL_DELIVERYNOTICEPush, temporaryScanList, fStockFlexDetailDelete, PRD_MORPTScanData, temporaryScanDraftSave } from '../../common/request/api/api';
2025-04-09 18:55:14 +08:00
import scanFrame from '../../components/scan-frame/scan-frame.vue'
import tools from '../../components/tools/tools.vue'
import shortcut from '../../components/tools/shortcut.vue'
2025-04-29 13:26:19 +08:00
import listPopup from './listPopup.vue'
import viewPopup from './viewPopup.vue'
import { encasement } from '../../stores/encasement'
const DBEncasement = encasement()
2025-04-09 18:55:14 +08:00
const scanFrameRef = ref()
const shortcutRef = ref()
2025-04-29 13:26:19 +08:00
const listPopupRef = ref()
const viewPopupRef = ref()
2025-04-09 18:55:14 +08:00
const getI18n = useI18n()
const { t, locale } = getI18n
const state = reactive({
dataList: [],
scrollHeight: 0,
FBillNo: '',
materialId: '',
inputFocus: true,
2025-04-29 13:26:19 +08:00
listPopupShow: true,
2025-04-09 18:55:14 +08:00
scanFrameDataFeedback: {},
shortcutDataFeedback: {},
})
2025-04-29 13:26:19 +08:00
onLoad(() => { })
onShow(() => {
// DBEncasement.injectEncasementMaterialList('132132')
2025-04-09 18:55:14 +08:00
})
onMounted(() => {
const query = uni.createSelectorQuery().in(this);
query.select(".material-listBox").boundingClientRect((data) => {
state.scrollHeight = data.height
}).exec();
})
2025-04-29 13:26:19 +08:00
2025-04-09 18:55:14 +08:00
//查询录入
const getReceiveBillScanData = (val : string) => {
2025-04-29 13:26:19 +08:00
PRD_MORPTScanData({
2025-04-09 18:55:14 +08:00
FBarCode: val,
FBillNo: state.FBillNo,
2025-04-29 13:26:19 +08:00
IsPack: 'true'
2025-04-09 18:55:14 +08:00
}).then((res : any) => {
if (res.data !== null) {
2025-04-29 13:26:19 +08:00
console.log(res,val);
debugger
scanFrameRef.value.getreceiveBillScanData({ ...res.data, queryString: val, scanFrameShowSate: state.shortcutDataFeedback.scanFrameShowSate, stashVerify: true })
2025-04-09 18:55:14 +08:00
if (Object.keys(state.shortcutDataFeedback).length) {
if (state.shortcutDataFeedback.scanFrameShowSate) {
scanFrameRef.value.stateShow(true)
} else {
postTemporaryScanDraftSaveFun(state.scanFrameDataFeedback)
}
} else {
scanFrameRef.value.stateShow(true)
}
} else {
uni.$u.toast('并没有该条数据')
state.queryString = ''
}
})
}
//数据记录暂存
const postTemporaryScanDraftSaveFun = (item : any) => {
const obj = {};
if (item.warehouseData.FIsOpenLocation) {
const key = `FVHUBSTOCKFLEX__FF${item.warehouseData.FFlexId}`; //仓位Id
obj[key] = { FNumber: item.locationData.FlexEntryId.Number }; //仓位编码
}
const str = JSON.stringify(obj);
console.log(item);
temporaryScanDraftSave({
FVHUBFormId: "SAL_DELIVERYNOTICE", //数据类型
FVHUBFBillNo: state.FBillNo, //单据编号
FVHUBScanNumber: state.queryString, //条码
FVHUBMaterialNumber: item.articlesStr, //物料编码
FVHUBScanQty: item.quantityStr + '', //扫描数量
FVHUBEntryId: scanFrameRef.value.state.receiveBillScanData.Id, //物料ID
FVHUBFlot: item.batchNumberStr, //批号
2025-04-29 13:26:19 +08:00
FType: "pack",
2025-04-09 18:55:14 +08:00
FVHUBStock: {
FNUMBER: item.warehouseData.FNUMBER //仓库编号
},
FVHUBMaterial: {
FNUMBER: item.articlesStr
},
...JSON.parse(str),
}).then((res : any) => {
console.log(res);
state.queryString = ''
if (res.data.IsSuccess) {
uni.$u.toast('成功')
scanFrameRef.value.stateShow(false)
}
})
}
2025-04-29 13:26:19 +08:00
/**
* 弹窗逻辑
*/
const scanFrameCnfirmation = (row : any) => {
//固定弹窗数据传输
state.scanFrameDataFeedback = row
}
2025-04-09 18:55:14 +08:00
const dataToscanFrameFun = (res : object) => {
2025-04-29 13:26:19 +08:00
//默认值传递
2025-04-09 18:55:14 +08:00
state.shortcutDataFeedback = res
scanFrameRef.value.getComponentsData(res)
2025-04-29 13:26:19 +08:00
shortcutRef.value.stateShow(false,'encasement')
2025-04-09 18:55:14 +08:00
}
const defaultPopupFun = () => {
2025-04-29 13:26:19 +08:00
//唤起默认值弹窗
shortcutRef.value.stateShow(true,'encasement')
}
const scanFrameErrFun = () => {
//异常弹出
scanFrameRef.value.stateShow(true)
2025-04-09 18:55:14 +08:00
}
const scanRecordFun = () => {
toPages('/pages/records/index', {
FormId: 'SAL_DELIVERYNOTICE',
FbillNo: state.FBillNo
})
}
2025-04-29 13:26:19 +08:00
const alternativeDocumentFun = () => {
//唤起选单弹窗
listPopupRef.value.openFun()
}
const toViewPopupDataFun = (row:any) => {
//唤起物料弹窗
state.FBillNo = row.FBillNo
listPopupRef.value.close()
viewPopupRef.value.openFun(row)
}
2025-04-09 18:55:14 +08:00
/**
* 数据推送
*/
const dataPushNotification = () => {
uni.showModal({
title: '提示', content: '确定要推送此次数据吗', cancelText: '取消', confirmText: '确定',
success(res) {
if (res.confirm) {
let EntryIds : any = []
let ids : any = []
let ScanEntry : any = []
let param = {
FormId: 'SAL_DELIVERYNOTICE',
UserId: uni.getStorageSync('userInfo').Context.UserId,
2025-04-29 13:26:19 +08:00
FbillNo: state.FBillNo,
FType: "pack",
2025-04-09 18:55:14 +08:00
};
uni.showLoading({ mask: true });
//获取扫描数据里的所有数据
temporaryScanList(param).then(res => {
if (res.code == 200) {
if (res.data.list.length != 0) {
res.data.list.forEach((item : any) => {
EntryIds.push(item.FVHUBEntryId)
ids.push(item.FID)
ScanEntry.push({
FENTRYID: item.FVHUBEntryId,
Qty: item.FVHUBScanQty,
Flot: item.FVHUBFlot,
StockId: item.FVHUBStock,
StockFlex: item.FVHUBStockFlex
})
})
//推送数据
SAL_DELIVERYNOTICEPush({
EntryIds: EntryIds.toString(),
2025-04-29 13:26:19 +08:00
TargetFormId: 'VHUB_BarcodePackBill',
2025-04-09 18:55:14 +08:00
IsEnableDefaultRule: 'true',
CustomParams: {
AutoAudit: 'true',
ScanEntry: ScanEntry
}
}).then((res : any) => {
2025-04-29 13:26:19 +08:00
if (res.code === 200) {
fStockFlexDetailDelete({ Ids: ids.toString() }).then((res : any) => {
if (res.code === 200) {
2025-04-09 18:55:14 +08:00
uni.$u.toast('操作成功')
}
})
}
2025-04-29 13:26:19 +08:00
2025-04-09 18:55:14 +08:00
})
} else {
uni.$u.toast('暂无扫描数据')
}
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
//中英切换
const formatLangTextValue = (val : any) => {
let lang_Id = uni.getStorageSync('locale')
let item = val.find(p => p.Key == (lang_Id == 'cn' ? 2052 : 1033));
if (item != null) {
return item.Value;
}
return val[0].Value;
}
const toPages = (url : string, data : any = {}) => {
uni.$u.route({
url: url,
params: data
})
}
</script>
<style lang="scss">
.app {
background-color: #F5F5F5;
.page {
padding: 18px 32rpx;
display: flex;
flex-direction: column;
height: 100%;
flex: 1;
.input-box {
background-color: white;
box-sizing: border-box;
padding: 0 16rpx;
border-radius: 24rpx;
margin: 0 0 32rpx 0;
.u-textarea {
padding: 0 !important;
font-size: 24rpx !important;
color: #999999 !important;
}
.input-item {
box-sizing: border-box;
padding: 16rpx 0;
color: #222222;
font-size: 28rpx;
font-weight: 400;
.item-title {
//font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.item-text {
font-weight: 400;
font-size: 27rpx;
color: #999999;
}
}
}
.material-listBox {
flex: 1;
.list-box-list {
width: 100%;
.data-item {
border: 1px solid #efeaea;
border-radius: 20rpx;
box-shadow: 0rpx 15rpx 15rpx #efeaea;
padding: 20rpx 22rpx;
margin-bottom: 16rpx;
background-color: #ffffff;
.itemBox {
line-height: 50rpx;
display: flex;
justify-content: space-between;
align-items: center;
.zongjian {
height: 1px;
flex: 1;
background-color: #f0f0f0;
margin: 0 16rpx;
}
}
}
}
}
}
}
</style>