Browse Source

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

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

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

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

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

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

467
src/pages/fg/fgChange.vue

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

465
src/pages/fg/receiptNoPlan.vue

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

Loading…
Cancel
Save