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> <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: { title: {
uom, type: String,
balanceStatus, default: '开工阶段'
winScanItem,
packQty,
}, },
data() { itemCodeTypeList: {
return { type: Array,
itemCode: '', default: () => []
itemName: '请选择物料信息', }
uom: "", });
qty: null, const emit = defineEmits(['confirm']);
planQty: 0,
goodQty: 0, const itemCode = ref('');
planNumber: "", const itemName = ref('请选择物料信息');
productLineCode: "", const uom = ref('');
showProductLineSelect: false, const qty = ref(null);
productLineList: [], const planQty = ref(0);
productionLineName: "请选择生产线", const goodQty = ref(0);
batch: "", const planNumber = ref('');
packUnitName: "请选择包装规格", const productLineCode = ref('');
packUnit: "", const showProductLineSelect = ref(false);
packUnitList: [], const productLineList = ref([]);
packQtyHint: "", const productionLineName = ref('请选择生产线');
packQty: 0, const batch = ref('');
showPackUnitSelect: false, const packUnitName = ref('请选择包装规格');
itemCodeList: [], const packUnit = ref('');
showItemCodeSelect: false, const packUnitList = ref([]);
workStationCode: "", const packQtyHint = ref('');
planDate: '', const packQty = ref(0);
showDateSelect: false, const showPackUnitSelect = ref(false);
planDateList: [], const itemCodeList = ref([]);
fgLocationCode: "", const showItemCodeSelect = ref(false);
rawLocationCode: "", const workStationCode = ref('');
workshop: "", const planDate = ref('');
bomVersion: "", const showDateSelect = ref(false);
putAwayRequestSwitch:true, const planDateList = ref([]);
putAwayInspectSwitch:true, const fgLocationCode = ref('');
EnableQms:true const rawLocationCode = ref('');
} const workshop = ref('');
}, const bomVersion = ref('');
props: { const putAwayRequestSwitch = ref(true);
title: { const putAwayInspectSwitch = ref(true);
type: String, const EnableQms = ref(true);
default: '开工阶段' const show = ref(false)
}, const popup = ref(null);
itemCodeTypeList: { const comMessage = ref(null);
type: Array, const itemCodeFocus = ref(false);
default: []
}, onMounted(() => {
}, EnableQms.value = getSwitchInfoByCode('EnableQms');
mounted() { });
this.EnableQms = getSwitchInfoByCode('EnableQms')
}, const openRequestPopup = () => {
methods: { initData();
openRequestPopup() { planDate.value = getCurrDate();
this.initData(); batch.value = planDate.value.replace('-', '').replace('-', '');
this.planDate = getCurrDate() show.value = true
this.batch = this.planDate.replace('-', '').replace('-', '') };
this.$refs.popup.open('bottom')
}, const initData = () => {
initData() { itemCode.value = '请选择物料信息';
this.itemCode = '请选择物料信息'; uom.value = '';
this.uom = "" planQty.value = 0;
this.planQty = 0 goodQty.value = 0;
this.goodQty = 0; packQty.value = 0;
this.packQty = 0; planNumber.value = '';
this.planNumber = "" productLineCode.value = '';
this.productLineCode = "" showProductLineSelect.value = false;
this.showProductLineSelect = false productLineList.value = [];
this.productLineList = [] productionLineName.value = '请选择生产线';
this.productionLineName = "请选择生产线" productLineCode.value = '';
this.productLineCode = "" batch.value = '';
this.batch = "" packUnitName.value = '请选择包装规格';
this.packUnitName = "请选择包装规格" packUnit.value = '';
this.packUnit = "" packQtyHint.value = '';
this.packQtyHint = "" showPackUnitSelect.value = false;
this.showPackUnitSelect = false itemCodeList.value = [];
// this.packUnitList = [] showItemCodeSelect.value = false;
this.itemCodeList = [] workStationCode.value = '';
this.showItemCodeSelect = false planDate.value = '';
this.workStationCode = "" showDateSelect.value = false;
this.planDate = "" planDateList.value = [];
this.showDateSelect = false fgLocationCode.value = '';
this.planDateList = [] rawLocationCode.value = '';
this.fgLocationCode = "" workshop.value = '';
this.rawLocationCode = "" bomVersion.value = '';
this.workshop = "" putAwayRequestSwitch.value = true;
this.bomVersion = "" putAwayInspectSwitch.value = true;
this.putAwayRequestSwitch = true };
this.putAwayInspectSwitch = true
}, const closeRequestPopup = () => {
show.value = false
closeRequestPopup() { };
this.$refs.popup.close()
}, const itemCodeLoseFocus = () => {
itemCodeLoseFocus() { itemCodeFocus.value = false;
this.itemCodeFocus = false; };
},
const confirm = () => {
confirm() { if (!planDate.value) {
if (!this.planDate) { showErrorMessage('请先选择计划日期');
this.showErrorMessage('请先选择计划日期'); return;
return; }
}
if (this.productionLineName == "请选择生产线") {
this.showErrorMessage("请选择生产线")
return
}
if (!this.batch) {
this.showErrorMessage("请输入批次例如:20200101")
return
}
if (this.itemCode == "请选择物料信息") { if (productionLineName.value === '请选择生产线') {
this.showErrorMessage("请选择物料信息") showErrorMessage('请选择生产线');
return return;
} }
if (this.planQty <= 0) { if (!batch.value) {
this.showErrorMessage("请输入完工数量") showErrorMessage('请输入批次例如:20200101');
return return;
} }
if (this.packUnitName == "请选择包装规格") { if (itemCode.value === '请选择物料信息') {
this.showErrorMessage("请选择包装规格") showErrorMessage('请选择物料信息');
return 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 (planQty.value <= 0) {
showErrorMessage('请输入完工数量');
return;
}
}, if (packUnitName.value === '请选择包装规格') {
showSelectItemCode() { showErrorMessage('请选择包装规格');
if (!this.productLineCode) { return;
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;
}
uni.showLoading({ if (!EnableQms.value) {
title: "加载中", putAwayInspectSwitch.value = false;
mask: true }
}) callback();
getPackUnitByItemCode(this.itemCode).then(res => { };
uni.hideLoading()
if (res.data && res.data.list.length > 0) { const callback = () => {
res.data.list.forEach(item => { const item = {
item.value = item.packUnit productionLineName: '',
item.label = getPackUnitName(item.packUnit) + "(" + item.packQty + this productionLine: productLineCode.value, // 线
.getUomInfo(item.uom) + ")"; itemCode: itemCode.value,
}) itemName: itemName.value,
this.packUnitList = res.data.list uom: getUomInfo(uom.value),
this.showPackUnitSelect = true batch: batch.value,
} else { packUnitName: packUnitName.value,
this.showErrorMessage('未查找到包装信息'); packUnit: packUnit.value,
} packQtyHint: packQtyHint.value,
packQty: packQty.value,
}).catch(error => { planQty: planQty.value,
uni.hideLoading() goodQty: goodQty.value,
this.showErrorMessage(error); planNumber: '',
}) workStationCode: workStationCode.value,
fgLocationCode: fgLocationCode.value,
}, rawLocationCode: rawLocationCode.value,
workshop: workshop.value,
confirmSelectPackUnit(data) { bomVersion: bomVersion.value,
this.packUnitName = data[0].label putAwayRequestSwitch: putAwayRequestSwitch.value,
this.packUnit = data[0].value putAwayInspectSwitch: putAwayInspectSwitch.value
let pack = this.packUnitList.filter(r => r.packUnit == this.packUnit); };
this.packQtyHint = pack[0].packQty + "(" + this
.getUomInfo(pack[0].uom) + ")"; closeRequestPopup();
this.uom = this.getUomInfo(pack[0].uom); emit('confirm', item);
this.packQty = pack[0].packQty };
},
getUomInfo(uom) { const showErrorMessage = (message, type) => {
let item = getUomInfo(uom); setTimeout(() => {
if (item == '') { comMessage.value.showErrorMessage(message, (res) => {});
return uom; });
};
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 { } else {
return item.label showErrorMessage('未查找到生产线信息');
} }
}, }).catch((error) => {
switchPutAwayRequest(value){ uni.hideLoading();
console.log(value) showErrorMessage(error);
console.log("打印"+this.putAwayRequestSwitch) });
this.putAwayRequestSwitch = value; } else {
}, showProductLineSelect.value = true;
}
switchPutAwayInspect(value){ };
console.log(value)
this.putAwayInspectSwitch = value; 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> </script>
<style lang="scss"> <style lang="scss">

757
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, title: {
packQty type: String,
}, default: '开工阶段'
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)
}, },
methods: { itemCodeTypeList: {
openRequestPopup() { type: Array,
this.initData() default: () => []
this.planDate = getCurrDate() }
// this.batch = getBatch8() });
this.batch = this.planDate.replace('-', '').replace('-', ''); const emit = defineEmits(['confirm'])
this.$refs.popup.open('bottom')
}, const itemCode = ref('请选择物料信息');
const uom = ref('');
initData() { const qty = ref(null);
this.itemCode = '请选择物料信息' const planQty = ref(0);
this.uom = '' const goodQty = ref(0);
this.planQty = 0 const planNumber = ref('');
this.goodQty = 0 const productLineCode = ref('');
this.packQty = 0 const showProductLineSelect = ref(false);
this.planNumber = '' const productLineList = ref([]);
this.productLineCode = '' const productionLineName = ref('请选择生产线');
this.showProductLineSelect = false const productionLineCode = ref('');
this.productLineList = [] const batch = ref('');
this.productionLineName = '请选择生产线' const packUnitName = ref('请选择包装规格');
this.productionLineCode = '' const packUnit = ref('');
this.batch = '' const packUnitList = ref([]);
this.packUnitName = '请选择包装规格' const packQtyHint = ref('');
;(this.packUnit = ''), (this.packQtyHint = '') const packQty = ref(0);
this.showPackUnitSelect = false const showPackUnitSelect = ref(false);
// this.packUnitList = [] const itemCodeList = ref([]);
this.itemCodeList = [] const showItemCodeSelect = ref(false);
this.showItemCodeSelect = false const workStationCode = ref('');
this.workStationCode = '' const planDate = ref('');
this.planDate = '' const showDateSelect = ref(false);
this.showDateSelect = false const planDateList = ref([]);
this.planDateList = [] const fgLocationCode = ref('');
this.fgLocationCode = '' const rawLocationCode = ref('');
this.rawLocationCode = '' const putAwayRequestSwitch = ref(true);
this.putAwayRequestSwitch=true const putAwayInspectSwitch = ref(true);
this.putAwayInspectSwitch=true const EnableQms = ref(true);
}, const show = ref(false)
const itemCodeFocus = ref(false)
closeRequestPopup() { const popup = ref(null);
this.$refs.popup.close() const comMessage = ref(null);
}, onMounted(() => {
EnableQms.value = getSwitchInfoByCode('EnableQms');
itemCodeLoseFocus() { console.log(777, EnableQms.value);
this.itemCodeFocus = false });
},
const openRequestPopup = () => {
confirm() { initData();
if (!this.planDate) { planDate.value = getCurrDate();
this.showErrorMessage('请先选择计划日期') batch.value = planDate.value.replace('-', '').replace('-', '');
return 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 == '请选择生产线') { 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() {
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)
},
showErrorMessage(message, type) { if (!EnableQms.value) {
setTimeout((r) => { putAwayInspectSwitch.value = false;
this.$refs.comMessage.showErrorMessage(message, (res) => {}) }
})
}, callback();
cancel(e) { };
this.closeRequestPopup()
}, const callback = () => {
const item = {
confirmSelectLine(data) { productionLineName: productionLineName.value,
this.productionLineName = `${data[0].label}${data[1].label}` productionLineCode: productionLineCode.value, // 线
this.productionLineCode = data[0].value itemCode: itemCode.value,
this.workStationCode = data[1].value uom: getUomInfo(uom.value),
const parent = this.productLineList.filter((res) => res.value == this.productionLineCode) batch: batch.value,
const fgLocation = parent[0].children.filter((children) => children.value == this.workStationCode) packUnitName: packUnitName.value,
this.fgLocationCode = fgLocation[0].fgLocationCode packUnit: packUnit.value,
// this.clearItemCode() packQtyHint: packQtyHint.value,
// this.clearPackUnit() packQty: packQty.value,
this.showProductLineSelect = false planQty: planQty.value,
this.showSelectItemCode() goodQty: goodQty.value,
}, planNumber: planNumber.value,
workStationCode: workStationCode.value,
clearItemCode() { fgLocationCode: fgLocationCode.value,
this.planDate = getCurrDate() rawLocationCode: rawLocationCode.value,
this.itemCode = '请选择物料信息' putAwayRequestSwitch: putAwayRequestSwitch.value,
this.uom = '' putAwayInspectSwitch: putAwayInspectSwitch.value
this.planQty = 0 };
this.goodQty = 0 closeRequestPopup();
this.planNumber = '' emit('confirm', item);
this.packUnit = '' };
this.packQty = 0
}, const showErrorMessage = (message) => {
setTimeout(() => {
confirmSelectDate(data) { comMessage.value.showErrorMessage(message, () => {});
this.planDate = data[0].label });
this.batch = this.planDate.replace('-', '').replace('-', '') };
this.afterSelectPlanData()
}, const cancel = (e) => {
closeRequestPopup();
showSelectDate() { };
this.showDateSelect = true
const list = lastThreeDays(3) const confirmSelectLine = (data) => {
this.planDateList = [] productionLineName.value = `${data[0].label}${data[1].label}`;
list.forEach((res) => { productionLineCode.value = data[0].value;
this.planDateList.push({ workStationCode.value = data[1].value;
label: res, const parent = productLineList.value.filter((res) => res.value == productionLineCode.value);
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('未查找到生产线信息');
}
}) })
}, .catch((error) => {
uni.hideLoading();
showSelectLine() { showErrorMessage(error);
if (this.productLineList.length == 0) { });
uni.showLoading({ } else {
title: '加载中', showProductLineSelect.value = true;
mask: true }
}) };
getProductionlineAndWorkStation()
.then((res) => { const afterSelectPlanData = () => {
uni.hideLoading() itemCode.value = '请选择物料信息';
if (res.data && res.data.length > 0) { packUnit.value = '';
this.productLineList = res.data packQty.value = 0;
this.showProductLineSelect = true planQty.value = 0;
} else { itemCode.value = '请选择物料信息';
this.showErrorMessage('未查找到生产线信息') uom.value = '';
} packUnitName.value = '请选择包装规格';
}) packUnit.value = '';
.catch((error) => { packQtyHint.value = '';
uni.hideLoading()
this.showErrorMessage(error) 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 { } else {
this.showProductLineSelect = true showErrorMessage(`未查找到该生产线在【${planDate.value}】日期的生产计划`);
} }
}, })
.catch((error) => {
afterSelectPlanData() { uni.hideLoading();
this.itemCode = '请选择物料信息' showErrorMessage(error);
this.packUnit = '' });
this.packQty = 0 };
this.planQty = 0
this.itemCode = '请选择物料信息' const confirmSelectItem = (data) => {
this.uom = '' const productionPlan = data[0].value;
this.packUnitName = '请选择包装规格' itemCode.value = productionPlan.itemCode;
this.packUnit = '' uom.value = productionPlan.uom;
this.packQtyHint = '' planQty.value = productionPlan.planQty;
goodQty.value = productionPlan.goodQty;
// this.packUnitList = [] planNumber.value = productionPlan.number;
this.itemCodeList = []
this.showSelectItemCode() clearPackUnit();
this.putAwayRequestSwitch=true uni.showLoading({
this.putAwayInspectSwitch=true title: '加载中',
}, mask: true
});
showItemList() { getPackUnitByItemCode(itemCode.value)
this.showItemCodeSelect = true .then((res) => {
}, uni.hideLoading();
if (res.data && res.data.list.length > 0) {
showSelectItemCode() { res.data.list.forEach((item) => {
if (!this.planDate) { item.value = item.packUnit;
this.showErrorMessage('请先选择计划日期') item.label = `${getPackUnitName(item.packUnit)}(${item.packQty}${getUomInfo(item.uom)})`;
return });
} packUnitList.value = res.data.list;
if (!this.productionLineCode) { const defaultData = res.data.list.filter((item) => item.defaultPackageunit == 'TRUE');
this.showErrorMessage('请先选择生产线') confirmSelectPackUnit(defaultData);
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();
});
};
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({ 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) => {
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
} }
return item.label })
}, .catch((error) => {
switchPutAwayRequest(value){ uni.hideLoading();
console.log(value) showErrorMessage(error);
console.log("打印"+this.putAwayRequestSwitch) });
this.putAwayRequestSwitch =value; };
},
const confirmSelectPackUnit = (data) => {
switchPutAwayInspect(value){ packUnitName.value = data[0].label;
console.log(value) packUnit.value = data[0].value;
this.putAwayInspectSwitch =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> </script>
<style lang="scss"> <style lang="scss">

601
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: [], uni.setNavigationBarTitle({
fgList: [], title: option.title
currentPackage: null, });
reason: '', getBusinessType();
options:[] });
}
}, onNavigationBarButtonTap((e) => {
onLoad(option) { if (e.index === 0) {
uni.setNavigationBarTitle({ goHome();
title: option.title }
}) });
this.getBusinessType()
// this.options = getRemoveOption() onBackPress((e) => {});
},
// onPullDownRefresh(() => {});
onNavigationBarButtonTap(e) {
if (e.index === 0) { const getBusinessType = () => {
goHome() 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) {},
const getPackScanResult = (result) => {
onPullDownRefresh() {}, const { label } = result;
const pack = result.package;
mounted() {}, uni.showLoading({
methods: { title: '加载中...',
getBusinessType() { mask: true
getBusinessType(this.bussinessCode, (res) => { });
if (res.success) { const params = {
this.businessType = res.businessType available: 'TRUE',
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses) changeBeforeCode: pack.itemCode,
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList pageSize: 20,
this.openScanPopup() 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 { } 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) => { getProductreceiptDetailbByPackingNumber(pack.number)
uni.hideLoading() .then((res) => {
if (res.data.list.length == 0) { if (res.data.length > 0) {
this.showErrorMessage('未查找到变更后的物料,请在《量产件备件关系中进行配置》') fgList.value = res.data;
} else {
this.closeScanPopup() const pack = result.package;
const { balance } = result;
res.data.list.forEach((r) => { currentPackage.value = result.package;
r.value = r.code currentPackage.value.packingNumber = pack.number;
r.label = `${r.code}(${r.name})` currentPackage.value.locationCode = balance.locationCode;
}) currentPackage.value.inventoryStatus = balance.inventoryStatus;
this.toItemList = res.data.list
if (res.data.list.length == 1) {
this.toItemCode = res.data.list[0].code
} else { } else {
this.show = true showErrorMessage(`箱码【${pack.number}】未查找到绑定的灯码信息`);
}
//
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) // ();
} }
}) })
} else { .catch((res) => {
item.scaned = true showErrorMessage(res.message);
this.fgList.unshift(this.fgList.splice(index, 1)[0]) // (); });
}
this.calcHandleQty()
} else {
this.showErrorMessage('扫描的灯码不在灯码列表中')
} }
}, })
.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() { 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;
}
};
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();
} }
}, });
} else {
openScanPopup() { comMessage.value.showQuestionMessage(`是否要将已扫描的【${currentPackage.value.handleQty}】个灯码进行变更?`, (res) => {
setTimeout((r) => { if (res) {
this.$refs.scanPopup.openScanPopup(this.businessType) commitChange();
this.scanPopupGetFocus()
})
},
openScanFgPopup() {
setTimeout((r) => {
this.$refs.scanFgPopup.openScanPopup(this.currentPackage.itemCode)
this.scanFgPopupGetFocus()
})
},
commit() {
if (this.toItemCode == '请选择变更后物料') {
this.showMessage('请选择变更后物料')
return
} }
if (this.currentPackage.handleQty == null) { });
this.$refs.comMessage.showQuestionMessage('是否要将全部灯码进行变更?', (res) => { }
if (res) { };
this.commitChange()
} const commitChange = () => {
}) uni.showLoading({
} else { title: '提交中...',
this.$refs.comMessage.showQuestionMessage(`是否要将已扫描的【${this.currentPackage.handleQty}】个灯码进行变更?`, (res) => { mask: true
if (res) { });
this.commitChange()
} 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: '提交中...', const showErrorMessage = (message) => {
mask: true setTimeout(() => {
}) scanPopupLoseFocus();
comMessage.value.showErrorMessage(message, (res) => {
const params = this.setParams() if (res) {
console.log('params', JSON.stringify(params)) scanPopupGetFocus();
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
} }
});
});
};
// var item = deepCopyData(this.currentPackage); const closeScanPopup = () => {
const item = {} scanPopup.value.closeScanPopup();
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()
}
},
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>

