Browse Source

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

hella_vue3
王志国 3 weeks ago
parent
commit
8f66e72844
  1. 692
      src/pages/fg/coms/comNoReceiptPopup.vue
  2. 757
      src/pages/fg/coms/comReceiptPopup.vue
  3. 601
      src/pages/fg/fgChange.vue
  4. 705
      src/pages/fg/receiptNoPlan.vue

692
src/pages/fg/coms/comNoReceiptPopup.vue

@ -1,6 +1,6 @@
<template>
<view class="">
<uni-popup ref="popup" :maskClick="false">
<u-popup v-model="show" mode="bottom" :maskClick="false">
<view class="uni-flex uni-column pop_customer">
<view class="" style="padding:10rpx">
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx">
@ -64,7 +64,7 @@
<view class='split_line'></view>
<view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">数量</text>
<uni-easyinput v-model="planQty"></uni-easyinput>
<u-input v-model="planQty"></u-input>
<view v-if="uom">({{getUomInfo(uom)}})</view>
<view class="">
<image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;">
@ -91,7 +91,7 @@
<view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">批次</text>
<uni-easyinput v-model="batch"></uni-easyinput>
<u-input v-model="batch"></u-input>
<view class="">
<image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;">
</image>
@ -127,12 +127,12 @@
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button>
</view>
</view>
</uni-popup>
</u-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
<script setup lang="ts">
import {
getIssueJobByProductionline,
getPlaneInfoByproductLine,
@ -161,366 +161,352 @@ import uom from '@/mycomponents/qty/uom.vue'
import packQty from '@/mycomponents/qty/packQty.vue'
import balanceStatus from '@/mycomponents/status/balanceStatus.vue'
import winScanItem from '@/mycomponents/scan/winScanItem.vue'
import { ref, onMounted } from 'vue';
export default {
components: {
uom,
balanceStatus,
winScanItem,
packQty,
const props = defineProps({
title: {
type: String,
default: '开工阶段'
},
data() {
return {
itemCode: '',
itemName: '请选择物料信息',
uom: "",
qty: null,
planQty: 0,
goodQty: 0,
planNumber: "",
productLineCode: "",
showProductLineSelect: false,
productLineList: [],
productionLineName: "请选择生产线",
batch: "",
packUnitName: "请选择包装规格",
packUnit: "",
packUnitList: [],
packQtyHint: "",
packQty: 0,
showPackUnitSelect: false,
itemCodeList: [],
showItemCodeSelect: false,
workStationCode: "",
planDate: '',
showDateSelect: false,
planDateList: [],
fgLocationCode: "",
rawLocationCode: "",
workshop: "",
bomVersion: "",
putAwayRequestSwitch:true,
putAwayInspectSwitch:true,
EnableQms:true
}
},
props: {
title: {
type: String,
default: '开工阶段'
},
itemCodeTypeList: {
type: Array,
default: []
},
},
mounted() {
this.EnableQms = getSwitchInfoByCode('EnableQms')
},
methods: {
openRequestPopup() {
this.initData();
this.planDate = getCurrDate()
this.batch = this.planDate.replace('-', '').replace('-', '')
this.$refs.popup.open('bottom')
},
initData() {
this.itemCode = '请选择物料信息';
this.uom = ""
this.planQty = 0
this.goodQty = 0;
this.packQty = 0;
this.planNumber = ""
this.productLineCode = ""
this.showProductLineSelect = false
this.productLineList = []
this.productionLineName = "请选择生产线"
this.productLineCode = ""
this.batch = ""
this.packUnitName = "请选择包装规格"
this.packUnit = ""
this.packQtyHint = ""
this.showPackUnitSelect = false
// this.packUnitList = []
this.itemCodeList = []
this.showItemCodeSelect = false
this.workStationCode = ""
this.planDate = ""
this.showDateSelect = false
this.planDateList = []
this.fgLocationCode = ""
this.rawLocationCode = ""
this.workshop = ""
this.bomVersion = ""
this.putAwayRequestSwitch = true
this.putAwayInspectSwitch = true
},
closeRequestPopup() {
this.$refs.popup.close()
},
itemCodeLoseFocus() {
this.itemCodeFocus = false;
},
confirm() {
if (!this.planDate) {
this.showErrorMessage('请先选择计划日期');
return;
}
if (this.productionLineName == "请选择生产线") {
this.showErrorMessage("请选择生产线")
return
}
if (!this.batch) {
this.showErrorMessage("请输入批次例如:20200101")
return
}
itemCodeTypeList: {
type: Array,
default: () => []
}
});
const emit = defineEmits(['confirm']);
const itemCode = ref('');
const itemName = ref('请选择物料信息');
const uom = ref('');
const qty = ref(null);
const planQty = ref(0);
const goodQty = ref(0);
const planNumber = ref('');
const productLineCode = ref('');
const showProductLineSelect = ref(false);
const productLineList = ref([]);
const productionLineName = ref('请选择生产线');
const batch = ref('');
const packUnitName = ref('请选择包装规格');
const packUnit = ref('');
const packUnitList = ref([]);
const packQtyHint = ref('');
const packQty = ref(0);
const showPackUnitSelect = ref(false);
const itemCodeList = ref([]);
const showItemCodeSelect = ref(false);
const workStationCode = ref('');
const planDate = ref('');
const showDateSelect = ref(false);
const planDateList = ref([]);
const fgLocationCode = ref('');
const rawLocationCode = ref('');
const workshop = ref('');
const bomVersion = ref('');
const putAwayRequestSwitch = ref(true);
const putAwayInspectSwitch = ref(true);
const EnableQms = ref(true);
const show = ref(false)
const popup = ref(null);
const comMessage = ref(null);
const itemCodeFocus = ref(false);
onMounted(() => {
EnableQms.value = getSwitchInfoByCode('EnableQms');
});
const openRequestPopup = () => {
initData();
planDate.value = getCurrDate();
batch.value = planDate.value.replace('-', '').replace('-', '');
show.value = true
};
const initData = () => {
itemCode.value = '请选择物料信息';
uom.value = '';
planQty.value = 0;
goodQty.value = 0;
packQty.value = 0;
planNumber.value = '';
productLineCode.value = '';
showProductLineSelect.value = false;
productLineList.value = [];
productionLineName.value = '请选择生产线';
productLineCode.value = '';
batch.value = '';
packUnitName.value = '请选择包装规格';
packUnit.value = '';
packQtyHint.value = '';
showPackUnitSelect.value = false;
itemCodeList.value = [];
showItemCodeSelect.value = false;
workStationCode.value = '';
planDate.value = '';
showDateSelect.value = false;
planDateList.value = [];
fgLocationCode.value = '';
rawLocationCode.value = '';
workshop.value = '';
bomVersion.value = '';
putAwayRequestSwitch.value = true;
putAwayInspectSwitch.value = true;
};
const closeRequestPopup = () => {
show.value = false
};
const itemCodeLoseFocus = () => {
itemCodeFocus.value = false;
};
const confirm = () => {
if (!planDate.value) {
showErrorMessage('请先选择计划日期');
return;
}
if (this.itemCode == "请选择物料信息") {
this.showErrorMessage("请选择物料信息")
return
}
if (productionLineName.value === '请选择生产线') {
showErrorMessage('请选择生产线');
return;
}
if (this.planQty <= 0) {
this.showErrorMessage("请输入完工数量")
return
}
if (!batch.value) {
showErrorMessage('请输入批次例如:20200101');
return;
}
if (this.packUnitName == "请选择包装规格") {
this.showErrorMessage("请选择包装规格")
return
}
if (!this.EnableQms) {
this.putAwayInspectSwitch = false
}
this.callback();
},
callback() {
let item = {
productionLineName: "",
productionLine: this.productLineCode, //线
itemCode: this.itemCode,
itemName: this.itemName,
uom: this.getUomInfo(this.uom),
batch: this.batch,
packUnitName: this.packUnitName,
packUnit: this.packUnit,
packQtyHint: this.packQtyHint,
packQty: this.packQty,
planQty: this.planQty,
goodQty: this.goodQty,
planNumber: "",
workStationCode: this.workStationCode,
fgLocationCode: this.fgLocationCode,
rawLocationCode: this.rawLocationCode,
workshop: this.workshop,
bomVersion: this.bomVersion,
putAwayRequestSwitch: this.putAwayRequestSwitch,
putAwayInspectSwitch: this.putAwayInspectSwitch
};
this.closeRequestPopup();
this.$emit("confirm", item);
},
showErrorMessage(message, type) {
setTimeout(r => {
this.$refs.comMessage.showErrorMessage(message, res => {
})
})
},
cancel(e) {
this.closeRequestPopup();
},
confirmSelectLine(data) {
this.productionLineName = data[0].label + "—" + data[1].label
this.productLineCode = data[0].value
this.workStationCode = data[1].value
var parent = this.productLineList.filter(res => res.value == this.productLineCode)
var fgLocation = parent[0].children.filter(children => children.value == this.workStationCode)
this.fgLocationCode = fgLocation[0].fgLocationCode;
this.workshop = parent[0].workshop;
this.clearItemCode()
this.clearPackUnit()
},
clearItemCode() {
this.planDate = getCurrDate()
this.itemCode = "请选择物料信息"
this.uom = ""
this.planQty = 0;
this.goodQty = 0
this.planNumber = ""
this.bomVersion = ""
},
confirmSelectDate(data) {
this.planDate = data[0].label
this.batch = this.planDate.replace('-', '').replace('-', '');
},
showSelectDate() {
this.showDateSelect = true;
var list = lastThreeDays(3);
this.planDateList = []
list.forEach(res => {
this.planDateList.push({
label: res,
value: ""
})
})
},
showSelectLine() {
if (this.productLineList.length == 0) {
uni.showLoading({
title: "加载中",
mask: true
})
getProductionlineAndWorkStation().then(res => {
uni.hideLoading()
if (res.data && res.data.length > 0) {
this.productLineList = res.data
this.showProductLineSelect = true
} else {
this.showErrorMessage('未查找到生产线信息');
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
} else {
this.showProductLineSelect = true
}
if (itemCode.value === '请选择物料信息') {
showErrorMessage('请选择物料信息');
return;
}
if (planQty.value <= 0) {
showErrorMessage('请输入完工数量');
return;
}
},
showSelectItemCode() {
if (!this.productLineCode) {
this.showErrorMessage('请先选择生产线');
return;
}
uni.showLoading({
title: "加载中",
mask: true
})
getBomVersionByProductionline(this.productLineCode).then(res => {
uni.hideLoading()
if (res.data && res.data.length > 0) {
this.itemCodeList = res.data
this.showItemCodeSelect = true
} else {
this.showErrorMessage('未查找到物料信息');
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
},
confirmSelectItem(data) {
this.itemCode = data[0].label;
this.bomVersion = data[1].value;
this.uom = data[0].uom;
// this.uom = itemInfo.uom
//
this.clearPackUnit();
uni.showLoading({
title: "加载中",
mask: true
})
getPackUnitByItemCode(this.itemCode).then(res => {
uni.hideLoading()
if (res.data && res.data.list.length > 0) {
res.data.list.forEach(item => {
item.value = item.packUnit
item.label = getPackUnitName(item.packUnit) + "(" + item.packQty + this
.getUomInfo(item.uom) + ")";
})
this.packUnitList = res.data.list
var defaultData = res.data.list.filter(item => item.defaultPackageunit == "TRUE")
this.confirmSelectPackUnit(defaultData)
}
}).catch(error => {
uni.hideLoading()
})
},
clearPackUnit() {
this.packUnitName = "请选择包装规格"
this.packUnit = ""
let pack = this.packUnitList.filter(r => r.packUnit == this.packUnit);
this.packQtyHint = "";
this.packQty = 0
},
showSelectPackUnit() {
if (this.itemCode == "请选择物料信息") {
this.showErrorMessage('请先选择物料');
return;
}
if (packUnitName.value === '请选择包装规格') {
showErrorMessage('请选择包装规格');
return;
}
uni.showLoading({
title: "加载中",
mask: true
})
getPackUnitByItemCode(this.itemCode).then(res => {
uni.hideLoading()
if (res.data && res.data.list.length > 0) {
res.data.list.forEach(item => {
item.value = item.packUnit
item.label = getPackUnitName(item.packUnit) + "(" + item.packQty + this
.getUomInfo(item.uom) + ")";
})
this.packUnitList = res.data.list
this.showPackUnitSelect = true
} else {
this.showErrorMessage('未查找到包装信息');
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
},
confirmSelectPackUnit(data) {
this.packUnitName = data[0].label
this.packUnit = data[0].value
let pack = this.packUnitList.filter(r => r.packUnit == this.packUnit);
this.packQtyHint = pack[0].packQty + "(" + this
.getUomInfo(pack[0].uom) + ")";
this.uom = this.getUomInfo(pack[0].uom);
this.packQty = pack[0].packQty
},
getUomInfo(uom) {
let item = getUomInfo(uom);
if (item == '') {
return uom;
if (!EnableQms.value) {
putAwayInspectSwitch.value = false;
}
callback();
};
const callback = () => {
const item = {
productionLineName: '',
productionLine: productLineCode.value, // 线
itemCode: itemCode.value,
itemName: itemName.value,
uom: getUomInfo(uom.value),
batch: batch.value,
packUnitName: packUnitName.value,
packUnit: packUnit.value,
packQtyHint: packQtyHint.value,
packQty: packQty.value,
planQty: planQty.value,
goodQty: goodQty.value,
planNumber: '',
workStationCode: workStationCode.value,
fgLocationCode: fgLocationCode.value,
rawLocationCode: rawLocationCode.value,
workshop: workshop.value,
bomVersion: bomVersion.value,
putAwayRequestSwitch: putAwayRequestSwitch.value,
putAwayInspectSwitch: putAwayInspectSwitch.value
};
closeRequestPopup();
emit('confirm', item);
};
const showErrorMessage = (message, type) => {
setTimeout(() => {
comMessage.value.showErrorMessage(message, (res) => {});
});
};
const cancel = (e) => {
closeRequestPopup();
};
const confirmSelectLine = (data) => {
productionLineName.value = data[0].label + '—' + data[1].label;
productLineCode.value = data[0].value;
workStationCode.value = data[1].value;
const parent = productLineList.value.filter((res) => res.value === productLineCode.value);
const fgLocation = parent[0].children.filter((children) => children.value === workStationCode.value);
fgLocationCode.value = fgLocation[0].fgLocationCode;
workshop.value = parent[0].workshop;
clearItemCode();
clearPackUnit();
};
const clearItemCode = () => {
planDate.value = getCurrDate();
itemCode.value = '请选择物料信息';
uom.value = '';
planQty.value = 0;
goodQty.value = 0;
planNumber.value = '';
bomVersion.value = '';
};
const confirmSelectDate = (data) => {
planDate.value = data[0].label;
batch.value = planDate.value.replace('-', '').replace('-', '');
};
const showSelectDate = () => {
showDateSelect.value = true;
const list = lastThreeDays(3);
planDateList.value = [];
list.forEach((res) => {
planDateList.value.push({
label: res,
value: ''
});
});
};
const showSelectLine = () => {
if (productLineList.value.length === 0) {
uni.showLoading({
title: '加载中',
mask: true
});
getProductionlineAndWorkStation().then((res) => {
uni.hideLoading();
if (res.data && res.data.length > 0) {
productLineList.value = res.data;
showProductLineSelect.value = true;
} else {
return item.label
showErrorMessage('未查找到生产线信息');
}
},
switchPutAwayRequest(value){
console.log(value)
console.log("打印"+this.putAwayRequestSwitch)
this.putAwayRequestSwitch = value;
},
switchPutAwayInspect(value){
console.log(value)
this.putAwayInspectSwitch = value;
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
showProductLineSelect.value = true;
}
};
const showSelectItemCode = () => {
if (!productLineCode.value) {
showErrorMessage('请先选择生产线');
return;
}
uni.showLoading({
title: '加载中',
mask: true
});
getBomVersionByProductionline(productLineCode.value).then((res) => {
uni.hideLoading();
if (res.data && res.data.length > 0) {
itemCodeList.value = res.data;
showItemCodeSelect.value = true;
} else {
showErrorMessage('未查找到物料信息');
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const confirmSelectItem = (data) => {
itemCode.value = data[0].label;
bomVersion.value = data[1].value;
uom.value = data[0].uom;
clearPackUnit();
uni.showLoading({
title: '加载中',
mask: true
});
getPackUnitByItemCode(itemCode.value).then((res) => {
uni.hideLoading();
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit;
item.label = getPackUnitName(item.packUnit) + '(' + item.packQty + getUomInfo(item.uom) + ')';
});
packUnitList.value = res.data.list;
const defaultData = res.data.list.filter((item) => item.defaultPackageunit === 'TRUE');
confirmSelectPackUnit(defaultData);
}
}).catch((error) => {
uni.hideLoading();
});
};
const clearPackUnit = () => {
packUnitName.value = '请选择包装规格';
packUnit.value = '';
const pack = packUnitList.value.filter((r) => r.packUnit === packUnit.value);
packQtyHint.value = '';
packQty.value = 0;
};
const showSelectPackUnit = () => {
if (itemCode.value === '请选择物料信息') {
showErrorMessage('请先选择物料');
return;
}
}
uni.showLoading({
title: '加载中',
mask: true
});
getPackUnitByItemCode(itemCode.value).then((res) => {
uni.hideLoading();
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit;
item.label = getPackUnitName(item.packUnit) + '(' + item.packQty + getUomInfo(item.uom) + ')';
});
packUnitList.value = res.data.list;
showPackUnitSelect.value = true;
} else {
showErrorMessage('未查找到包装信息');
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const confirmSelectPackUnit = (data) => {
packUnitName.value = data[0].label;
packUnit.value = data[0].value;
const pack = packUnitList.value.filter((r) => r.packUnit === packUnit.value);
packQtyHint.value = pack[0].packQty + '(' + getUomInfo(pack[0].uom) + ')';
uom.value = getUomInfo(pack[0].uom);
packQty.value = pack[0].packQty;
};
const getUomInfo = (uom) => {
const item = getUomInfo(uom);
return item === '' ? uom : item.label;
};
const switchPutAwayRequest = (value) => {
console.log(value);
console.log('打印' + putAwayRequestSwitch.value);
putAwayRequestSwitch.value = value;
};
const switchPutAwayInspect = (value) => {
console.log(value);
putAwayInspectSwitch.value = value;
};
</script>
<style lang="scss">

757
src/pages/fg/coms/comReceiptPopup.vue

@ -1,6 +1,6 @@
<template>
<view class="">
<uni-popup ref="popup" :maskClick="false">
<u-popup v-model="show" mode="bottom" :maskClick="false">
<view class="uni-flex uni-column pop_customer">
<view class="" style="padding: 10rpx">
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx">
@ -73,7 +73,7 @@
<view class="title" style="display: flex; align-items: center; padding: 10rpx">
<text style="flex-shrink: 0; width: 25%">批次</text>
<uni-easyinput v-model="batch"></uni-easyinput>
<u-input v-model="batch"></u-input>
<view class="">
<image src="" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectLine"> </image>
</view>
@ -107,12 +107,12 @@
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button>
</view>
</view>
</uni-popup>
</u-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
<script setup lang="ts">
import { getIssueJobByProductionline, getPlaneInfoByproductLine, getPackUnitByItemCode, getProductionlineAndWorkStation } from '@/api/request2.js'
import { getPackUnitName, getUomInfo } from '@/common/directory.js'
@ -125,397 +125,390 @@ import packQty from '@/mycomponents/qty/packQty.vue'
import balanceStatus from '@/mycomponents/status/balanceStatus.vue'
import winScanItem from '@/mycomponents/scan/winScanItem.vue'
export default {
components: {
uom,
balanceStatus,
winScanItem,
packQty
},
data() {
return {
itemCode: '请选择物料信息',
uom: '',
qty: null,
planQty: 0,
goodQty: 0,
planNumber: '',
productLineCode: '',
showProductLineSelect: false,
productLineList: [],
productionLineName: '请选择生产线',
productionLineCode: '',
batch: '',
packUnitName: '请选择包装规格',
packUnit: '',
packUnitList: [],
packQtyHint: '',
packQty: 0,
showPackUnitSelect: false,
itemCodeList: [],
showItemCodeSelect: false,
workStationCode: '',
planDate: '',
showDateSelect: false,
planDateList: [],
fgLocationCode: '',
rawLocationCode: '',
putAwayRequestSwitch:true,
putAwayInspectSwitch:true,
EnableQms:true
}
},
props: {
title: {
type: String,
default: '开工阶段'
},
itemCodeTypeList: {
type: Array,
default: []
}
},
mounted() {
this.EnableQms = getSwitchInfoByCode('EnableQms')
console.log(777,this.EnableQms)
import { ref, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const props = defineProps({
title: {
type: String,
default: '开工阶段'
},
methods: {
openRequestPopup() {
this.initData()
this.planDate = getCurrDate()
// this.batch = getBatch8()
this.batch = this.planDate.replace('-', '').replace('-', '');
this.$refs.popup.open('bottom')
},
initData() {
this.itemCode = '请选择物料信息'
this.uom = ''
this.planQty = 0
this.goodQty = 0
this.packQty = 0
this.planNumber = ''
this.productLineCode = ''
this.showProductLineSelect = false
this.productLineList = []
this.productionLineName = '请选择生产线'
this.productionLineCode = ''
this.batch = ''
this.packUnitName = '请选择包装规格'
;(this.packUnit = ''), (this.packQtyHint = '')
this.showPackUnitSelect = false
// this.packUnitList = []
this.itemCodeList = []
this.showItemCodeSelect = false
this.workStationCode = ''
this.planDate = ''
this.showDateSelect = false
this.planDateList = []
this.fgLocationCode = ''
this.rawLocationCode = ''
this.putAwayRequestSwitch=true
this.putAwayInspectSwitch=true
},
closeRequestPopup() {
this.$refs.popup.close()
},
itemCodeLoseFocus() {
this.itemCodeFocus = false
},
confirm() {
if (!this.planDate) {
this.showErrorMessage('请先选择计划日期')
return
}
itemCodeTypeList: {
type: Array,
default: () => []
}
});
const emit = defineEmits(['confirm'])
const itemCode = ref('请选择物料信息');
const uom = ref('');
const qty = ref(null);
const planQty = ref(0);
const goodQty = ref(0);
const planNumber = ref('');
const productLineCode = ref('');
const showProductLineSelect = ref(false);
const productLineList = ref([]);
const productionLineName = ref('请选择生产线');
const productionLineCode = ref('');
const batch = ref('');
const packUnitName = ref('请选择包装规格');
const packUnit = ref('');
const packUnitList = ref([]);
const packQtyHint = ref('');
const packQty = ref(0);
const showPackUnitSelect = ref(false);
const itemCodeList = ref([]);
const showItemCodeSelect = ref(false);
const workStationCode = ref('');
const planDate = ref('');
const showDateSelect = ref(false);
const planDateList = ref([]);
const fgLocationCode = ref('');
const rawLocationCode = ref('');
const putAwayRequestSwitch = ref(true);
const putAwayInspectSwitch = ref(true);
const EnableQms = ref(true);
const show = ref(false)
const itemCodeFocus = ref(false)
const popup = ref(null);
const comMessage = ref(null);
onMounted(() => {
EnableQms.value = getSwitchInfoByCode('EnableQms');
console.log(777, EnableQms.value);
});
const openRequestPopup = () => {
initData();
planDate.value = getCurrDate();
batch.value = planDate.value.replace('-', '').replace('-', '');
show.value = true
};
const initData = () => {
itemCode.value = '请选择物料信息';
uom.value = '';
planQty.value = 0;
goodQty.value = 0;
packQty.value = 0;
planNumber.value = '';
productLineCode.value = '';
showProductLineSelect.value = false;
productLineList.value = [];
productionLineName.value = '请选择生产线';
productionLineCode.value = '';
batch.value = '';
packUnitName.value = '请选择包装规格';
packUnit.value = '';
packQtyHint.value = '';
showPackUnitSelect.value = false;
itemCodeList.value = [];
showItemCodeSelect.value = false;
workStationCode.value = '';
planDate.value = '';
showDateSelect.value = false;
planDateList.value = [];
fgLocationCode.value = '';
rawLocationCode.value = '';
putAwayRequestSwitch.value = true;
putAwayInspectSwitch.value = true;
};
const closeRequestPopup = () => {
show.value = false
};
const itemCodeLoseFocus = () => {
itemCodeFocus.value = false;
};
const confirm = () => {
if (!planDate.value) {
showErrorMessage('请先选择计划日期');
return;
}
if (this.productionLineName == '请选择生产线') {
this.showErrorMessage('请选择生产线')
return
}
if (productionLineName.value == '请选择生产线') {
showErrorMessage('请选择生产线');
return;
}
if (!this.batch) {
this.showErrorMessage('请输入批次例如:20200101')
return
}
if (!batch.value) {
showErrorMessage('请输入批次例如:20200101');
return;
}
if (this.itemCode == '请选择物料信息') {
this.showErrorMessage('请选择物料信息')
return
}
if (itemCode.value == '请选择物料信息') {
showErrorMessage('请选择物料信息');
return;
}
if (this.packUnitName == '请选择包装规格') {
this.showErrorMessage('请选择包装规格')
return
}
if (!this.EnableQms) {
this.putAwayInspectSwitch = false
}
this.callback()
},
callback() {
const item = {
productionLineName: this.productionLineName,
productionLineCode: this.productionLineCode, // 线
itemCode: this.itemCode,
uom: this.getUomInfo(this.uom),
batch: this.batch,
packUnitName: this.packUnitName,
packUnit: this.packUnit,
packQtyHint: this.packQtyHint,
packQty: this.packQty,
planQty: this.planQty,
goodQty: this.goodQty,
planNumber: this.planNumber,
workStationCode: this.workStationCode,
fgLocationCode: this.fgLocationCode,
rawLocationCode: this.rawLocationCode,
putAwayRequestSwitch:this.putAwayRequestSwitch,
putAwayInspectSwitch:this.putAwayInspectSwitch
}
this.closeRequestPopup()
this.$emit('confirm', item)
},
if (packUnitName.value == '请选择包装规格') {
showErrorMessage('请选择包装规格');
return;
}
showErrorMessage(message, type) {
setTimeout((r) => {
this.$refs.comMessage.showErrorMessage(message, (res) => {})
})
},
cancel(e) {
this.closeRequestPopup()
},
confirmSelectLine(data) {
this.productionLineName = `${data[0].label}${data[1].label}`
this.productionLineCode = data[0].value
this.workStationCode = data[1].value
const parent = this.productLineList.filter((res) => res.value == this.productionLineCode)
const fgLocation = parent[0].children.filter((children) => children.value == this.workStationCode)
this.fgLocationCode = fgLocation[0].fgLocationCode
// this.clearItemCode()
// this.clearPackUnit()
this.showProductLineSelect = false
this.showSelectItemCode()
},
clearItemCode() {
this.planDate = getCurrDate()
this.itemCode = '请选择物料信息'
this.uom = ''
this.planQty = 0
this.goodQty = 0
this.planNumber = ''
this.packUnit = ''
this.packQty = 0
},
confirmSelectDate(data) {
this.planDate = data[0].label
this.batch = this.planDate.replace('-', '').replace('-', '')
this.afterSelectPlanData()
},
showSelectDate() {
this.showDateSelect = true
const list = lastThreeDays(3)
this.planDateList = []
list.forEach((res) => {
this.planDateList.push({
label: res,
value: ''
})
if (!EnableQms.value) {
putAwayInspectSwitch.value = false;
}
callback();
};
const callback = () => {
const item = {
productionLineName: productionLineName.value,
productionLineCode: productionLineCode.value, // 线
itemCode: itemCode.value,
uom: getUomInfo(uom.value),
batch: batch.value,
packUnitName: packUnitName.value,
packUnit: packUnit.value,
packQtyHint: packQtyHint.value,
packQty: packQty.value,
planQty: planQty.value,
goodQty: goodQty.value,
planNumber: planNumber.value,
workStationCode: workStationCode.value,
fgLocationCode: fgLocationCode.value,
rawLocationCode: rawLocationCode.value,
putAwayRequestSwitch: putAwayRequestSwitch.value,
putAwayInspectSwitch: putAwayInspectSwitch.value
};
closeRequestPopup();
emit('confirm', item);
};
const showErrorMessage = (message) => {
setTimeout(() => {
comMessage.value.showErrorMessage(message, () => {});
});
};
const cancel = (e) => {
closeRequestPopup();
};
const confirmSelectLine = (data) => {
productionLineName.value = `${data[0].label}${data[1].label}`;
productionLineCode.value = data[0].value;
workStationCode.value = data[1].value;
const parent = productLineList.value.filter((res) => res.value == productionLineCode.value);
const fgLocation = parent[0].children.filter((children) => children.value == workStationCode.value);
fgLocationCode.value = fgLocation[0].fgLocationCode;
showProductLineSelect.value = false;
showSelectItemCode();
};
const clearItemCode = () => {
planDate.value = getCurrDate();
itemCode.value = '请选择物料信息';
uom.value = '';
planQty.value = 0;
goodQty.value = 0;
planNumber.value = '';
packUnit.value = '';
packQty.value = 0;
};
const confirmSelectDate = (data) => {
planDate.value = data[0].label;
batch.value = planDate.value.replace('-', '').replace('-', '');
afterSelectPlanData();
};
const showSelectDate = () => {
showDateSelect.value = true;
const list = lastThreeDays(3);
planDateList.value = [];
list.forEach((res) => {
planDateList.value.push({
label: res,
value: ''
});
});
};
const showSelectLine = () => {
if (productLineList.value.length == 0) {
uni.showLoading({
title: '加载中',
mask: true
});
getProductionlineAndWorkStation()
.then((res) => {
uni.hideLoading();
if (res.data && res.data.length > 0) {
productLineList.value = res.data;
showProductLineSelect.value = true;
} else {
showErrorMessage('未查找到生产线信息');
}
})
},
showSelectLine() {
if (this.productLineList.length == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
getProductionlineAndWorkStation()
.then((res) => {
uni.hideLoading()
if (res.data && res.data.length > 0) {
this.productLineList = res.data
this.showProductLineSelect = true
} else {
this.showErrorMessage('未查找到生产线信息')
}
})
.catch((error) => {
uni.hideLoading()
this.showErrorMessage(error)
})
.catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
showProductLineSelect.value = true;
}
};
const afterSelectPlanData = () => {
itemCode.value = '请选择物料信息';
packUnit.value = '';
packQty.value = 0;
planQty.value = 0;
itemCode.value = '请选择物料信息';
uom.value = '';
packUnitName.value = '请选择包装规格';
packUnit.value = '';
packQtyHint.value = '';
itemCodeList.value = [];
showSelectItemCode();
putAwayRequestSwitch.value = true;
putAwayInspectSwitch.value = true;
};
const showItemList = () => {
showItemCodeSelect.value = true;
};
const showSelectItemCode = () => {
if (!planDate.value) {
showErrorMessage('请先选择计划日期');
return;
}
if (!productionLineCode.value) {
showErrorMessage('请先选择生产线');
return;
}
uni.showLoading({
title: '加载中',
mask: true
});
getPlaneInfoByproductLine(productionLineCode.value, planDate.value)
.then((res) => {
uni.hideLoading();
if (res.data && res.data.length > 0) {
res.data.forEach((item) => {
item.label = `${item.itemCode}${item.planQty}${getUomInfo(item.uom)})`;
item.value = item;
});
itemCodeList.value = res.data;
if (itemCodeList.value.length == 1) {
confirmSelectItem([itemCodeList.value[0]]);
} else {
showItemCodeSelect.value = true;
}
} else {
this.showProductLineSelect = true
showErrorMessage(`未查找到该生产线在【${planDate.value}】日期的生产计划`);
}
},
afterSelectPlanData() {
this.itemCode = '请选择物料信息'
this.packUnit = ''
this.packQty = 0
this.planQty = 0
this.itemCode = '请选择物料信息'
this.uom = ''
this.packUnitName = '请选择包装规格'
this.packUnit = ''
this.packQtyHint = ''
// this.packUnitList = []
this.itemCodeList = []
this.showSelectItemCode()
this.putAwayRequestSwitch=true
this.putAwayInspectSwitch=true
},
showItemList() {
this.showItemCodeSelect = true
},
showSelectItemCode() {
if (!this.planDate) {
this.showErrorMessage('请先选择计划日期')
return
}
if (!this.productionLineCode) {
this.showErrorMessage('请先选择生产线')
return
}
uni.showLoading({
title: '加载中',
mask: true
})
getPlaneInfoByproductLine(this.productionLineCode, this.planDate)
.then((res) => {
uni.hideLoading()
if (res.data && res.data.length > 0) {
res.data.forEach((item) => {
item.label = `${item.itemCode}${item.planQty}${this.getUomInfo(item.uom)})`
item.value = item
})
this.itemCodeList = res.data
// this.showItemCodeSelect = true
if (this.itemCodeList.length == 1) {
this.confirmSelectItem([this.itemCodeList[0]])
// this.itemCode = this.itemCodeList[0].itemCode
} else {
this.showItemCodeSelect = true
}
} else {
this.showErrorMessage(`未查找到该生产线在【${this.planDate}】日期的生产计划`)
}
})
.catch((error) => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
confirmSelectItem(data) {
const productionPlan = data[0].value
this.itemCode = productionPlan.itemCode
this.uom = productionPlan.uom
this.planQty = productionPlan.planQty
this.goodQty = productionPlan.goodQty
this.planNumber = productionPlan.number
//
this.clearPackUnit()
uni.showLoading({
title: '加载中',
mask: true
})
getPackUnitByItemCode(this.itemCode)
.then((res) => {
uni.hideLoading()
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit
item.label = `${getPackUnitName(item.packUnit)}(${item.packQty}${this.getUomInfo(item.uom)})`
})
this.packUnitList = res.data.list
const defaultData = res.data.list.filter((item) => item.defaultPackageunit == 'TRUE')
this.confirmSelectPackUnit(defaultData)
}
})
.catch((error) => {
uni.hideLoading()
})
},
clearPackUnit() {
this.packUnitName = '请选择包装规格'
this.packUnit = ''
const pack = this.packUnitList.filter((r) => r.packUnit == this.packUnit)
this.packQtyHint = ''
this.packQty = 0
},
showSelectPackUnit() {
if (this.itemCode == '请选择物料信息') {
this.showErrorMessage('请先选择物料')
return
})
.catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const confirmSelectItem = (data) => {
const productionPlan = data[0].value;
itemCode.value = productionPlan.itemCode;
uom.value = productionPlan.uom;
planQty.value = productionPlan.planQty;
goodQty.value = productionPlan.goodQty;
planNumber.value = productionPlan.number;
clearPackUnit();
uni.showLoading({
title: '加载中',
mask: true
});
getPackUnitByItemCode(itemCode.value)
.then((res) => {
uni.hideLoading();
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit;
item.label = `${getPackUnitName(item.packUnit)}(${item.packQty}${getUomInfo(item.uom)})`;
});
packUnitList.value = res.data.list;
const defaultData = res.data.list.filter((item) => item.defaultPackageunit == 'TRUE');
confirmSelectPackUnit(defaultData);
}
})
.catch((error) => {
uni.hideLoading();
});
};
const clearPackUnit = () => {
packUnitName.value = '请选择包装规格';
packUnit.value = '';
const pack = packUnitList.value.filter((r) => r.packUnit == packUnit.value);
packQtyHint.value = '';
packQty.value = 0;
};
const showSelectPackUnit = () => {
if (itemCode.value == '请选择物料信息') {
showErrorMessage('请先选择物料');
return;
}
uni.showLoading({
title: '加载中',
mask: true
})
getPackUnitByItemCode(this.itemCode)
.then((res) => {
uni.hideLoading()
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit
item.label = `${getPackUnitName(item.packUnit)}(${item.packQty}${this.getUomInfo(item.uom)})`
})
this.packUnitList = res.data.list
this.showPackUnitSelect = true
} else {
this.showErrorMessage('未查找到包装信息')
}
})
.catch((error) => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
confirmSelectPackUnit(data) {
this.packUnitName = data[0].label
this.packUnit = data[0].value
const pack = this.packUnitList.filter((r) => r.packUnit == this.packUnit)
this.packQtyHint = `${pack[0].packQty}(${this.getUomInfo(pack[0].uom)})`
this.packQty = pack[0].packQty
},
getUomInfo(uom) {
const item = getUomInfo(uom)
if (item == '') {
return uom
uni.showLoading({
title: '加载中',
mask: true
});
getPackUnitByItemCode(itemCode.value)
.then((res) => {
uni.hideLoading();
if (res.data && res.data.list.length > 0) {
res.data.list.forEach((item) => {
item.value = item.packUnit;
item.label = `${getPackUnitName(item.packUnit)}(${item.packQty}${getUomInfo(item.uom)})`;
});
packUnitList.value = res.data.list;
showPackUnitSelect.value = true;
} else {
showErrorMessage('未查找到包装信息');
}
return item.label
},
switchPutAwayRequest(value){
console.log(value)
console.log("打印"+this.putAwayRequestSwitch)
this.putAwayRequestSwitch =value;
},
switchPutAwayInspect(value){
console.log(value)
this.putAwayInspectSwitch =value;
}
})
.catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const confirmSelectPackUnit = (data) => {
packUnitName.value = data[0].label;
packUnit.value = data[0].value;
const pack = packUnitList.value.filter((r) => r.packUnit == packUnit.value);
packQtyHint.value = `${pack[0].packQty}(${getUomInfo(pack[0].uom)})`;
packQty.value = pack[0].packQty;
};
const getUomInfo = (uom) => {
const item = getUomInfo(uom);
if (item == '') {
return uom;
}
}
return item.label;
};
const switchPutAwayRequest = (value) => {
console.log(value);
console.log("打印" + putAwayRequestSwitch.value);
putAwayRequestSwitch.value = value;
};
const switchPutAwayInspect = (value) => {
console.log(value);
putAwayInspectSwitch.value = value;
};
</script>
<style lang="scss">

601
src/pages/fg/fgChange.vue

@ -5,8 +5,8 @@
</view>
<view class="page-wraper" v-if="currentPackage != null">
<view class="page-main">
<uni-collapse>
<uni-collapse-item :open="true">
<u-collapse>
<u-collapse-item :open="true">
<template v-slot:title>
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx"> 变更信息 </view>
</template>
@ -32,21 +32,19 @@
<view class="uni-flex uni-row u-col-center padding_10"
><text style="font-size: 28rpx">变更原因</text>
<view class="uni-flex uni-row">
<uni-easyinput style="margin-left: 20px" v-model="reason"></uni-easyinput>
<u-input style="margin-left: 20px" v-model="reason"></u-input>
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</u-collapse-item>
</u-collapse>
<balance style="margin-top: 5px" :dataContent="currentPackage" :isShowFromLocation="false"></balance>
<view style="margin-left: 30rpx; margin-top: 10rpx; margin-bottom: 10rpx" v-for="(item, index) in fgList" :key="index">
<uni-swipe-action>
<uni-swipe-action-item :right-options="options">
<view :class="item.scaned == true ? 'scan_view' : 'auto-wrap'">
<light :lightCode="item.remark"></light>
</view>
</uni-swipe-action-item>
<uni-swipe-action :options="options">
<view :class="item.scaned == true ? 'scan_view' : 'auto-wrap'">
<light :lightCode="item.remark"></light>
</view>
</uni-swipe-action>
</view>
</view>
@ -72,7 +70,7 @@
</view>
</template>
<script>
<script setup lang="ts">
import { Decimal } from 'decimal.js' //
import { getSpareitemcode, getProductreceiptDetailbByPackingNumber, fgChangeCommit } from '@/api/request2.js'
@ -95,320 +93,305 @@ import winScanFgLabel from '@/mycomponents/scan/winScanFgLabel.vue'
import balance from '@/mycomponents/balance/balance.vue'
import light from '@/mycomponents/balance/light.vue'
export default {
components: {
winScanButton,
winScanPack,
comProductRecord,
comBlankView,
PackageAndItemCard,
winComScanBalance,
winScanFgLabel,
balance,
light
},
data() {
return {
bussinessCode: 'Relegate',
businessType: {},
show: false,
toItemCode: '请选择变更后物料',
toItemInfo: {},
toItemList: [],
fgList: [],
currentPackage: null,
reason: '',
options:[]
}
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
this.getBusinessType()
// this.options = getRemoveOption()
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome()
import { ref } from 'vue';
import { onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const bussinessCode = ref('Relegate');
const businessType = ref({});
const show = ref(false);
const toItemCode = ref('请选择变更后物料');
const toItemInfo = ref({});
const toItemList = ref([]);
const fgList = ref([]);
const currentPackage = ref(null);
const reason = ref('');
const options = ref([]);
const comMessage = ref(null);
const scanPopup = ref(null);
const scanFgPopup = ref(null);
const store = useCountStore()
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
});
getBusinessType();
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
});
onBackPress((e) => {});
onPullDownRefresh(() => {});
const getBusinessType = () => {
getBusinessType(bussinessCode.value, (res) => {
if (res.success) {
businessType.value = res.businessType;
const fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
const fromLocationAreaTypeList = res.fromLocationAreaTypeList;
openScanPopup();
} else {
showErrorMessage(res.message);
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getBusinessType() {
getBusinessType(this.bussinessCode, (res) => {
if (res.success) {
this.businessType = res.businessType
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses)
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup()
});
};
const getPackScanResult = (result) => {
const { label } = result;
const pack = result.package;
uni.showLoading({
title: '加载中...',
mask: true
});
const params = {
available: 'TRUE',
changeBeforeCode: pack.itemCode,
pageSize: 20,
pageNo: 1
};
getSpareitemcode(params)
.then((res) => {
uni.hideLoading();
if (res.data.list.length == 0) {
showErrorMessage('未查找到变更后的物料,请在《量产件备件关系中进行配置》');
} else {
closeScanPopup();
res.data.list.forEach((r) => {
r.value = r.code;
r.label = `${r.code}(${r.name})`;
});
toItemList.value = res.data.list;
if (res.data.list.length == 1) {
toItemCode.value = res.data.list[0].code;
} else {
this.showErrorMessage(res.message)
show.value = true;
}
})
},
getPackScanResult(result) {
const { label } = result
const pack = result.package
uni.showLoading({
title: '加载中...',
mask: true
})
const params = {
available: 'TRUE',
changeBeforeCode: pack.itemCode,
pageSize: 20,
pageNo: 1
}
getSpareitemcode(params)
.then((res) => {
uni.hideLoading()
if (res.data.list.length == 0) {
this.showErrorMessage('未查找到变更后的物料,请在《量产件备件关系中进行配置》')
} else {
this.closeScanPopup()
res.data.list.forEach((r) => {
r.value = r.code
r.label = `${r.code}(${r.name})`
})
this.toItemList = res.data.list
if (res.data.list.length == 1) {
this.toItemCode = res.data.list[0].code
//
getProductreceiptDetailbByPackingNumber(pack.number)
.then((res) => {
if (res.data.length > 0) {
fgList.value = res.data;
const pack = result.package;
const { balance } = result;
currentPackage.value = result.package;
currentPackage.value.packingNumber = pack.number;
currentPackage.value.locationCode = balance.locationCode;
currentPackage.value.inventoryStatus = balance.inventoryStatus;
} else {
this.show = true
}
//
getProductreceiptDetailbByPackingNumber(pack.number)
.then((res) => {
if (res.data.length > 0) {
this.fgList = res.data
const pack = result.package
const { balance } = result
this.currentPackage = result.package
this.currentPackage.packingNumber = pack.number
this.currentPackage.locationCode = balance.locationCode
this.currentPackage.inventoryStatus = balance.inventoryStatus
// this.getDataSource(result);
} else {
this.showErrorMessage(`箱码【${pack.number}】未查找到绑定的灯码信息`)
}
})
.catch((res) => {
this.showErrorMessage(res.message)
})
}
})
.catch((res) => {
this.showErrorMessage(res.message)
})
},
getFgScanResult(result) {
const item = this.fgList.find((r) => r.remark == result.content)
//
if (item != undefined) {
const index = this.fgList.findIndex((r) => r.remark == result.content)
if (item.scaned == true) {
this.$refs.comMessage.showQuestionMessage(`灯码【${result.content}】已经扫描,是否移除`, (res) => {
if (res) {
item.scaned = false
this.fgList.splice(index, 1)
this.fgList.push(item) // ();
showErrorMessage(`箱码【${pack.number}】未查找到绑定的灯码信息`);
}
})
} else {
item.scaned = true
this.fgList.unshift(this.fgList.splice(index, 1)[0]) // ();
}
this.calcHandleQty()
} else {
this.showErrorMessage('扫描的灯码不在灯码列表中')
.catch((res) => {
showErrorMessage(res.message);
});
}
},
})
.catch((res) => {
showErrorMessage(res.message);
});
};
const getFgScanResult = (result) => {
const item = fgList.value.find((r) => r.remark == result.content);
if (item != undefined) {
const index = fgList.value.findIndex((r) => r.remark == result.content);
if (item.scaned == true) {
comMessage.value.showQuestionMessage(`灯码【${result.content}】已经扫描,是否移除`, (res) => {
if (res) {
item.scaned = false;
fgList.value.splice(index, 1);
fgList.value.push(item); //
}
});
} else {
item.scaned = true;
fgList.value.unshift(fgList.value.splice(index, 1)[0]); //
}
calcHandleQty();
} else {
showErrorMessage('扫描的灯码不在灯码列表中');
}
};
calcHandleQty() {
if (this.fgList.length > 0) {
this.currentPackage.handleQty = this.fgList.filter((r) => r.scaned == true).length
const calcHandleQty = () => {
if (fgList.value.length > 0) {
currentPackage.value.handleQty = fgList.value.filter((r) => r.scaned == true).length;
}
};
const openScanPopup = () => {
setTimeout(() => {
scanPopup.value.openScanPopup(businessType.value);
scanPopupGetFocus();
});
};
const openScanFgPopup = () => {
setTimeout(() => {
scanFgPopup.value.openScanPopup(currentPackage.value.itemCode);
scanFgPopupGetFocus();
});
};
const commit = () => {
if (toItemCode.value == '请选择变更后物料') {
showMessage('请选择变更后物料');
return;
}
if (currentPackage.value.handleQty == null) {
comMessage.value.showQuestionMessage('是否要将全部灯码进行变更?', (res) => {
if (res) {
commitChange();
}
},
openScanPopup() {
setTimeout((r) => {
this.$refs.scanPopup.openScanPopup(this.businessType)
this.scanPopupGetFocus()
})
},
openScanFgPopup() {
setTimeout((r) => {
this.$refs.scanFgPopup.openScanPopup(this.currentPackage.itemCode)
this.scanFgPopupGetFocus()
})
},
commit() {
if (this.toItemCode == '请选择变更后物料') {
this.showMessage('请选择变更后物料')
return
});
} else {
comMessage.value.showQuestionMessage(`是否要将已扫描的【${currentPackage.value.handleQty}】个灯码进行变更?`, (res) => {
if (res) {
commitChange();
}
if (this.currentPackage.handleQty == null) {
this.$refs.comMessage.showQuestionMessage('是否要将全部灯码进行变更?', (res) => {
if (res) {
this.commitChange()
}
})
} else {
this.$refs.comMessage.showQuestionMessage(`是否要将已扫描的【${this.currentPackage.handleQty}】个灯码进行变更?`, (res) => {
if (res) {
this.commitChange()
}
})
});
}
};
const commitChange = () => {
uni.showLoading({
title: '提交中...',
mask: true
});
const params = setParams();
console.log('params', JSON.stringify(params));
fgChangeCommit(params)
.then((res) => {
uni.hideLoading();
currentPackage.value = null;
})
.catch((err) => {
uni.hideLoading();
showErrorMessage(err.message);
});
};
const setParams = () => {
const creator = store.id;
let subList = fgList.value.filter((r) => r.scaned == true);
if (currentPackage.value.handleQty == undefined) {
subList = fgList.value;
}
const item = {};
item.fromItemCode = currentPackage.value.itemCode;
item.fromItemName = currentPackage.value.itemName;
item.fromItemDesc1 = currentPackage.value.itemDesc1;
item.fromItemDesc2 = currentPackage.value.itemDesc2;
item.toItemCode = toItemCode.value;
item.toItemName = toItemInfo.value.itemName;
item.toItemDesc1 = toItemInfo.value.itemDesc1;
item.toItemDesc2 = toItemInfo.value.itemDesc2;
item.fromInventoryStatus = currentPackage.value.inventoryStatus;
item.fromQty = currentPackage.value.handleQty;
item.fromParentPackingNumber = currentPackage.value.parentNumber;
item.fromPackingNumber = currentPackage.value.packingNumber;
item.fromBatch = currentPackage.value.batch;
item.fromLocationCode = currentPackage.value.locationCode;
item.fromPackUnit = currentPackage.value.packUnit;
item.fromPackQty = currentPackage.value.packQty;
item.toPackQty = currentPackage.value.packUnit;
item.toPackUnit = currentPackage.value.packUnit;
item.subList = subList;
item.creator = creator;
return item;
};
const showMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessage.value.showMessage(message, (res) => {
if (res) {
scanPopupGetFocus();
}
},
commitChange() {
uni.showLoading({
title: '提交中...',
mask: true
})
const params = this.setParams()
console.log('params', JSON.stringify(params))
fgChangeCommit(params)
.then((res) => {
const ss = res
uni.hideLoading()
this.currentPackage = null
})
.catch((err) => {
uni.hideLoading()
this.showErrorMessage(err.message)
})
},
setParams() {
const creator = this.$store.state.user.id
let subList = this.fgList.filter((r) => r.scaned == true)
if (this.currentPackage.handleQty == undefined) {
subList = this.fgList
});
});
};
const showErrorMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessage.value.showErrorMessage(message, (res) => {
if (res) {
scanPopupGetFocus();
}
});
});
};
// var item = deepCopyData(this.currentPackage);
const item = {}
item.fromItemCode = this.currentPackage.itemCode
item.fromItemName = this.currentPackage.itemName
item.fromItemDesc1 = this.currentPackage.itemDesc1
item.fromItemDesc2 = this.currentPackage.itemDesc2
item.toItemCode = this.toItemCode
item.toItemName = this.toItemInfo.itemName
item.toItemDesc1 = this.toItemInfo.itemDesc1
item.toItemDesc2 = this.toItemInfo.itemDesc2
item.fromInventoryStatus = this.currentPackage.inventoryStatus
item.fromQty = this.currentPackage.handleQty
item.fromParentPackingNumber = this.currentPackage.parentNumber
item.fromPackingNumber = this.currentPackage.packingNumber
item.fromBatch = this.currentPackage.batch
item.fromLocationCode = this.currentPackage.locationCode
item.fromPackUnit = this.currentPackage.packUnit
item.fromPackQty = this.currentPackage.packQty
item.toPackQty = this.currentPackage.packUnit
item.toPackUnit = this.currentPackage.packUnit
item.subList = subList
item.creator = creator
return item
},
showMessage(message) {
setTimeout((r) => {
this.scanPopupLoseFocus()
this.$refs.comMessage.showMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus()
}
})
})
},
showErrorMessage(message) {
setTimeout((r) => {
this.scanPopupLoseFocus()
this.$refs.comMessage.showErrorMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus()
}
})
})
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup()
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus()
}
},
const closeScanPopup = () => {
scanPopup.value.closeScanPopup();
};
scanFgPopupGetFocus() {
if (this.$refs.scanFgPopup != undefined) {
this.$refs.scanFgPopup.getfocus()
}
},
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus();
}
};
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus()
}
},
afterCloseMessage() {
this.scanPopupGetFocus()
},
closeScanMessage() {
this.scanPopupGetFocus()
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, (res) => {
this.clearData()
this.openScanPopup()
})
},
clearData() {
this.toItemCode = '请选择变更后物料'
this.toItemList = []
this.fgList = []
this.currentPackage = null
this.reason = ''
},
showSelect() {
this.show = !this.show
},
confirmSelect(e) {
this.toItemCode = e[0].value
this.toItemInfo = e[0]
}
const scanFgPopupGetFocus = () => {
if (scanFgPopup.value != undefined) {
scanFgPopup.value.getfocus();
}
};
const scanPopupLoseFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.losefocus();
}
}
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const closeScanMessage = () => {
scanPopupGetFocus();
};
const showCommitSuccessMessage = (hint) => {
comMessage.value.showSuccessMessage(hint, (res) => {
clearData();
openScanPopup();
});
};
const clearData = () => {
toItemCode.value = '请选择变更后物料';
toItemList.value = [];
fgList.value = [];
currentPackage.value = null;
reason.value = '';
};
const showSelect = () => {
show.value = !show.value;
};
const confirmSelect = (e) => {
toItemCode.value = e[0].value;
toItemInfo.value = e[0];
};
</script>
<style scoped lang="scss"></style>

705
src/pages/fg/receiptNoPlan.vue

@ -1,6 +1,5 @@
<template>
<view class="page-wraper" style="background-color: #fff;">
<view class="header">
<view class="">
<com-blank-view @goScan='openFg' v-if="!dataContent"></com-blank-view>
@ -13,23 +12,19 @@
<view class="text_lightblue">完工库位</view>
<view style="font-size: 30rpx; margin-top: 13rpx;">{{dataContent.fgLocationCode}}
</view>
</view>
<view class="cell_info">
<view class="text_lightblue">报工数量</view>
<view>{{dataContent.planQty}}{{dataContent.uom}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">已报工数量</view>
<view>{{scanedQty}}{{dataContent.uom}}</view>
</view>
</view>
</view>
</view>
<view class='split_line'></view>
<view class="" style="padding: 10rpx;margin-left: 10rpx;">
<item :dataContent="dataContent"></item>
</view>
@ -50,35 +45,30 @@
</view>
</view>
</view>
<view style="margin-top: 350rpx; padding-bottom: 160rpx;" v-if="dataContent">
<scroll-view scroll-y="true" class="">
<view class="scan_view" v-for="(item, index) in showList" :key="index">
<uni-swipe-action>
<uni-swipe-action-item :right-options="options" @click="swipeClick($event,item,index)">
<view class="uni-flex uni-row "
style="margin-left: 30rpx; margin-top: 10rpx; margin-bottom: 10rpx;">
<light :lightCode='item.content'></light>
<!-- <view class="auto-wrap" style="font-size: 35rpx;font-weight: bold; width: 100%;">
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text>
{{item.content}}
</view> -->
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<u-swipe-action :options="options" @click="(...event)=>swipeClick(event,item,index)">
<<view class="uni-flex uni-row "
style="margin-left: 30rpx; margin-top: 10rpx; margin-bottom: 10rpx;">
<light :lightCode='item.content'></light>
<!-- <view class="auto-wrap" style="font-size: 35rpx;font-weight: bold; width: 100%;">
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text>
{{item.content}}
</view> -->
</view>
</u-swipe-action>
<u-line color="#D8D8D8"></u-line>
</view>
</scroll-view>
<uni-load-more :status="loadingType" v-if="showList.length>0" />
</view>
<view class="page-footer" v-if="dataContent">
<view class="uni-flex u-col-center space-between " style="background-color:ghostwhite; width: 100%; ">
<view class="">
<view class="uni-flex uni-row">
</view>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_clear" hover-class="btn_commit_after" style="margin-right: 50rpx;"
@ -94,7 +84,7 @@
</view>
</template>
<script>
<script setup lang="ts">
import {
isCheckMesCode,
planReceiptSubmit,
@ -124,388 +114,335 @@ import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue"
import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue"
import light from '@/mycomponents/balance/light.vue'
export default {
components: {
comBlankView,
comNoReceiptPopup,
item,
batch,
pack,
winScanButton,
winScanFgLabel,
comFgCard,
light
},
data() {
return {
dataContent: null,
options: [],
showList: [],
allList: [],
index: 1,
loadingType: "",
pageSize: 20,
scanedQty: 0,
settingPutAwayRequestSwitch:true,
settingPutAwayInspectSwitch :true
};
},
onShow() {},
onLoad() {
this.options = getRemoveOption()
this.openFg();
},
import { ref } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
const dataContent = ref(null);
const options = ref([]);
const showList = ref([]);
const allList = ref([]);
const index = ref(1);
const loadingType = ref("");
const pageSize = ref(20);
const scanedQty = ref(0);
const settingPutAwayRequestSwitch = ref(true);
const settingPutAwayInspectSwitch = ref(true);
//
const comNoReceiptPopup = ref(null);
const comMessage = ref(null);
const scanPopup = ref(null);
onLoad(() => {
options.value = getRemoveOption();
openFg();
});
onShow(() => {});
onReachBottom(() => {
console.log("onReachBottom");
if (loadingType.value === 'nomore') {
return;
}
index.value++;
const list = getDataPage(index.value, pageSize.value);
if (list.length > 0) {
showList.value = showList.value.concat(list);
} else {
loadingType.value = "nomore";
}
});
onReachBottom() {
console.log("onReachBottom")
//
if (this.loadingType == 'nomore') {
return;
const openFg = () => {
setTimeout(() => {
if (comNoReceiptPopup.value) {
comNoReceiptPopup.value.openRequestPopup();
}
this.index++;
var list = this.getDataPage(this.index, this.pageSize)
if (list.length > 0) {
// this.showList=list
this.showList = this.showList.concat(list)
} else {
//
this.loadingType = "nomore";
}
},
}, 600);
};
const requestConfirm = (result) => {
dataContent.value = {
itemCode: result.itemCode,
planNumber: result.planNumber, //
handleQty: 0,
qty: 0,
planQty: result.planQty,
goodQty: result.goodQty,
noGoodQty: calc.sub(result.planQty, result.goodQty),
packQtyHint: result.packQtyHint,
packQty: result.packQty,
uom: result.uom,
batch: result.batch,
packUnit: result.packUnit,
workStationCode: result.workStationCode,
fgLocationCode: result.fgLocationCode,
subList: [],
productionLine: result.productionLine,
bomVersion: result.bomVersion,
workshop: result.workshop,
team: "",
shift: "",
putAwayRequestSwitch: result.putAwayRequestSwitch,
putAwayInspectSwitch: result.putAwayInspectSwitch
};
settingPutAwayRequestSwitch.value = result.putAwayRequestSwitch;
settingPutAwayInspectSwitch.value = result.putAwayInspectSwitch;
};
const initList = () => {
index.value = 1;
showList.value = [];
loadingType.value = "";
showList.value = getDataPage(index.value, pageSize.value);
};
const getDataPage = (pageNo, pageSize) => {
const totalPages = Math.ceil(allList.value.length / pageSize);
const start = (pageNo - 1) * pageSize;
const end = start + pageSize;
return allList.value.slice(start, end);
};
const swipeClick = (e, dataContent, index) => {
if (e.content.text === "移除") {
comMessage.value.showQuestionMessage("是否要移除", (res) => {
if (res) {
showList.value.splice(index, 1);
calcFgQty();
}
});
}
};
mounted() {
const submit = () => {
if (showList.value.length === 0) {
showErrorMessage("请先扫描唯一码");
return;
}
},
methods: {
openFg() {
setTimeout(res => {
if (this.$refs.comNoReceiptPopup) {
this.$refs.comNoReceiptPopup.openRequestPopup();
}
}, 600)
},
requestConfirm(result) {
this.dataContent = {
itemCode: result.itemCode,
planNumber: result.planNumber, //
handleQty: 0,
qty: 0,
planQty: result.planQty,
goodQty: result.goodQty,
noGoodQty: calc.sub(result.planQty, result.goodQty),
packQtyHint: result.packQtyHint,
packQty: result.packQty,
uom: result.uom,
batch: result.batch,
packUnit: result.packUnit,
workStationCode: result.workStationCode,
fgLocationCode: result.fgLocationCode,
subList: [],
productionLine: result.productionLine,
bomVersion: result.bomVersion,
workshop: result.workshop,
team: "",
shift: "",
putAwayRequestSwitch:result.putAwayRequestSwitch,
putAwayInspectSwitch:result.putAwayInspectSwitch
}
this.settingPutAwayRequestSwitch = result.putAwayRequestSwitch
this.settingPutAwayInspectSwitch = result.putAwayInspectSwitch
},
initList() {
this.index = 1;
this.showList = []
this.loadingType = "";
this.showList = this.getDataPage(this.index, this.pageSize)
},
getDataPage(pageNo, pageSize) {
//
var totalPages = Math.ceil(this.allList.length / pageSize);
//
const start = (pageNo - 1) * pageSize;
const end = start + pageSize; //
return this.allList.slice(start, end)
},
swipeClick(e, dataContent, index) {
if (e.content.text == "移除") {
this.$refs.comMessage.showQuestionMessage("是否要移除", res => {
if (res) {
this.showList.splice(index, 1);
this.calcFgQty();
//this.initList()
}
})
if (showList.value.length < dataContent.value.packQty) {
comMessage.value.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", (res) => {
if (res) {
commit();
}
},
});
} else {
commit();
}
};
const commit = async () => {
let list = [];
try {
uni.showLoading({
title: "提交中...",
mask: true
});
const params = setParams();
const planData = await createByPlanSubmit(params);
if (planData.data.tb1 && planData.data.tb1.length > 0) {
planData.data.tb1.forEach((item) => {
list.push({
itemCode: item.itemCode, //
itemName: item.itemName, //
packName: item.packName, //
packageCode: item.toPackingNumber, //
batch: item.toBatch, //
parentNumber: item.parentNumber, //
itemType: item.itemType, //
asnNumber: item.asnNumber, // ASN
supplierCode: item.supplierCode, //
qty: item.qty, //
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, // 线
barcodeString: item.barcodeString, //
barcodeBase64: '',
requestNumber: item.requestNumber
});
});
} else {
throw new Error("提交失败");
}
submit() {
if (this.showList.length == 0) {
this.showErrorMessage("请先扫描唯一码")
return;
}
let hintMsg = "提交成功\n生成装配收货记录\n";
if (list.length > 0 && list[0].requestNumber) {
hintMsg += list[0].requestNumber;
}
showCommitSuccessMessage(hintMsg, list);
scanedQty.value += showList.value.length;
showList.value = [];
dataContent.value.handleQty = 0;
uni.hideLoading();
} catch (error) {
uni.hideLoading();
const hint = error.message ? error.message : error;
showErrorMessage(hint);
}
startSetting(list);
};
if (this.showList.length < this.dataContent.packQty) {
this.$refs.comMessage.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", res => {
if (res) {
this.commit()
}
});
} else {
this.commit();
}
const startSetting = async (list) => {
if (settingPutAwayRequestSwitch.value) {
if (list.length > 0 && list[0].requestNumber) {
await createPutawayRequestByPlan(list[0].requestNumber);
}
}
},
async commit() {
let list = []
try {
uni.showLoading({
title: "提交中...",
mask: true
})
let params = this.setParams()
var planData = await createByPlanSubmit(params)
if (planData.data.tb1&&planData.data.tb1.length>0) {
planData.data.tb1.forEach(item => {
list.push({
itemCode: item.itemCode, //
itemName: item.itemName, //
packName: item.packName, //
packageCode: item.toPackingNumber, //
batch: item.toBatch, //
parentNumber: item.parentNumber, //
itemType: item.itemType, //
asnNumber: item.asnNumber, //ASN
supplierCode: item.supplierCode, //
qty: item.qty, //
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, //线
barcodeString: item.barcodeString, //
barcodeBase64: '',
requestNumber: item.requestNumber
})
})
if (settingPutAwayInspectSwitch.value) {
if (list.length > 0 && list[0].requestNumber) {
await createInspectRequestByPlan(list[0].requestNumber);
}
}
console.log("提交所有完成" + getCurrDateTime());
};
const setParams = () => {
showList.value.forEach((res) => {
res.outsideItemCode = res.itemCode;
res.outsideProduceDate = null;
res.outsideSerialNumber = res.order;
});
dataContent.value.subList = showList.value;
return dataContent.value;
};
const clear = () => {
comMessage.value.showQuestionMessage("是否要清空?", (res) => {
if (res) {
clearData();
openFg();
}
});
};
const clearData = () => {
dataContent.value = null;
showList.value = [];
allList.value = [];
index.value = 1;
};
const openScanPopup = () => {
const itemCode = dataContent.value.itemCode;
console.log("物料", itemCode);
scanPopup.value.openScanPopup(itemCode);
};
const getScanResult = (result) => {
isCheckMesCode(result.content).then((res) => {
if (res.data) {
if (dataContent.value) {
const itemIndex = showList.value.findIndex((r) => r.content === result.content);
if (itemIndex === -1) {
result.countTime = new Date();
showList.value.push(result);
showList.value.sort(compare('countTime'));
calcFgQty();
} else {
throw new Error("提交失败")
}
var hintMsg ="提交成功\n生成装配收货记录\n";
if(list.length>0&&list[0].requestNumber){
hintMsg += list[0].requestNumber
comMessage.value.showQuestionMessage(`唯一码【${result.content}】已经扫描,是否移除`, (res) => {
if (res) {
showList.value.splice(itemIndex, 1);
showList.value.sort(compare('countTime'));
calcFgQty();
}
});
}
this.showCommitSuccessMessage(hintMsg, list)
this.scanedQty = this.scanedQty + this.showList.length;
this.showList = [];
this.dataContent.handleQty = 0;
this.$forceUpdate();
uni.hideLoading()
} catch (error) {
uni.hideLoading()
var hint = error.message ? error.message : error
this.showErrorMessage(hint)
}
this.startSetting(list)
},
async startSetting(list){
//
if (this.settingPutAwayRequestSwitch) {
if (list.length > 0 && list[0].requestNumber) {
await createPutawayRequestByPlan(list[0].requestNumber)
}
}
}).catch((error) => {
showErrorMessage(error);
});
};
const calcFgQty = () => {
dataContent.value.handleQty = showList.value.length;
if (parseFloat(dataContent.value.planQty) - parseFloat(scanedQty.value) <= parseFloat(dataContent.value.packQty)) {
if (parseFloat(dataContent.value.handleQty) === parseFloat(dataContent.value.planQty) - parseFloat(scanedQty.value)) {
if (scanPopup.value) {
scanPopup.value.closeScanPopup();
}
//
if (this.settingPutAwayInspectSwitch) {
if (list.length > 0 && list[0].requestNumber) {
await createInspectRequestByPlan(list[0].requestNumber)
}
commit();
}
} else {
if (parseFloat(dataContent.value.handleQty) === parseFloat(dataContent.value.packQty)) {
if (scanPopup.value) {
scanPopup.value.closeScanPopup();
}
console.log("提交所有完成"+getCurrDateTime())
},
setParams() {
this.showList.forEach(res => {
res.outsideItemCode = res.itemCode
res.outsideProduceDate = null
res.outsideSerialNumber = res.order
})
this.dataContent.subList = this.showList
return this.dataContent
},
clear() {
this.$refs.comMessage.showQuestionMessage("是否要清空?", res => {
if (res) {
this.clearData()
this.openFg();
}
commit();
}
}
};
})
},
clearData() {
this.dataContent = null
this.showList = []
this.allList = []
this.index = 1;
},
openScanPopup() {
var itemCode = this.dataContent.itemCode
console.log("物料", itemCode)
this.$refs.scanPopup.openScanPopup(itemCode);
},
getScanResult(result) {
let that = this;
//TODO
//mes
isCheckMesCode(result.content).then(res => {
if (res.data) {
if (that.dataContent) {
var itemIndex = this.showList.findIndex(r =>
r.content == result.content);
//
if (itemIndex == -1) {
// if (this.allList.length > this.dataContent.packQty) {
// this.showErrorMessage("")
// return;
// }
result.countTime = new Date();
this.showList.push(result);
this.showList.sort(compare('countTime')); //
//this.initList()
this.scanPopupGetFocus();
this.calcFgQty();
} else {
this.$refs.comMessage.showQuestionMessage("唯一码【" + result.content +
'】已经扫描,是否移除',
res => {
if (res) {
this.showList.splice(itemIndex, 1)
this.showList.sort(compare('countTime')); //
//this.initList()
that.calcFgQty();
}
})
}
}
}
}).catch(error => {
this.showErrorMessage(error)
})
},
calcFgQty() {
this.dataContent.handleQty = this.showList.length;
if(parseFloat(this.dataContent.planQty) -parseFloat(this.scanedQty) <= parseFloat(this.dataContent.packQty)){
if(parseFloat(this.dataContent.handleQty) == parseFloat(this.dataContent.planQty) -parseFloat(this.scanedQty)){
if (this.$refs.scanPopup) {
this.$refs.scanPopup.closeScanPopup();
}
this.commit()
}
}else{
if (parseFloat(this.dataContent.handleQty) == parseFloat(this.dataContent.packQty)) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.closeScanPopup();
}
this.commit()
}
}
},
const scanPopupGetFocus = () => {
if (scanPopup.value) {
scanPopup.value.getfocus();
}
};
scanPopupGetFocus() {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus();
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.losefocus();
}
},
getH5BatchPrintingLable( number) {
let _this = this
batchPrintingLable(number).then(resLable => {
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`
const webData = {
token: storage.getStorage(storage.constant.token),
asn_number: resLable.data
}
if ( this.scanedQty + this.showList.length == this.dataContent.planQty) {
uni.redirectTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
}else{
uni.navigateTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
}
})
},
print(pointData){
let _this = this
// #ifdef APP
if (pointData.length > 0) {
if (this.scanedQty + this.showList.length == this.dataContent.planQty) {
uni.redirectTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
} else {
uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
}
}
// #endif
// #ifdef H5
let packingNumber = []
pointData.forEach(item=>{
packingNumber.push(item.packageCode)
})
getBalanceToPackage({
packingNumber: packingNumber.join(',')
}).then(res => {
console.log('PC打印', res)
_this.getH5BatchPrintingLable(res.data.number)
}).catch(error => {
_this.showErrorMessage(error)
})
// #endif
},
showCommitSuccessMessage(hint, pointData) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.print(pointData)
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus()
}
const scanPopupLoseFocus = () => {
if (scanPopup.value) {
scanPopup.value.losefocus();
}
};
const getH5BatchPrintingLable = (number) => {
batchPrintingLable(number).then((resLable) => {
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`;
const webData = {
token: storage.getStorage(storage.constant.token),
asn_number: resLable.data
};
if (scanedQty.value + showList.value.length === dataContent.value.planQty) {
uni.redirectTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
} else {
uni.navigateTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
}
});
};
const print = (pointData) => {
if (pointData.length > 0) {
if (scanedQty.value + showList.value.length === dataContent.value.planQty) {
uni.redirectTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
} else {
uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
}
}
const packingNumber = pointData.map((item) => item.packageCode).join(',');
getBalanceToPackage({ packingNumber }).then((res) => {
console.log('PC打印', res);
getH5BatchPrintingLable(res.data.number);
}).catch((error) => {
showErrorMessage(error);
});
};
const showCommitSuccessMessage = (hint, pointData) => {
comMessage.value.showSuccessMessage(hint, (res) => {
print(pointData);
});
};
const showErrorMessage = (message) => {
comMessage.value.showErrorMessage(message, (res) => {
if (res) {
scanPopupGetFocus();
}
});
};
}
</script>
<style scoped lang="scss">

Loading…
Cancel
Save