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>
<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,14 +47,10 @@ import {
getListItemTypeDesc,
getItemTypeInfo
} from '@/common/directory.js';
export default {
name: 'winScanPack',
emits: ["getBalance"],
components: {
winComScan,
balanceSelect
},
props: {
import { ref, onMounted, watch } from 'vue'
const props = defineProps({
title: {
type: String,
default: '箱标签'
@ -83,71 +79,65 @@ export default {
type: Boolean,
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() {
})
},
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()
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({})
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)
},
}
getScanResult(result) {
this.resultData = result;
const getScanResult = (result) => {
resultData.value = result
if (!result.package) {
this.showErrorMessage(result.label.code + "包装信息为空")
return;
showErrorMessage(result.label.code + "包装信息为空")
return
}
this.getItemCodeType(result.package.itemCode, callBack => {
if(this.isCheckLocationBalance){
this.queryBalance(this.resultData);
getItemCodeType(result.package.itemCode, () => {
if (props.isCheckLocationBalance) {
queryBalance(resultData.value)
} else {
this.queryBalance(this.resultData)
queryBalance(resultData.value)
}
//this.queryBalance(this.resultData)
})
},
}
//
getToLocationBalance(result) {
const getToLocationBalance = (result) => {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
const filters = []
if (result.package.parentNumber) {
var packingNumber = result.package.parentNumber + "," + result.package.number;
const packingNumber = result.package.parentNumber + "," + result.package.number
filters.push({
column: "packingNumber",
action: "in",
@ -171,15 +161,13 @@ export default {
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: this.toLocationAreaTypeList.join(',')
value: toLocationAreaTypeList.value.join(',')
})
var params = {
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
@ -187,25 +175,24 @@ export default {
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额")
} else {
this.queryBalance(this.resultData);
queryBalance(resultData.value)
}
// callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
showErrorMessage(err.message)
})
},
}
queryBalance(result) {
var params = {
const queryBalance = (result) => {
const 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
inventoryStatus: fromInventoryStatuses.value,
areaType: fromLocationAreaTypeList.value,
bussinessCode: props.bussinessCode
}
uni.showLoading({
title: '查询中',
@ -213,109 +200,107 @@ export default {
})
getBalanceByParams(params).then(res => {
uni.hideLoading()
if (res.data.length == 0) {
var status = getInventoryStatusDesc(params.inventoryStatus)
var areaType = getListLocationAreaTypeDesc(params.areaType)
var hint =
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" +
"未查找到库存余额"
this.showErrorMessage(hint)
} else if (res.data.length == 1) {
showErrorMessage(hint)
} else if (res.data.length === 1) {
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
}
this.$emit("getBalance", result)
// this.closeScanPopup()
emit('getBalance', result)
} else {
//
this.$refs.balanceSelect.openPopup(res.data);
balanceSelect.value.openPopup(res.data)
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
showErrorMessage(error)
})
},
}
getItemCodeType(itemCode, callBack) {
const 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') {
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 {
this.showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
}
} else {
callBack()
}
} else {
var hint = getListItemTypeDesc(this.itemTypesList);
const hint = getListItemTypeDesc(itemTypesList.value)
uni.hideLoading()
this.showErrorMessage("扫描物料[" + itemCode + "]是[" +
showErrorMessage("扫描物料[" + itemCode + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
}
} else {
uni.hideLoading()
this.showErrorMessage('物料【' + itemCode + '】不可用');
showErrorMessage('物料【' + itemCode + '】不可用')
}
} else {
uni.hideLoading()
this.showErrorMessage('未查找到物料【' + itemCode + '】');
showErrorMessage('未查找到物料【' + itemCode + '】')
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
uni.hideLoading()
showErrorMessage(error)
})
},
}
showErrorMessage(message) {
this.losefocus()
this.$refs.comMessage.showErrorMessage(message, res => {
const showErrorMessage = (message) => {
losefocus()
comMessage.value.showErrorMessage(message, res => {
if (res) {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus()
if (comscan.value) {
comscan.value.getfocus()
}
}
});
},
})
}
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()
const selectBalanceItem = (item) => {
resultData.value.balance = item
emit('getBalance', resultData.value)
}
},
losefocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus()
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">

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

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

122
src/pages/point/index.vue

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