705
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,35 +45,30 @@
</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%;"> <text style="font-size: 30rpx;color: #B66463;">唯一码 </text>
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text> {{item.content}}
{{item.content}} </view> -->
</view> --> </view>
</view> </u-swipe-action>
</uni-swipe-action-item>
</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,388 +114,335 @@ 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() { return;
this.options = getRemoveOption() }
this.openFg(); index.value++;
}, const list = getDataPage(index.value, pageSize.value);
if (list.length > 0) {
showList.value = showList.value.concat(list);
} else {
loadingType.value = "nomore";
}
});
onReachBottom() { const openFg = () => {
console.log("onReachBottom") setTimeout(() => {
// if (comNoReceiptPopup.value) {
if (this.loadingType == 'nomore') { comNoReceiptPopup.value.openRequestPopup();
return;
} }
this.index++; }, 600);
var list = this.getDataPage(this.index, this.pageSize) };
if (list.length > 0) {
// this.showList=list const requestConfirm = (result) => {
this.showList = this.showList.concat(list) dataContent.value = {
} else { itemCode: result.itemCode,
// planNumber: result.planNumber, //
this.loadingType = "nomore"; 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;
}
}, if (showList.value.length < dataContent.value.packQty) {
methods: { comMessage.value.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", (res) => {
openFg() { if (res) {
setTimeout(res => { commit();
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()
}
})
} }
}, });
} 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() { let hintMsg = "提交成功\n生成装配收货记录\n";
if (this.showList.length == 0) { if (list.length > 0 && list[0].requestNumber) {
this.showErrorMessage("请先扫描唯一码") hintMsg += list[0].requestNumber;
return; }
} 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) { const startSetting = async (list) => {
this.$refs.comMessage.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", res => { if (settingPutAwayRequestSwitch.value) {
if (res) { if (list.length > 0 && list[0].requestNumber) {
this.commit() await createPutawayRequestByPlan(list[0].requestNumber);
} }
}); }
} else {
this.commit();
}
}, if (settingPutAwayInspectSwitch.value) {
if (list.length > 0 && list[0].requestNumber) {
async commit() { await createInspectRequestByPlan(list[0].requestNumber);
let list = [] }
try { }
uni.showLoading({ console.log("提交所有完成" + getCurrDateTime());
title: "提交中...", };
mask: true
}) const setParams = () => {
showList.value.forEach((res) => {
let params = this.setParams() res.outsideItemCode = res.itemCode;
res.outsideProduceDate = null;
var planData = await createByPlanSubmit(params) res.outsideSerialNumber = res.order;
if (planData.data.tb1&&planData.data.tb1.length>0) { });
planData.data.tb1.forEach(item => { dataContent.value.subList = showList.value;
list.push({ return dataContent.value;
itemCode: item.itemCode, // };
itemName: item.itemName, //
packName: item.packName, // const clear = () => {
packageCode: item.toPackingNumber, // comMessage.value.showQuestionMessage("是否要清空?", (res) => {
batch: item.toBatch, // if (res) {
parentNumber: item.parentNumber, // clearData();
itemType: item.itemType, // openFg();
asnNumber: item.asnNumber, //ASN }
supplierCode: item.supplierCode, // });
qty: item.qty, // };
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, //线 const clearData = () => {
barcodeString: item.barcodeString, // dataContent.value = null;
barcodeBase64: '', showList.value = [];
requestNumber: item.requestNumber 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 { } else {
throw new Error("提交失败") comMessage.value.showQuestionMessage(`唯一码【${result.content}】已经扫描,是否移除`, (res) => {
} if (res) {
var hintMsg ="提交成功\n生成装配收货记录\n"; showList.value.splice(itemIndex, 1);
if(list.length>0&&list[0].requestNumber){ showList.value.sort(compare('countTime'));
hintMsg += list[0].requestNumber 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) }
}, }).catch((error) => {
showErrorMessage(error);
async startSetting(list){ });
// };
if (this.settingPutAwayRequestSwitch) {
if (list.length > 0 && list[0].requestNumber) { const calcFgQty = () => {
await createPutawayRequestByPlan(list[0].requestNumber) 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();
} }
commit();
// }
if (this.settingPutAwayInspectSwitch) { } else {
if (list.length > 0 && list[0].requestNumber) { if (parseFloat(dataContent.value.handleQty) === parseFloat(dataContent.value.packQty)) {
await createInspectRequestByPlan(list[0].requestNumber) if (scanPopup.value) {
} scanPopup.value.closeScanPopup();
} }
console.log("提交所有完成"+getCurrDateTime()) commit();
}, }
}
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();
}
}) const scanPopupGetFocus = () => {
}, if (scanPopup.value) {
clearData() { scanPopup.value.getfocus();
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()
}
}
},
scanPopupGetFocus() { const scanPopupLoseFocus = () => {
if (this.$refs.scanPopup) { if (scanPopup.value) {
this.$refs.scanPopup.getfocus(); scanPopup.value.losefocus();
} }
}, };
scanPopupLoseFocus() {
if (this.$refs.scanPopup) { const getH5BatchPrintingLable = (number) => {
this.$refs.scanPopup.losefocus(); batchPrintingLable(number).then((resLable) => {
} const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`;
}, const webData = {
getH5BatchPrintingLable( number) { token: storage.getStorage(storage.constant.token),
let _this = this asn_number: resLable.data
batchPrintingLable(number).then(resLable => { };
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712` if (scanedQty.value + showList.value.length === dataContent.value.planQty) {
const webData = { uni.redirectTo({
token: storage.getStorage(storage.constant.token), url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
asn_number: resLable.data });
} } else {
if ( this.scanedQty + this.showList.length == this.dataContent.planQty) { uni.navigateTo({
uni.redirectTo({ url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
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)}`
print(pointData){ });
let _this = this } else {
// #ifdef APP uni.navigateTo({
if (pointData.length > 0) { url: `/pages/point/index?points=${JSON.stringify(pointData)}`
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 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">

Loading…
Cancel
Save