Browse Source

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

hella_vue3
王志国 3 weeks ago
parent
commit
8f66e72844
  1. 614
      src/pages/fg/coms/comNoReceiptPopup.vue
  2. 633
      src/pages/fg/coms/comReceiptPopup.vue
  3. 467
      src/pages/fg/fgChange.vue
  4. 501
      src/pages/fg/receiptNoPlan.vue

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

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

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

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

467
src/pages/fg/fgChange.vue

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

501
src/pages/fg/receiptNoPlan.vue

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

Loading…
Cancel
Save