Browse Source

pages mycomponents 文件迁移Vue2升级Vue3 8/2-10/25

pull/1/head
test 3 months ago
parent
commit
c1e7fcd245
  1. 479
      src/mycomponents/scan/winComScanBalance.vue
  2. 1248
      src/pages/issue/record/directIssue2.vue
  3. 372
      src/pages/point/index.vue
  4. 7
      src/pages/productPutaway/job/semiProductPutawayJob.vue

479
src/mycomponents/scan/winComScanBalance.vue

@ -1,6 +1,6 @@
<template>
<view>
<uni-popup ref="popup" :mask-click="false">
<u-popup v-model="show" mode="bottom">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
@ -19,13 +19,13 @@
</view>
</view>
</view>
</uni-popup>
</u-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
<script setup lang="ts">
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
@ -47,275 +47,260 @@ import {
getListItemTypeDesc,
getItemTypeInfo
} from '@/common/directory.js';
export default {
name: 'winScanPack',
emits: ["getBalance"],
components: {
winComScan,
balanceSelect
import { ref, onMounted, watch } from 'vue'
const props = defineProps({
title: {
type: String,
default: '箱标签'
},
props: {
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: false
},
headerType: {
type: String,
default: "HPQ,HMQ"
},
balanceFromInventoryStatuses: { //fromInventoryStatuses
type: Boolean,
default: true
},
bussinessCode: {
type: String,
default: ''
},
verifyCategory: {
type: Boolean,
default: false
},
isCheckLocationBalance: {
type: Boolean,
default: true
}
isShowHistory: {
type: Boolean,
default: false
},
data() {
return {
scanResult: {},
show: false,
scanList: [],
expand: false,
showScanResult: {},
expendIcon: 'arrow-down',
fromLocationCode: '',
fromLocation: '',
fromLocationList: [],
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
locationOnFocus: false,
businessType: {},
inventoryStatus: [],
managementPrecision: '',
fromInventoryStatuses: [],
itemTypesList: [],
isCheck: false,
resultData: {}
}
headerType: {
type: String,
default: "HPQ,HMQ"
},
created() {
balanceFromInventoryStatuses: { // fromInventoryStatuses
type: Boolean,
default: true
},
methods: {
openScanPopup(businessType) {
this.businessType = businessType
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses)
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes)
this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom')
setTimeout(res=>{
this.getfocus()
},500)
},
getScanResult(result) {
this.resultData = result;
if (!result.package) {
this.showErrorMessage(result.label.code + "包装信息为空")
return;
}
this.getItemCodeType(result.package.itemCode, callBack => {
if(this.isCheckLocationBalance){
this.queryBalance(this.resultData);
}else {
this.queryBalance(this.resultData)
}
//this.queryBalance(this.resultData)
})
},
bussinessCode: {
type: String,
default: ''
},
verifyCategory: {
type: Boolean,
default: false
},
isCheckLocationBalance: {
type: Boolean,
default: true
}
})
//
getToLocationBalance(result) {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
if (result.package.parentNumber) {
var packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
const scanResult = ref({})
const show = ref(false)
const scanList = ref([])
const expand = ref(false)
const expendIcon = ref('arrow-down')
const fromLocationCode = ref('')
const fromLocation = ref('')
const fromLocationList = ref([])
const fromLocationAreaTypeList = ref([])
const toLocationAreaTypeList = ref([])
const businessType = ref({})
const inventoryStatus = ref([])
const fromInventoryStatuses = ref([])
const itemTypesList = ref([])
const resultData = ref({})
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
const popup = ref(null)
const comMessage = ref(null)
const comscan = ref(null)
const balanceSelect = ref(null)
filters.push({
column: "areaType",
action: "in",
value: this.toLocationAreaTypeList.join(',')
})
//
const openScanPopup = (businessTypeValue) => {
businessType.value = businessTypeValue
fromInventoryStatuses.value = getDirectoryItemArray(businessTypeValue.outInventoryStatuses)
fromLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.outAreaTypes)
toLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.inAreaTypes)
itemTypesList.value = getDirectoryItemArray(businessTypeValue.itemTypes)
show.value = true
setTimeout(() => {
getfocus()
}, 500)
}
const getScanResult = (result) => {
resultData.value = result
if (!result.package) {
showErrorMessage(result.label.code + "包装信息为空")
return
}
getItemCodeType(result.package.itemCode, () => {
if (props.isCheckLocationBalance) {
queryBalance(resultData.value)
} else {
queryBalance(resultData.value)
}
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
this.queryBalance(this.resultData);
}
// callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
const getToLocationBalance = (result) => {
uni.showLoading({
title: '查询中',
mask: true
})
const filters = []
if (result.package.parentNumber) {
const packingNumber = result.package.parentNumber + "," + result.package.number
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
queryBalance(result) {
var params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: this.fromInventoryStatuses,
areaType: this.fromLocationAreaTypeList,
bussinessCode: this.bussinessCode
}
uni.showLoading({
title: '查询中',
mask: true
})
getBalanceByParams(params).then(res => {
uni.hideLoading()
if (res.data.length == 0) {
var status = getInventoryStatusDesc(params.inventoryStatus)
var areaType = getListLocationAreaTypeDesc(params.areaType)
var hint =
"按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" +
"未查找到库存余额"
this.showErrorMessage(hint)
} else if (res.data.length == 1) {
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: toLocationAreaTypeList.value.join(',')
})
result.balance = res.data[0]
if (result.label.packingNumber != result.balance.packingNumber) {
result.balance.lableQty = result.label.qty
}
this.$emit("getBalance", result)
// this.closeScanPopup()
} else {
//
this.$refs.balanceSelect.openPopup(res.data);
}
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额")
} else {
queryBalance(resultData.value)
}
}).catch(err => {
showErrorMessage(err.message)
})
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
const queryBalance = (result) => {
const params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: fromInventoryStatuses.value,
areaType: fromLocationAreaTypeList.value,
bussinessCode: props.bussinessCode
}
uni.showLoading({
title: '查询中',
mask: true
})
getBalanceByParams(params).then(res => {
uni.hideLoading()
if (res.data.length === 0) {
const status = getInventoryStatusDesc(params.inventoryStatus)
const areaType = getListLocationAreaTypeDesc(params.areaType)
const hint =
"按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" +
"未查找到库存余额"
showErrorMessage(hint)
} else if (res.data.length === 1) {
result.balance = res.data[0]
if (result.label.packingNumber !== result.balance.packingNumber) {
result.balance.lableQty = result.label.qty
}
emit('getBalance', result)
} else {
balanceSelect.value.openPopup(res.data)
}
}).catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
}
getItemCodeType(itemCode, callBack) {
uni.showLoading({
title: "加载中",
mask: true
})
getBasicItemByCode(itemCode).then(res => {
if (res.data != null && res.data.list.length > 0) {
var result = res.data.list[0];
var status = result.available;
var type = result.type;
if (status == "TRUE") {
if (checkDirectoryItemExist(this.itemTypesList, type)) {
if (this.verifyCategory) {
if (result.category == 'LCJ' || result.category == 'BJ') {
callBack()
} else {
this.showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
}
} else {
callBack()
}
const getItemCodeType = (itemCode, callBack) => {
uni.showLoading({
title: "加载中",
mask: true
})
getBasicItemByCode(itemCode).then(res => {
if (res.data && res.data.list.length > 0) {
const result = res.data.list[0]
const status = result.available
const type = result.type
if (status === "TRUE") {
if (checkDirectoryItemExist(itemTypesList.value, type)) {
if (props.verifyCategory) {
if (result.category === 'LCJ' || result.category === 'BJ') {
callBack()
} else {
var hint = getListItemTypeDesc(this.itemTypesList);
uni.hideLoading()
this.showErrorMessage("扫描物料[" + itemCode + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
}
} else {
uni.hideLoading()
this.showErrorMessage('物料【' + itemCode + '】不可用');
callBack()
}
} else {
const hint = getListItemTypeDesc(itemTypesList.value)
uni.hideLoading()
this.showErrorMessage('未查找到物料【' + itemCode + '】');
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
},
showErrorMessage(message) {
this.losefocus()
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus()
}
showErrorMessage("扫描物料[" + itemCode + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
}
});
},
selectBalanceItem(item) {
this.resultData.balance = item
this.$emit("getBalance", this.resultData)
// this.closeScanPopup()
},
closeScanPopup() {
this.losefocus();
this.$refs.popup.close()
},
getfocus() {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus()
} else {
uni.hideLoading()
showErrorMessage('物料【' + itemCode + '】不可用')
}
},
losefocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus()
} else {
uni.hideLoading()
showErrorMessage('未查找到物料【' + itemCode + '】')
}
}).catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
}
const showErrorMessage = (message) => {
losefocus()
comMessage.value.showErrorMessage(message, res => {
if (res) {
if (comscan.value) {
comscan.value.getfocus()
}
}
})
}
const selectBalanceItem = (item) => {
resultData.value.balance = item
emit('getBalance', resultData.value)
}
const closeScanPopup = () => {
losefocus()
show.value = false
}
const getfocus = () => {
if (comscan.value) {
comscan.value.getfocus()
}
}
const losefocus = () => {
if (comscan.value) {
comscan.value.losefocus()
}
}
const emit = defineEmits(['getBalance'])
</script>
<style lang="scss">

1248
src/pages/issue/record/directIssue2.vue

File diff suppressed because it is too large

372
src/pages/point/index.vue

@ -77,219 +77,195 @@
</view>
</template>
<script>
<script setup>
//
const htmlFileUrl = '/hybrid/html/point.html';
import {
pathToBase64
} from "../../api/img-to-base64.js" //js
// #ifdef APP
var testModule = uni.requireNativePlugin("TestModule")
let testModule = uni.requireNativePlugin("TestModule")
// #endif
import { ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
export default {
name: 'point',
data() {
return {
timer: null,
originData: [],
data: [],
newHtmlContent: '', //html
isLoadFinish: false,
picIndex: 0,
picUrl: []
}
},
methods: {
success(img, item) {
item.barcodeBase641 = img
uni.hideLoading()
this.isLoadFinish = true
// #ifdef APP
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => {
// entrytest.html
entry.file((file) => {
let fileReader = new plus.io.FileReader();
fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result)
item.barcodeBase64 = evt.target.result
}
fileReader.readAsDataURL(file);
});
}, (e) => {
console.log("失败" + e)
});
// #endif
},
setHtmlData() {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="left">
<div class="left-item">
<div class="label bold-label">物品代码</div>
<div class="value bold-font font-30" id="name1">${item.itemCode}</div>
</div>
<div class="left-item">
<div class="label">物品名称</div>
<div class="value font-30" id="name2">${item.itemName}</div>
</div>
<div class="left-item">
<div class="label">包装名称</div>
<div class="value font-20">${item.packName}</div>
</div>
<div class="left-item">
<div class="label">包装号</div>
<div class="value font-20">${item.packageCode}</div>
</div>`
if (item.productionLineCode && item.productionLineCode.length > 0) {
str += `
<div class="left-item">
<div class="label">生产线</div>
<div class="value font-20">${item.productionLineCode}</div>
</div>
`
} else {
str += `
<div class="left-item">
<div class="label bold-label">父包装号</div>
<div class="value bold-font font-20">${item.parentNumber}</div>
</div>
<div class="left-item">
<div class="label">ASN</div>
<div class="value font-20">${item.asnNumber}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">数量</div>
<div class="value bold-font font-30">${item.qty}</div>
</div>`
if (item.fromLocationCode && item.fromLocationCode.length > 0) {
str += `
<div class="left-item">
<div class="label">来源库位</div>
<div class="value font-20">${item.fromLocationCode}</div>
</div>
</div>`
}
str += `
<div class="right">
<div class="image">
<img id='image1' src="${item.barcodeBase64}" alt="" />
</div>
<div class="left-item">
<div class="label">批次</div>
<div class="value font-20">${item.batch}</div>
</div>
<div class="left-item">
<div class="label">物料类型</div>
<div class="value font-20">${item.itemType}</div>
</div>`
if (!(item.productionLineCode && item.productionLineCode.length > 0)) {
str += `
<div class="left-item">
<div class="label">供应商</div>
<div class="value font-20">${item.supplierCode}</div>
</div>
`
}
str += `
const timer = ref(null)
const originData = ref([])
const data = ref([])
const newHtmlContent = ref('')
const isLoadFinish = ref(false)
const picIndex = ref(0)
const picUrl = ref([])
<div class="left-item">
<div class="label">打印时间</div>
<div class="value font-20">${item.printTimes}</div>
</div>
`
if (item.fromLocationCode && item.fromLocationCode.length > 0) {
str += `
<div class="left-item">
<div class="label"></div>
<div class="value"></div>
</div>
</div>
</div>`
}
})
const success = (img, item) => {
item.barcodeBase641 = img
uni.hideLoading()
isLoadFinish.value = true
// #ifdef APP
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => {
entry.file((file) => {
const fileReader = new plus.io.FileReader()
fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result)
item.barcodeBase64 = evt.target.result
}
fileReader.readAsDataURL(file)
}, (e) => {
console.log("失败" + e)
})
})
// #endif
}
console.log('str', str)
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
},
printImage() {
uni.showLoading({
title: "加载中",
mask: true
})
this.setHtmlData()
let clearInt = setInterval(() => {
if (!this.newHtmlContent.mainBody) {
// #ifdef APP
testModule.doHTMLPrint(this.newHtmlContent)
// #endif
clearInterval(clearInt)
uni.hideLoading()
}
}, 1000)
},
const setHtmlData = () => {
let str = ''
readFile(htmlFileUrl, (htmlContent) => {
newHtmlContent.value = htmlContent
data.value.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="left">
<div class="left-item">
<div class="label bold-label">物品代码</div>
<div class="value bold-font font-30" id="name1">${item.itemCode}</div>
</div>
<div class="left-item">
<div class="label">物品名称</div>
<div class="value font-30" id="name2">${item.itemName}</div>
</div>
<div class="left-item">
<div class="label">包装名称</div>
<div class="value font-20">${item.packName}</div>
</div>
<div class="left-item">
<div class="label">包装号</div>
<div class="value font-20">${item.packageCode}</div>
</div>`
if (item.productionLineCode && item.productionLineCode.length > 0) {
str += `
<div class="left-item">
<div class="label">生产线</div>
<div class="value font-20">${item.productionLineCode}</div>
</div>
`
} else {
str += `
<div class="left-item">
<div class="label bold-label">父包装号</div>
<div class="value bold-font font-20">${item.parentNumber}</div>
</div>
<div class="left-item">
<div class="label">ASN</div>
<div class="value font-20">${item.asnNumber}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">数量</div>
<div class="value bold-font font-30">${item.qty}</div>
</div>`
if (item.fromLocationCode && item.fromLocationCode.length > 0) {
str += `
<div class="left-item">
<div class="label">来源库位</div>
<div class="value font-20">${item.fromLocationCode}</div>
</div>
</div>`
}
str += `
<div class="right">
<div class="image">
<img id='image1' src="${item.barcodeBase64}" alt="" />
</div>
<div class="left-item">
<div class="label">批次</div>
<div class="value font-20">${item.batch}</div>
</div>
<div class="left-item">
<div class="label">物料类型</div>
<div class="value font-20">${item.itemType}</div>
</div>`
if (!(item.productionLineCode && item.productionLineCode.length > 0)) {
str += `
<div class="left-item">
<div class="label">供应商</div>
<div class="value font-20">${item.supplierCode}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">打印时间</div>
<div class="value font-20">${item.printTimes}</div>
</div>
`
if (item.fromLocationCode && item.fromLocationCode.length > 0) {
str += `
<div class="left-item">
<div class="label"></div>
<div class="value"></div>
</div>
</div>
</div>`
}
})
// #ifdef APP
// html
readFile(path, callback) {
plus.io.resolveLocalFileSystemURL(path, function (entry) {
entry.file(function (file) {
var reader = new plus.io.FileReader();
reader.onloadend = function (e) {
callback(e.target.result);
};
reader.readAsText(file);
}, function (e) {
console.log("读取文件失败:" + e.message);
});
}, function (e) {
console.log("获取图片资源失败:" + e.message);
});
}
// #endif
},
console.log('str', str)
newHtmlContent.value = newHtmlContent.value.replace("mainBody", str) //
})
}
onLoad(option) {
uni.showLoading({
title: '加载中...',
mask: true
});
if (option.points) {
this.originData = JSON.parse(option.points);
const printImage = () => {
uni.showLoading({
title: "加载中",
mask: true
})
setHtmlData()
let clearInt = setInterval(() => {
if (newHtmlContent.value && newHtmlContent.value.mainBody) {
// #ifdef APP
testModule.doHTMLPrint(newHtmlContent.value)
// #endif
clearInterval(clearInt)
uni.hideLoading()
}
this.data = this.originData
}, 1000)
}
// this.data = [
// {
// "itemCode": "250.832-02",
// "itemName": "线1ZH",
// "packName": "",
// "packageCode": "PN20240906-0000000001",
// "batch": "20240719",
// "parentNumber": null,
// "itemType": "",
// "asnNumber": "ASNS20240731-0002",
// "supplierCode": "49000599",
// "qty": 90,
// "printTimes": "2024-09-06+09:29:37",
// "productionLineCode": null,
// "fromLocationCode": "C01-190-10",
// "barcodeString": "HPQ;V1.0;B20240719;AASNS20240731-0002;Q90.000000;I250.832-02;L;PPN20240906-0000000001;S49000599;O49000599;L12;E;UPC;",
// "barcodeBase64": ""
// }
// ]
},
// #ifdef APP
// html
const readFile = (path, callback) => {
plus.io.resolveLocalFileSystemURL(path, function (entry) {
entry.file(function (file) {
const reader = new plus.io.FileReader()
reader.onloadend = function (e) {
callback(e.target.result)
}
reader.readAsText(file)
}, function (e) {
console.log("读取文件失败:" + e.message)
})
}, function (e) {
console.log("获取图片资源失败:" + e.message)
})
}
// #endif
onLoad((option) => {
uni.showLoading({
title: '加载中...',
mask: true
})
if (option.points) {
originData.value = JSON.parse(option.points)
}
data.value = originData.value
})
watch(isLoadFinish, (newVal, oldVal) => {
if (newVal === true) {
}
}, { immediate: true })
</script>
<style>

7
src/pages/productPutaway/job/semiProductPutawayJob.vue

@ -5,13 +5,11 @@
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue'
import { ref, nextTick } from 'vue'
import {
onLoad,
onShow,
onNavigationBarButtonTap,
onReady,
onBackPress,
onReachBottom,
onPullDownRefresh,
onHide, onUnload
@ -35,9 +33,6 @@ onHide(()=>{
productPutawayJobRef.value.stopRefresh()
}
})
const onReachBottom = ()=> {
productPutawayJobRef.value.onReach();
}
onUnload(()=>{
if (productPutawayJobRef.value) {
productPutawayJobRef.value.stopRefresh()

Loading…
Cancel
Save