Browse Source

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

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

247
src/mycomponents/scan/winComScanBalance.vue

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

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

@ -53,7 +53,7 @@
</view> </view>
</template> </template>
<script> <script setup>
import { import {
issueRecordSubmit, issueRecordSubmit,
getWorkShopLineStation, getWorkShopLineStation,
@ -99,514 +99,435 @@
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
export default { import {ref, onMounted} from 'vue';
components: { import {onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh} from '@dcloudio/uni-app';
winScanButton,
winScanPack, const id = ref('');
requiredLocation, const dataContent = ref({});
comBlankView, const detailSource = ref([]);
winScanLocation, const fromLocationInfo = ref({});
winScanPackAndLocation, const fromLocationCode = ref("");
recordComDetailCard, const fromLocationAreaTypeList = ref([]);
recordDetailCard, const toLocationAreaTypeList = ref([]);
balanceSelect const inInventoryStatus = ref(""); //
}, const outInventoryStatus = ref(""); //
data() { const businessType = ref({});
return { const showToLoaction = ref(true);
id: '', const recommendLocationList = ref([]); //
dataContent: {}, // const fromWarehouseCode = ref(''); //
detailSource: [], // const businessTypeCode = ref("Issue");
fromLocationInfo: {}, const positionList = ref([]);
fromLocationCode: "", const show = ref(false);
fromLocationAreaTypeList: [], const positionInfo = ref("请选择生产线");
toLocationAreaTypeList: [], const resultData = ref({});
inInventoryStatus: "", // const workshopCode = ref('');
outInventoryStatus: "", // const productionLineCode = ref('');
businessType: {}, const workStationCode = ref('');
showToLoaction: true, const workShopName = ref('');
recommendLocationList: [], // const productionLineName = ref('');
fromWarehouseCode: '', // const workStationName = ref('');
businessTypeCode: "Issue", const rawLocationCode = ref('');
positionList: [], const fgLocationCode = ref('');
show: false, const managementList = ref([]);
positionInfo: "请选择生产线", const scanPopupRef = ref(null);
resultData: {} const scanLocationCodeRef = ref(null);
}; const comMessageRef = ref(null);
},
onLoad(option) { const getBusinessType = (code, callback) => {
uni.setNavigationBarTitle({ //
title: option.title uni.request({
}) url: `/api/businessType/${code}`,
this.clearData(); method: 'GET',
getBusinessType(this.businessTypeCode, res => { success: (res) => {
if (res.success) { if (res.data.success) {
this.businessType = res.businessType; businessType.value = res.data.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; fromLocationAreaTypeList.value = res.data.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList; toLocationAreaTypeList.value = res.data.toLocationAreaTypeList;
this.showFromLocationPopup(); showFromLocationPopup();
} else { } else {
this.showErrorMessage(res.message) showErrorMessage(res.data.message);
} }
}); },
fail: (err) => {
// if (this.positionList.length == 0) { showErrorMessage(err.message);
getWorkShopLineStation().then(res => {
if (res.data != null && res.data.length > 0) {
this.positionList = res.data
} else {
this.showErrorMessage('未查找到位置信息');
} }
});
};
}).catch(error => { const showFromLocationPopup = () => {
this.showErrorMessage(error); //
}) };
// }
}, const getWorkShopLineStation = () => {
// return uni.request({
onNavigationBarButtonTap(e) { url: '/api/workShopLineStation',
if (e.index === 0) { method: 'GET'
goHome(); }).then((res) => {
if (res.data.data && res.data.data.length > 0) {
positionList.value = res.data.data;
} else {
showErrorMessage('未查找到位置信息');
} }
}, }).catch((error) => {
// showErrorMessage(error);
onBackPress(e) {}, });
};
onPullDownRefresh() {},
mounted() {}, const showErrorMessage = (message) => {
uni.showToast({
title: message,
icon: 'none'
});
};
methods: { const getBalance = (label, packageInfo, callback) => {
getBalance(label, packageInfo, callback) { const filters = [];
var filters = []
if (packageInfo.parentNumber) { if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; const packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({ filters.push({
column: "packingNumber", column: "packingNumber",
action: "in", action: "in",
value: packingNumber value: packingNumber
}) });
} else { } else {
filters.push({ filters.push({
column: "packingNumber", column: "packingNumber",
action: "==", action: "==",
value: label.packingNumber value: label.packingNumber
}) });
} }
filters.push({ filters.push({
column: "itemCode", column: "itemCode",
action: "==", action: "==",
value: label.itemCode value: label.itemCode
}) });
filters.push({ filters.push({
column: "batch", column: "batch",
action: "==", action: "==",
value: label.batch value: label.batch
}) });
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { if (fromInventoryStatus.value) {
filters.push({ filters.push({
column: "inventoryStatus", column: "inventoryStatus",
action: "in", action: "in",
value: this.fromInventoryStatuses value: fromInventoryStatus.value
}) });
} }
var params = { const params = {
filters: filters, filters: filters,
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
} };
getBalanceByFilter(params).then(res => {
callback(res.data) uni.request({
}).catch(err => { url: '/api/getBalanceByFilter',
this.showErrorMessage(err.message); method: 'POST',
}) data: params,
success: (res) => {
callback(res.data);
}, },
getScanResult(result) { fail: (err) => {
this.resultData = result; showErrorMessage(err.message);
let packageInfo = result.package; }
this.getBalance(result.label, packageInfo, balances => { });
// };
let s = '';
if (!result.package.parentNumber) { const getScanResult = (result) => {
if (balances.list.length == 0) { resultData.value = result;
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') const packageInfo = result.package;
getBalance(result.label, packageInfo, (balances) => {
if (!packageInfo.parentNumber) {
if (balances.list.length === 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描');
} else { } else {
let newBalances = balances.list.filter(b => b.locationCode == this const newBalances = balances.list.filter(b => b.locationCode === fromLocationCode.value);
.fromLocationCode); if (newBalances.length === 0) {
if (newBalances.length == 0) { showErrorMessage('未查找到该包装的库存信息,请重新扫描');
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') } else if (newBalances.length === 1) {
} else if (newBalances.length == 1) { const balance = newBalances[0];
let balance = newBalances[0];
result.balance = balance; result.balance = balance;
this.afterGetBalance(result); afterGetBalance(result);
} else { } else {
this.showBalanceSelect(newBalances); showBalanceSelect(newBalances);
} }
} }
} else { } else {
// if (balances.list.length === 0) {
if (balances.list.length == 0) { showErrorMessage('未查找到该包装的库存信息,请重新扫描');
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else { } else {
// const subPackitems = balances.list.filter(r => r.packingNumber === packageInfo.number);
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo const subParentPackitems = balances.list.filter(r => r.packingNumber === packageInfo.parentNumber && r.locationCode === fromLocationCode.value);
.number) if (subPackitems.length === 0) {
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber && r.locationCode == this.fromLocationCode)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) { if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) { if (subParentPackitems.length === 1) {
let balance = subParentPackitems[0]; const balance = subParentPackitems[0];
balance.qty = packageInfo.qty; balance.qty = packageInfo.qty;
result.balance = balance; result.balance = balance;
this.afterGetBalance(result); afterGetBalance(result);
} else { } else {
this.showBalanceSelect(subParentPackitems); showBalanceSelect(subParentPackitems);
} }
} else { } else {
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + showErrorMessage(`按外包装[${packageInfo.parentNumber}]和子包装[${packageInfo.number}]都未查找到库存余额`);
packageInfo.number + '】都未查找到库存余额')
} }
} else { } else {
var locationCode = this.fromLocationCode let locationCode = fromLocationCode.value;
if (balances.list == 1) { if (balances.list.length === 1) {
locationCode = balances.list[0].locationCode locationCode = balances.list[0].locationCode;
} else { } else {
var manyBlances = balances.list.filter(r => r.locationCode != this const manyBlances = balances.list.filter(r => r.locationCode !== fromLocationCode.value);
.fromLocationCode)
if (manyBlances.length > 0) { if (manyBlances.length > 0) {
locationCode = manyBlances[0].locationCode; locationCode = manyBlances[0].locationCode;
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + showErrorMessage(`该包装[${packageInfo.number}]在库位[${locationCode}]已经有库存余额,请重新扫描`);
locationCode +
'】已经有库存余额,请重新扫描')
} else { } else {
this.afterGetBalance(result); afterGetBalance(result);
} }
} }
} }
} }
} }
}) });
}, };
showBalanceSelect(items) { const showBalanceSelect = (items) => {
this.$refs.balanceSelect.openPopup(items); //
}, };
selectBalanceItem(balance) { const selectBalanceItem = (balance) => {
this.resultData.balance = balance; resultData.value.balance = balance;
this.afterGetBalance(this.resultData); afterGetBalance(resultData.value);
}, };
afterGetBalance(result) { const afterGetBalance = (result) => {
let balance = result.balance; const balance = result.balance;
let label = result.label; const label = result.label;
let pack = result.package; const pack = result.package;
let packUnit = pack.packUnit; const packUnit = pack.packUnit;
let packQty = pack.packQty const packQty = pack.packQty;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
var itemp = createItemInfo(balance, pack); let item = detailSource.value.find(res => res.itemCode === balance.itemCode);
let newDetail = createDetailInfo(balance, pack); // if (fromWarehouseCode.value === '') {
fromWarehouseCode.value = balance.warehouseCode;
}
if (!item) {
const itemp = createItemInfo(balance, pack);
const newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber; newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number newDetail.packingNumber = pack.number;
newDetail.packUnit = packUnit; newDetail.packUnit = packUnit;
newDetail.packQty = packQty; newDetail.packQty = packQty;
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
this.detailSource.push(itemp) detailSource.value.push(itemp);
calcHandleQty(this.detailSource); calcHandleQty(detailSource.value);
} else { } else {
var detail = item.subList.find(r => { let detail = item.subList.find(r => r.packingNumber === pack.number && r.batch === balance.batch && r.locationCode === balance.locationCode && r.inventoryStatus === balance.inventoryStatus);
if (r.packingNumber == pack.number && if (!detail) {
r.batch == balance.batch && const newDetail = createDetailInfo(balance, pack);
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber; newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number newDetail.packingNumber = pack.number;
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
}
else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]重复扫描")
}
}
}
},
getScanResult1(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
let packUnit = pack.packUnit;
let packQty = pack.packQty
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQty(this.detailSource);
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.packUnit = packUnit; newDetail.packUnit = packUnit;
newDetail.packQty = packQty; newDetail.packQty = packQty;
item.subList.push(newDetail); item.subList.push(newDetail);
calcHandleQty(this.detailSource); calcHandleQty(detailSource.value);
} else { } else {
if (detail.scaned == true) { if (detail.scaned) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描") showErrorMessage(`箱码[${detail.packingNumber}]批次[${balance.batch}]重复扫描`);
} }
} }
} }
}, };
// const getRecommendLocation = (balance, pack, callback) => {
getRecommendLocation(balance, pack, callback) {
uni.showLoading({ uni.showLoading({
title: '扫描中...', title: '扫描中...',
mask: true mask: true
}) });
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode); const recommend = recommendLocationList.value.find(r => r.itemCode === balance.itemCode);
if (recommend == undefined) { if (!recommend) {
let param = { const param = {
itemCode: balance.itemCode, itemCode: balance.itemCode,
batch: balance.batch, batch: balance.batch,
inventoryStatus: balance.inventoryStatus, inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode, supplierCode: pack.supplierCode,
businessCode: this.businessTypeCode businessCode: businessTypeCode.value
}; };
console.log(JSON.stringify(param)) console.log(JSON.stringify(param));
getPutawayRecommendLocation(param).then(res => { uni.request({
this.recommendLocationList.push({ url: '/api/getPutawayRecommendLocation',
method: 'POST',
data: param,
success: (res) => {
recommendLocationList.value.push({
itemCode: balance.itemCode, itemCode: balance.itemCode,
locationCode: res.data.code locationCode: res.data.code
}) });
callback(res.data); callback(res.data);
uni.hideLoading(); uni.hideLoading();
}).catch(error => { },
uni.hideLoading() fail: (error) => {
this.showErrorMessage(error);
uni.hideLoading(); uni.hideLoading();
}) showErrorMessage(error);
}
});
} else { } else {
callback(recommend); callback(recommend);
} }
}, };
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
calcTreeHandleQty() { const calcHandleQty = (source) => {
for (let item of this.detailSource) { for (let item of source) {
item.qty = 0; item.qty = 0;
for (let detail of item.subList) { for (let detail of item.subList) {
if (detail != undefined) { if (detail) {
item.qty = calc.add(item.qty, detail.qty) item.qty = calc.add(item.qty, detail.qty);
} }
} }
} }
this.$forceUpdate(); };
},
showSelect() { const showSelect = () => {
// if (this.editPosition) { show.value = true;
this.show = true };
// } onLoad((option) => {
}, uni.setNavigationBarTitle({
title: option.title
});
clearData();
getBusinessType(businessTypeCode.value, () => {});
getWorkShopLineStation();
});
confirmSelect(e) { onNavigationBarButtonTap((e) => {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label if (e.index === 0) {
console.log("位置", this.positionInfo) goHome();
this.workshopCode = e[0].value }
this.productionLineCode = e[1].value });
this.workStationCode = e[2].value
this.workShopName = e[0].label const confirmSelect = (e) => {
this.productionLineName = e[1].label positionInfo.value = e[0].label + '-' + e[1].label + '-' + e[2].label;
this.workStationName = e[2].label console.log('位置', positionInfo.value);
workshopCode.value = e[0].value;
let shop = this.positionList.find(shop => shop.value == this.workshopCode); productionLineCode.value = e[1].value;
if (shop != undefined && shop.children != undefined) { workStationCode.value = e[2].value;
let prodLine = shop.children.find(line => line.value == this.productionLineCode); workShopName.value = e[0].label;
if (prodLine != undefined && prodLine.children != undefined) { productionLineName.value = e[1].label;
let station = prodLine.children.find(r => r.value == this.workStationCode); workStationName.value = e[2].label;
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") let shop = positionList.value.find(shop => shop.value === workshopCode.value);
if (shop && shop.children) {
let prodLine = shop.children.find(line => line.value === productionLineCode.value);
if (prodLine && prodLine.children) {
let station = prodLine.children.find(r => r.value === workStationCode.value);
if (station.rawLocationCode === '' || station.rawLocationCode === null) {
showErrorMessage(workStationName.value + '的原材料库位为空,请重新选择');
return; return;
} else { } else {
this.rawLocationCode = station.rawLocationCode; rawLocationCode.value = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode; fgLocationCode.value = station.fgLocationCode;
} }
} else { } else {
this.showErrorMessage("生产线-工位基础信息维护错误") showErrorMessage('生产线-工位基础信息维护错误');
} }
} else { } else {
this.showErrorMessage("车间-生产线基础信息维护错误") showErrorMessage('车间-生产线基础信息维护错误');
} }
// let toLocationCode = '';
let toLocationCode = '' positionList.value.forEach(item => {
this.positionList.forEach(item => { if (workshopCode.value === item.value) { //
if (this.workshopCode == item.value) { //
item.children.find(child => { item.children.find(child => {
if (this.productionLineCode == child.value) { if (productionLineCode.value === child.value) {
toLocationCode = child.children.find(subChild => this.workStationCode == toLocationCode = child.children.find(subChild => workStationCode.value === subChild.value).rawLocationCode;
subChild.value).rawLocationCode;
} }
}) });
} }
}) });
this.detailSource.forEach(item => { detailSource.value.forEach(item => {
item.subList.forEach(detail => { item.subList.forEach(detail => {
detail.toLocationCode = toLocationCode detail.toLocationCode = toLocationCode;
detail.productionLineCode = this.productionLineCode detail.productionLineCode = productionLineCode.value;
detail.workStationCode = this.workStationCode detail.workStationCode = workStationCode.value;
}) });
}) });
};
},
removeItem(index, item) { const removeItem = (index) => {
this.detailSource.splice(index, 1) detailSource.value.splice(index, 1);
}, };
removePack() { const removePack = () => {
for (var i = 0; i < this.detailSource.length; i++) { for (let i = 0; i < detailSource.value.length; i++) {
var item = this.detailSource[i]; let item = detailSource.value[i];
if (item.subList.length == 0) { if (item.subList.length === 0) {
this.detailSource.splice(i, 1) detailSource.value.splice(i, 1);
} }
} }
this.updateData(); updateData();
}, };
openScanPopup() { const openScanPopup = () => {
if (this.fromLocationCode == "") { if (fromLocationCode.value === '') {
this.showFromLocationPopup(); showFromLocationPopup();
return return;
} }
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); scanPopupRef.value.openScanPopupForType(fromLocationCode.value, businessType.value);
}, };
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() { const closeScanPopup = () => {
if (this.$refs.scanPopup != undefined) { if (scanPopupRef.value) {
this.$refs.scanPopup.closeScanPopup(); scanPopupRef.value.closeScanPopup();
} }
}, };
scanPopupGetFocus() { const scanPopupGetFocus = () => {
if (this.$refs.scanPopup != undefined) { if (scanPopupRef.value) {
this.$refs.scanPopup.getfocus(); scanPopupRef.value.getfocus();
} }
}, };
// scanLocationCode(location, code) {
// this.toLocationCode = code
// this.toLocationCode = location;
// },
commit() { const commit = () => {
uni.showLoading({ uni.showLoading({
title: "提交中....", title: '提交中....',
mask: true mask: true
}); });
// let precisionStrategyParams = getPrecisionStrategyParams(detailSource.value);
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
//2:
getPrecisionStrategyList(precisionStrategyParams, res => { getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; managementList.value = res.list;
var params = { let params = setRecordParams();
...this.setRecordParams() console.log('提交参数', JSON.stringify(params));
}
console.log("提交参数", JSON.stringify(params));
issueRecordSubmit(params).then(res => { issueRecordSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading();
if (res.data) { if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成直接发料记录\n" + res.data) showCommitSuccessMessage(`提交成功\n生成直接发料记录\n${res.data}`);
} else { } else {
this.showErrorMessage("提交失败[" + res.msg + "]") showErrorMessage(`提交失败[${res.msg}]`);
} }
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading();
this.showErrorMessage(error) showErrorMessage(error);
}) });
} else { } else {
uni.hideLoading(); uni.hideLoading();
this.showErrorMessage(res.message); showErrorMessage(res.message);
} }
}); });
}, };
setRecordParams() { const setRecordParams = () => {
var subList = [] let subList = [];
var creator = this.$store.state.user.id let creator = store.state.user.id;
this.detailSource.forEach(item => { detailSource.value.forEach(item => {
item.subList.forEach(detail => { item.subList.forEach(detail => {
if (detail.scaned) { if (detail.scaned) {
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, let info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch);
detail.packingNumber, detail.toLocationCode, detail.batch); let submitItem = deepCopyData(detail);
var submitItem = deepCopyData(detail)
submitItem.toPackingNumber = info.packingNumber; submitItem.toPackingNumber = info.packingNumber;
submitItem.toBatch = info.batch; submitItem.toBatch = info.batch;
submitItem.toContainerNumber = detail.containerNumber; submitItem.toContainerNumber = detail.containerNumber;
@ -618,10 +539,8 @@
submitItem.fromLocationCode = detail.locationCode; submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode; submitItem.toLocationCode = detail.toLocationCode;
// detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty; submitItem.qty = detail.handleQty;
submitItem.package = ""; submitItem.package = '';
submitItem.recordList = [{ submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus, toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber, fromParentPackingNumber: detail.parentNumber,
@ -636,84 +555,103 @@
toPackUnit: detail.packUnit, toPackUnit: detail.packUnit,
fromPackQty: detail.packQty, fromPackQty: detail.packQty,
toPackQty: detail.packQty toPackQty: detail.packQty
}] }];
subList.push(submitItem) subList.push(submitItem);
} }
}) });
}) });
if (subList.length > 0) { if (subList.length > 0) {
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode; dataContent.value.toWarehouseCode = subList[0].toWarehouseCode;
} }
this.dataContent.subList = subList dataContent.value.subList = subList;
this.dataContent.creator = creator; dataContent.value.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode; dataContent.value.fromWarehouseCode = fromWarehouseCode.value;
return this.dataContent; return dataContent.value;
}, };
showMessage(message) { const showMessage = (message) => {
this.$refs.comMessage.showMessage(message, res => { comMessageRef.value.showMessage(message, res => {
if (res) {} if (res) {}
}); });
}, };
showScanMessage(message) { const showScanMessage = (message) => {
this.$refs.comMessage.showScanMessage(message); comMessageRef.value.showScanMessage(message);
}, };
afterCloseMessage() { const afterCloseMessage = () => {
this.scanPopupGetFocus(); scanPopupGetFocus();
}, };
closeScanMessage() { const closeScanMessage = () => {
this.scanPopupGetFocus(); scanPopupGetFocus();
}, };
getLocation(location, code) {
this.getFromLocationCode(location, code) const getLocation = (location, code) => {
}, getFromLocationCode(location, code);
getFromLocationCode(location, code) { };
this.fromLocationInfo = location;
this.fromLocationCode = code; const getFromLocationCode = (location, code) => {
this.openScanPopup(); fromLocationInfo.value = location;
}, fromLocationCode.value = code;
getToLocationCode(location, code) { openScanPopup();
if (this.fromLocationCode == code) { };
const getToLocationCode = (location, code) => {
if (fromLocationCode.value === code) {
uni.showToast({ uni.showToast({
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`,
duration: 2000 duration: 2000
}) });
return return;
} }
this.toLocationCode = code; toLocationCode.value = code;
}, };
showCommitSuccessMessage(hint) { const showCommitSuccessMessage = (hint) => {
this.$refs.comMessage.showSuccessMessage(hint, res => { comMessageRef.value.showSuccessMessage(hint, res => {
this.clearData(); clearData();
}) });
}, };
updateData() { const updateData = () => {
calcHandleQty(this.detailSource); calcHandleQty(detailSource.value);
for (var i = 0; i < this.detailSource.length; i++) { for (let i = 0; i < detailSource.value.length; i++) {
let item = this.detailSource[i]; let item = detailSource.value[i];
if (item.qty == 0) { if (item.qty === 0) {
this.detailSource.splice(i, 1) detailSource.value.splice(i, 1);
} }
} }
this.$forceUpdate(); };
}, const clearData = () => {
fromLocationInfo.value = {};
fromLocationCode.value = '';
fromWarehouseCode.value = '';
toWarehouseCode.value = '';
detailSource.value = [];
positionInfo.value = '请选择生产线';
};
clearData() {
this.fromLocationInfo = {};
this.fromLocationCode = '';
this.fromWarehouseCode = ''; //
this.toWarehouseCode = ''; onLoad((option) => {
this.detailSource = []; uni.setNavigationBarTitle({
this.positionInfo = "请选择生产线"; title: option.title
} });
} clearData();
getBusinessType(businessTypeCode.value, () => {});
getWorkShopLineStation();
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
} }
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

122
src/pages/point/index.vue

@ -77,56 +77,51 @@
</view> </view>
</template> </template>
<script> <script setup>
// //
const htmlFileUrl = '/hybrid/html/point.html'; const htmlFileUrl = '/hybrid/html/point.html';
import { import {
pathToBase64 pathToBase64
} from "../../api/img-to-base64.js" //js } from "../../api/img-to-base64.js" //js
// #ifdef APP // #ifdef APP
var testModule = uni.requireNativePlugin("TestModule") let testModule = uni.requireNativePlugin("TestModule")
// #endif // #endif
import { ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
export default { const timer = ref(null)
name: 'point', const originData = ref([])
data() { const data = ref([])
return { const newHtmlContent = ref('')
timer: null, const isLoadFinish = ref(false)
originData: [], const picIndex = ref(0)
data: [], const picUrl = ref([])
newHtmlContent: '', //html
isLoadFinish: false,
picIndex: 0,
picUrl: []
}
},
methods: { const success = (img, item) => {
success(img, item) {
item.barcodeBase641 = img item.barcodeBase641 = img
uni.hideLoading() uni.hideLoading()
this.isLoadFinish = true isLoadFinish.value = true
// #ifdef APP // #ifdef APP
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => { plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => {
// entrytest.html
entry.file((file) => { entry.file((file) => {
let fileReader = new plus.io.FileReader(); const fileReader = new plus.io.FileReader()
fileReader.onloadend = (evt) => { fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result) console.log("文件路径" + evt.target.result)
item.barcodeBase64 = evt.target.result item.barcodeBase64 = evt.target.result
} }
fileReader.readAsDataURL(file); fileReader.readAsDataURL(file)
});
}, (e) => { }, (e) => {
console.log("失败" + e) console.log("失败" + e)
}); })
})
// #endif // #endif
}, }
setHtmlData() {
const setHtmlData = () => {
let str = '' let str = ''
this.readFile(htmlFileUrl, (htmlContent) => { readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent newHtmlContent.value = htmlContent
this.data.forEach(item => { data.value.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br /> str += `<div class="box" style="page-break-before:always;"><br />
<div class="left"> <div class="left">
<div class="left-item"> <div class="left-item">
@ -199,7 +194,6 @@ export default {
` `
} }
str += ` str += `
<div class="left-item"> <div class="left-item">
<div class="label">打印时间</div> <div class="label">打印时间</div>
<div class="value font-20">${item.printTimes}</div> <div class="value font-20">${item.printTimes}</div>
@ -214,82 +208,64 @@ export default {
</div> </div>
</div>` </div>`
} }
}) })
console.log('str', str) console.log('str', str)
this.newHtmlContent = this.newHtmlContent.replace( newHtmlContent.value = newHtmlContent.value.replace("mainBody", str) //
"mainBody", str); // })
}); }
},
printImage() { const printImage = () => {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
mask: true mask: true
}) })
this.setHtmlData() setHtmlData()
let clearInt = setInterval(() => { let clearInt = setInterval(() => {
if (!this.newHtmlContent.mainBody) { if (newHtmlContent.value && newHtmlContent.value.mainBody) {
// #ifdef APP // #ifdef APP
testModule.doHTMLPrint(this.newHtmlContent) testModule.doHTMLPrint(newHtmlContent.value)
// #endif // #endif
clearInterval(clearInt) clearInterval(clearInt)
uni.hideLoading() uni.hideLoading()
} }
}, 1000) }, 1000)
}, }
// #ifdef APP // #ifdef APP
// html // html
readFile(path, callback) { const readFile = (path, callback) => {
plus.io.resolveLocalFileSystemURL(path, function (entry) { plus.io.resolveLocalFileSystemURL(path, function (entry) {
entry.file(function (file) { entry.file(function (file) {
var reader = new plus.io.FileReader(); const reader = new plus.io.FileReader()
reader.onloadend = function (e) { reader.onloadend = function (e) {
callback(e.target.result); callback(e.target.result)
}; }
reader.readAsText(file); reader.readAsText(file)
}, function (e) { }, function (e) {
console.log("读取文件失败:" + e.message); console.log("读取文件失败:" + e.message)
}); })
}, function (e) { }, function (e) {
console.log("获取图片资源失败:" + e.message); console.log("获取图片资源失败:" + e.message)
}); })
} }
// #endif // #endif
},
onLoad(option) { onLoad((option) => {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true mask: true
}); })
if (option.points) { if (option.points) {
this.originData = JSON.parse(option.points); originData.value = JSON.parse(option.points)
} }
this.data = this.originData data.value = originData.value
})
// this.data = [ watch(isLoadFinish, (newVal, oldVal) => {
// { if (newVal === true) {
// "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": ""
// }
// ]
},
} }
}, { immediate: true })
</script> </script>
<style> <style>

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

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

Loading…
Cancel
Save