Browse Source

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

hella_vue3
王志国 3 weeks ago
parent
commit
316099aa54
  1. 159
      src/pages/deliver/coms/comDeliverDetailCardBatch.vue
  2. 622
      src/pages/deliver/coms/comScanDeliverPackBatch.vue
  3. 591
      src/pages/deliver/coms/comScanDeliverPackss.vue
  4. 548
      src/pages/deliver/job/deliverDetailBatch.vue

159
src/pages/deliver/coms/comDeliverDetailCardBatch.vue

@ -4,17 +4,15 @@
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view v-for="(item,index) in dataContent.subList" style="margin-bottom: 20rpx;">
<uni-swipe-action ref="swipeAction" :class="item.scaned? 'scan_view':''">
<uni-swipe-action-item
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="swipeClick($event,item,index)" style='padding:20rpx 0px 5px 0px;align-items: center;'>
<u-swipe-action ref="swipeAction"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>swipeClick(event,item,index)"
:class="item.scaned? 'scan_view':''">
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
<location :locationCode="item.fromLocationCode"></location>
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false"
:isShowPack="item.packingNumber"></recommendBalanceBatch>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
</view>
</view>
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit>
@ -22,118 +20,103 @@
<comMessage ref="message"></comMessage>
</template>
<script>
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue'
import handleBalance from '@/mycomponents/balance/handleBalance.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
<script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue'
import handleBalance from '@/mycomponents/balance/handleBalance.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import {
getDetailOption,
getPurchaseReceiptOption,
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
} from '@/common/array.js';
export default {
emits: ['updateData'],
components: {
itemQty,
recommend,
recommendBalanceBatch,
handleBalance,
recommendQtyEdit,
requiredLocation,
qtyEdit,
location,
detailInfoPopup
},
props: {
import {ref, nextTick, onMounted} from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: {}
default: () => ({})
},
settingParam: {
type: Object,
default: {}
default: () => ({})
},
isEdit: {
type: Boolean,
default: true
},
},
watch: {
},
data() {
return {
option: [],
showItem: {},
editItem: {},
batchItem: {},
detailOptions: [],
scanOptions: []
}
},
});
const emit = defineEmits(['updateData']);
mounted() {
const option = ref([]);
const showItem = ref({});
const editItem = ref({});
const batchItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const collapse = ref(null);
const balanceQtyEdit = ref(null);
const receiptHint = ref(null);
const message = ref(null);
onMounted(() => {
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
});
this.removeOptions = getRemoveOption();
this.editAndRemoveOptions = getEditRemoveOption()
},
methods: {
resizeCollapse() {
this.$nextTick(r => {
this.$refs.collapse.forEach(r => {
const resizeCollapse = () => {
nextTick(() => {
collapse.value.forEach(r => {
r.childrens.forEach(i => {
i.init();
})
});
r.resize();
})
});
},
});
};
swipeClick(e, item, index) {
if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(item, index)
const swipeClick = (e, item, index) => {
if (e.content.text === "编辑") {
edit(item);
} else if (e.content.text === "移除") {
remove(item, index);
}
},
};
edit(item) {
let that = this;
that.editItem = item;
that.$refs.balanceQtyEdit.openEditPopup(item);
},
const edit = (item) => {
editItem.value = item;
balanceQtyEdit.value.openEditPopup(item);
};
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(item, index) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
const detail = (item) => {
showItem.value = item;
receiptHint.value.openScanPopup();
};
const remove = (item, index) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.handleQty = 0;
item.scaned = false ;
item.scaned = false;
}
});
},
confirm(val) {
this.editItem.handleQty = Number(val);
this.$emit('updateData', this.editItem)
}
}
}
};
const confirm = (val) => {
editItem.value.handleQty = Number(val);
emit('updateData', editItem.value);
};
</script>
<style>

622
src/pages/deliver/coms/comScanDeliverPackBatch.vue

@ -1,6 +1,6 @@
<template>
<view>
<uni-popup ref="popup" :maskClick='false'>
<u-popup v-model="show" mode="bottom" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
@ -72,15 +72,13 @@
v-if="expand&&issueRecord.length>0">
<view class="uni-flex u-col" v-for="(record,index) in issueRecord">
<view style="width: 100%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<u-swipe-action ref="swipeAction" :options="scanOptions"
@click="(...event)=>swipeClick(event,record,index)">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false"
:isShowStdPack="false"></balance>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
@ -91,474 +89,432 @@
</view>
</view>
</view>
</uni-popup>
</u-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
</view>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
<script setup lang="ts">
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
import {
getDetailOption,
getDetailEditRemoveOption
} from '@/common/array.js';
} from '@/common/array.js';
import {
import {
getDirectoryItemArray,
} from '@/common/directory.js';
} from '@/common/directory.js';
import {
import {
calc
} from '@/common/calc.js';
import {
} from '@/common/calc.js';
import {
getWorkShopLineStation
} from '@/api/request2.js';
} from '@/api/request2.js';
import {
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
export default {
name: 'winScanPack',
components: {
winComScan,
balance,
balanceQtyEdit,
balanceSelect
},
props: {
title: {
type: String,
default: ''
},
headerType: {
type: String,
default: "HPQ,HMQ"
},
},
data() {
return {
dataContent: {},
jobContent: {},
expendIcon: 'arrow-down',
show: false,
scanList: [],
toLocation: null,
toLocationCode: '',
fromLocationList: [],
fromLocationCode: '',
fromLocation: null,
issueRecord: [], //
expand: true,
scanOptions: {},
editItem: {},
positionInfo: "请选择位置",
positionList: [],
defaultValueList: [],
label: {},
fromInventoryStatuses: [],
packageInfo: {}
}
},
created() {
},
watch: {},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
},
methods: {
openScanPopup(content, jobcontent) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
"-" + this.jobContent.subList[0].workStationCode
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus();
}, 500)
},
closeScanPopup() {
this.losefocus()
this.$refs.popup.close();
this.$emit("closeScan")
//
// Object.assign(this.$data, this.$options.data());
},
initData() {
let that = this;
that.fromLocationList = [];
if (that.dataContent != null) {
that.fromInventoryStatuses = getDirectoryItemArray(this.jobContent.outInventoryStatuses)
that.toLocation =that.dataContent.subList;
that.toLocationCode = that.dataContent.subList[0].toLocationCode;
that.fromLocationList = that.getFromLocationList();
}
},
showBalanceSelect(items, packageInfo) {
this.packageInfo = packageInfo;
this.$refs.balanceSelect.openPopup(items);
},
getFromLocationList() {
} from '@/common/balance.js';
import {ref, onMounted} from 'vue';
const detailOptions = ref(getDetailOption());
const scanOptions = ref(getDetailEditRemoveOption());
const issueRecord = ref([]);
const dataContent = ref(null);
const jobContent = ref(null);
const positionInfo = ref('');
const show = ref(false)
const toLocation = ref([]);
const toLocationCode = ref('');
const fromLocationList = ref([]);
const fromLocationCode = ref('');
const packageInfo = ref(null);
const label = ref(null);
const expand = ref(false);
const expendIcon = ref('arrow-up');
const editItem = ref(null);
const showItem = ref(null);
const fromInventoryStatuses = ref();
const balanceSelect = ref(null)
const comMessage = ref(null)
const toLocationCombox = ref(null)
const comscan = ref(null)
const balanceQtyEdit = ref(null)
const receiptHint = ref(null)
const emit = defineEmits(['closeScan','afterScan'])
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption();
});
const openScanPopup = (content, jobcontent) => {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode +
"-" + jobContent.value.subList[0].workStationCode;
show.value = true
setTimeout(() => {
getfocus();
}, 500);
};
const closeScanPopup = () => {
losefocus();
show.value = false
emit("closeScan");
//
// Object.assign(data, options.data());
};
const initData = () => {
fromLocationList.value = [];
if (dataContent.value != null) {
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses);
toLocation.value = dataContent.value.subList;
toLocationCode.value = dataContent.value.subList[0].toLocationCode;
fromLocationList.value = getFromLocationList();
}
};
const showBalanceSelect = (items, packageInfoValue) => {
packageInfo.value = packageInfoValue;
balanceSelect.value.openPopup(items);
};
const getFromLocationList = () => {
let list = [];
let location = this.dataContent.subList.find(r => r.toLocationCode == this.toLocationCode);
let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value);
if (location != undefined) {
this.dataContent.subList.forEach(item => {
list.push(item.fromLocationCode)
})
this.fromLocationCode = list[0];
dataContent.value.subList.forEach(item => {
list.push(item.fromLocationCode);
});
fromLocationCode.value = list[0];
return list;
} else {
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => {
this.toLocationCode = '';
comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => {
toLocationCode.value = '';
});
}
},
};
fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation)
// --
// if (location == undefined) {
this.fromLocationCode = fromlocation
// this.showErrorMessage('' + fromlocation + '')
// }
},
onScan(result) {
try {
let that = this;
const fromLocationUpdate = (fromlocation) => {
let location = fromLocationList.value.find(r => r == fromlocation);
fromLocationCode.value = fromlocation;
};
if (that.fromLocationCode == '') {
that.showErrorMessage('请选择来源库位', res => {
that.$refs.toLocationCombox.onFocus();
const onScan = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', res => {
toLocationCombox.value.onFocus();
});
return;
}
let packageInfo = result.package;
let packageInfoValue = result.package;
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = that.toLocation.find(r => r.itemCode == itemCode);
let item = toLocation.value.find(r => r.itemCode == itemCode);
if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发货明细',
res => {
that.getfocus();
}
)
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => {
getfocus();
});
return;
} else {
//
uni.showLoading({
title: '加载中',
mask: true
})
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses,
});
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value,
balanceRes => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录',
res => {
this.packGetFocus();
})
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => {
packGetFocus();
});
} else if (balanceRes.data.list.length == 1) {
let balance = balanceRes.data.list[0];
this.afterGetBalance(result.label, balance, packageInfo);
afterGetBalance(result.label, balance, packageInfoValue);
} else {
this.label = result.label;
this.showBalanceSelect(balanceRes.data.list, packageInfo);
label.value = result.label;
showBalanceSelect(balanceRes.data.list, packageInfoValue);
}
} else {
this.showErrorMessage(balanceRes.message.message);
showErrorMessage(balanceRes.message.message);
}
uni.hideLoading();
});
}
} catch (e) {
this.showErrorMessage(e.stack)
showErrorMessage(e.stack);
uni.hideLoading();
}
},
selectBalanceItem(balance) {
this.afterGetBalance(balance, balance, this.packageInfo);
},
};
const selectBalanceItem = (balance) => {
afterGetBalance(balance, balance, packageInfo.value);
};
afterGetBalance(label, balance, packageInfo) {
let that = this;
const afterGetBalance = (labelValue, balance, packageInfoValue) => {
try {
let itemCode = label.itemCode;
let packingCode = label.packingNumber;
let lot = label.batch;
let item = that.toLocation.find(r => r.itemCode == itemCode);
// item.scaned =true
let fromLocation = that.toLocation.find(l => l.fromLocationCode == that.fromLocationCode);
// --
if(!fromLocation){
let itemCode = labelValue.itemCode;
let packingCode = labelValue.packingNumber;
let lot = labelValue.batch;
let item = toLocation.value.find(r => r.itemCode == itemCode);
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value);
if (!fromLocation) {
fromLocation = {
Batchs:[{
Recommends:[],
Batchs: [{
Recommends: [],
Records: [],
batch: label.batch,
detail:{
...packageInfo,
batch: labelValue.batch,
detail: {
...packageInfoValue,
fromLocationCode: balance.locationCode,
toLocationCode:this.toLocationCode
toLocationCode: toLocationCode.value
},
handleQty: 0,
packingNumber: null,
// packingNumber: label.packingNumber,
qty: label.qty,
uom: label.uom
qty: labelValue.qty,
uom: labelValue.uom
}],
toLocationCode:this.toLocationCode,
toLocationCode: toLocationCode.value,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: label.qty,
uom: label.uom
}
item.Locations.push(fromLocation)
qty: labelValue.qty,
uom: labelValue.uom
};
item.Locations.push(fromLocation);
}
if (fromLocation != undefined) {
let batch = fromLocation.batch;
if (batch != undefined) {
that.addRecord(item.batch, label, balance, packageInfo)
addRecord(item.batch, labelValue, balance, packageInfoValue);
} else {
if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
if (jobContent.value.allowModifyBatch == "TRUE") {
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance,packageInfo);
let batch = createBatchInfo(labelValue, balance, packageInfoValue);
fromLocation.Batchs.unshift(batch);
}
})
});
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发货明细',
res => {
that.getfocus();
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => {
getfocus();
});
}
}
} else {
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发货明细',
res => {
that.getfocus();
}
)
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => {
getfocus();
});
}
} catch (e) {
that.showErrorMessage(e.stack,
res => {
that.getfocus();
}
)
showErrorMessage(e.stack, res => {
getfocus();
});
}
},
};
createBatchInfo(data, balance, packageInfo) {
const createBatchInfo = (data, balance, packageInfoValue) => {
let batch = {
batch: data.lot||data.batch,
batch: data.lot || data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(data.qty),
Records: [],
detail:{
fromLocationCode:this.fromLocationCode, //balance.locationCode
toLocationCode:this.toLocationCode,
itemCode:data.itemCode,
detail: {
fromLocationCode: fromLocationCode.value, //balance.locationCode
toLocationCode: toLocationCode.value,
itemCode: data.itemCode,
handleQty: Number(data.qty),
packingNumber:data.packingNumber,
packingNumber: data.packingNumber,
qty: 0,
uom:data.uom,
itemName:packageInfo.itemName,
itemDesc1:packageInfo.itemDesc1,
itemDesc2:packageInfo.itemDesc2,
singlePrice:balance.singlePrice,
amount:balance.amount
}
}
let record = this.creatRecord(data, balance, packageInfo);
uom: data.uom,
itemName: packageInfoValue.itemName,
itemDesc1: packageInfoValue.itemDesc1,
itemDesc2: packageInfoValue.itemDesc2,
singlePrice: balance.singlePrice,
amount: balance.amount
}
};
let record = creatRecord(data, balance, packageInfoValue);
batch.Records.push(record);
this.issueRecord.unshift(record)
issueRecord.value.unshift(record);
return batch;
},
};
creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty
balance.packUnit = packageInfo.packUnit
const creatRecord = (labelValue, balance, packageInfoValue) => {
balance.packQty = packageInfoValue.packQty;
balance.packUnit = packageInfoValue.packUnit;
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch,
// qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
itemCode: labelValue.itemCode,
packingNumber: labelValue.packingNumber,
parentPackingNumber: packageInfoValue.parentNumber,
batch: labelValue.batch,
qty: Number(balance.qty),
handleQty:0,
handleQty: 0,
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: this.toLocationCode,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty,
fromLocationCode:balance.locationCode,
}
toLocationCode: toLocationCode.value,
supplierCode: labelValue.supplierCode,
packUnit: packageInfoValue.packUnit,
packQty: packageInfoValue.packQty,
fromLocationCode: balance.locationCode
};
return record;
},
};
calcBatchHandleQty(batch,label,balance) {
this.dataContent.subList.forEach(item => {
if(item.itemCode == label.itemCode&&item.batch == label.batch){
item.handleQty = item.handleQty || 0
item.handleQty = calc.add(item.handleQty, label.qty);
const calcBatchHandleQty = (batch, labelValue, balance) => {
dataContent.value.subList.forEach(item => {
if (item.itemCode == labelValue.itemCode && item.batch == labelValue.batch) {
item.handleQty = item.handleQty || 0;
item.handleQty = calc.add(item.handleQty, labelValue.qty);
}
})
},
});
};
addRecord(batch, label, balance, packageInfo) {
var checkData = this.dataContent.subList.find(r => {
const addRecord = (batch, labelValue, balance, packageInfoValue) => {
let checkData = dataContent.value.subList.find(r => {
if (r.batch == balance.batch) {
return r;
}
})
});
if (checkData) {
checkData.scaned = true
this.calcBatchHandleQty(batch,label,balance);
this.getfocus();
checkData.scaned = true;
calcBatchHandleQty(batch, labelValue, balance);
getfocus();
} else {
let record = this.creatRecord(label, balance, packageInfo);
this.dataContent.subList.push(record);
this.calcBatchHandleQty(batch,label,balance);
this.getfocus();
this.$emit("afterScan");
let record = creatRecord(labelValue, balance, packageInfoValue);
dataContent.value.subList.push(record);
calcBatchHandleQty(batch, labelValue, balance);
getfocus();
emit("afterScan");
}
},
};
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
const getfocus = () => {
if (comscan.value != undefined) {
comscan.value.getfocus();
}
},
};
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
const losefocus = () => {
if (comscan.value != undefined) {
comscan.value.losefocus();
}
},
};
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
const expands = () => {
expand.value = !expand.value;
expendIcon.value = expand.value ? "arrow-down" : "arrow-up";
};
swipeClick(e, item, index) {
const swipeClick = (e, item, index) => {
if (e.content.text == "详情") {
this.detail(item)
detail(item);
} else if (e.content.text == "编辑") {
this.edit(item)
edit(item);
} else if (e.content.text == "移除") {
this.remove(item, index)
remove(item, index);
}
},
edit(item) {
this.editItem = item;
// item.balance.balanceQty = item.balance.qty;
};
const edit = (item) => {
editItem.value = item;
item.balance.balanceQty = item.balance.qty;
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty);
},
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
};
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(record, index) {
this.showQuestionMessage("确定移除扫描信息?",
res => {
const detail = (item) => {
showItem.value = item;
receiptHint.value.openScanPopup();
};
const remove = (record, index) => {
showQuestionMessage("确定移除扫描信息?", res => {
if (res) {
record.qty = 0;
this.issueRecord.splice(index, 1)
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode);
issueRecord.value.splice(index, 1);
let item = toLocation.value.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b
.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record
.packingNumber && r
.batch == record.batch);
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
})
});
}
this.$emit('updateData', item);
emit('updateData', item);
}
});
},
};
packGetFocus() {
this.$refs.comscan.getfocus();
},
packLoseFocus() {
this.$refs.comscan.losefocus();
},
showMessage(message, callback) {
const packGetFocus = () => {
comscan.value.getfocus();
};
const packLoseFocus = () => {
comscan.value.losefocus();
};
const showMessage = (message, callback) => {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showMessage(message, callback);
})
},
showErrorMessage(message, callback) {
packLoseFocus();
comMessage.value.showMessage(message, callback);
});
};
const showErrorMessage = (message, callback) => {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, callback);
packLoseFocus();
comMessage.value.showErrorMessage(message, callback);
});
};
})
},
showQuestionMessage(message, callback) {
const showQuestionMessage = (message, callback) => {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showQuestionMessage(message, callback);
})
},
confirm(val) {
this.editItem.qty = Number(val);
this.$emit('updateData', this.editItem)
},
cancle() {
this.closeScanPopup()
}
}
}
packLoseFocus();
comMessage.value.showQuestionMessage(message, callback);
});
};
const confirm = (val) => {
editItem.value.qty = Number(val);
emit('updateData', editItem.value);
};
const cancle = () => {
closeScanPopup();
};
</script>
<style lang="scss">
button {
button {
border: none;
}
}
button::after {
button::after {
border: none
}
}
.scroll-view {
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
padding: 10rpx;
}
}
</style>

591
src/pages/deliver/coms/comScanDeliverPackss.vue

@ -1,6 +1,6 @@
<template>
<view>
<uni-popup ref="popup" :maskClick='false'>
<u-popup v-model="show" mode="bottom" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
@ -72,15 +72,14 @@
v-if="expand&&issueRecord.length>0">
<view class="uni-flex u-col" v-for="(record,index) in issueRecord">
<view style="width: 100%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<u-swipe-action ref="swipeAction" :options="scanOptions"
@click="(...event)=>swipeClick(event,record,index)">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false"
:isShowStdPack="false"></balance>
u
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
@ -91,48 +90,42 @@
</view>
</view>
</view>
</uni-popup>
</u-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
</view>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
<script setup lang="ts">
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
import {
getDetailOption,
getDetailEditRemoveOption
} from '@/common/array.js';
} from '@/common/array.js';
import {
import {
getDirectoryItemArray,
} from '@/common/directory.js';
} from '@/common/directory.js';
import {
import {
calc
} from '@/common/calc.js';
import {
} from '@/common/calc.js';
import {
getWorkShopLineStation
} from '@/api/request2.js';
} from '@/api/request2.js';
import {
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
export default {
name: 'winScanPack',
components: {
winComScan,
balance,
balanceQtyEdit,
balanceSelect
},
props: {
} from '@/common/balance.js';
import {ref, onMounted} from 'vue';
const props = defineProps({
title: {
type: String,
default: ''
@ -140,113 +133,110 @@
headerType: {
type: String,
default: "HPQ,HMQ"
},
},
data() {
return {
dataContent: {},
jobContent: {},
expendIcon: 'arrow-down',
show: false,
scanList: [],
toLocation: null,
toLocationCode: '',
fromLocationList: [],
fromLocationCode: '',
fromLocation: null,
issueRecord: [], //
expand: true,
scanOptions: {},
editItem: {},
positionInfo: "请选择位置",
positionList: [],
defaultValueList: [],
label: {},
fromInventoryStatuses: [],
packageInfo: {}
}
},
created() {
},
watch: {},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
},
methods: {
openScanPopup(content, jobcontent) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
"-" + this.jobContent.subList[0].workStationCode
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus();
}, 500)
},
closeScanPopup() {
this.losefocus()
this.$refs.popup.close();
this.$emit("closeScan")
//
});
const emit = defineEmits(['closeScan','updateData'])
const dataContent = ref({});
const jobContent = ref({});
const expendIcon = ref('arrow-down');
const show = ref(false);
const scanList = ref([]);
const toLocation = ref(null);
const toLocationCode = ref('');
const fromLocationList = ref([]);
const fromLocationCode = ref('');
const fromLocation = ref(null);
const issueRecord = ref([]); //
const expand = ref(true);
const scanOptions = ref({});
const editItem = ref({});
const positionInfo = ref("请选择位置");
const positionList = ref([]);
const defaultValueList = ref([]);
const label = ref({});
const fromInventoryStatuses = ref([]);
const packageInfo = ref({});
const popup = ref(null);
const balanceSelect = ref(null);
const comscan = ref(null);
const comMessage = ref(null);
const receiptHint = ref(null);
const balanceQtyEdit = ref(null);
const detailOptions = ref('')
const toLocationCombox = ref('')
const showItem = ref('')
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption();
});
//
const openScanPopup = (content, jobcontent) => {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode +
"-" + jobContent.value.subList[0].workStationCode;
show.value = true
setTimeout(() => {
getfocus();
}, 500);
};
const closeScanPopup = () => {
losefocus();
show.value = false
emit('closeScan');
//
// Object.assign(this.$data, this.$options.data());
},
};
initData() {
let that = this;
that.fromLocationList = [];
if (that.dataContent != null) {
that.fromInventoryStatuses = getDirectoryItemArray(this.jobContent.outInventoryStatuses)
that.toLocation = that.dataContent[0];
that.toLocationCode = that.dataContent[0].toLocationCode;
that.fromLocationList = that.getFromLocationList();
const initData = () => {
fromLocationList.value = [];
if (dataContent.value != null) {
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses);
toLocation.value = dataContent.value[0];
toLocationCode.value = dataContent.value[0].toLocationCode;
fromLocationList.value = getFromLocationList();
}
},
};
showBalanceSelect(items, packageInfo) {
this.packageInfo = packageInfo;
this.$refs.balanceSelect.openPopup(items);
},
const showBalanceSelect = (items, packageInfo) => {
packageInfo.value = packageInfo;
balanceSelect.value.openPopup(items);
};
getFromLocationList() {
const getFromLocationList = () => {
let list = [];
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode);
let location = dataContent.value.find(r => r.toLocationCode == toLocationCode.value);
if (location != undefined) {
location.Items.forEach(item => {
item.Locations.forEach(f => {
list.push(f.fromLocationCode)
})
})
this.fromLocationCode = list[0];
list.push(f.fromLocationCode);
});
});
fromLocationCode.value = list[0];
return list;
} else {
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => {
this.toLocationCode = '';
comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => {
toLocationCode.value = '';
});
}
},
};
fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation)
// --
// if (location == undefined) {
this.fromLocationCode = fromlocation
// this.showErrorMessage('' + fromlocation + '')
// }
},
onScan(result) {
try {
let that = this;
const fromLocationUpdate = (fromlocation) => {
let location = fromLocationList.value.find(r => r == fromlocation);
fromLocationCode.value = fromlocation;
};
if (that.fromLocationCode == '') {
that.showErrorMessage('请选择来源库位', res => {
that.$refs.toLocationCombox.onFocus();
const onScan = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', res => {
toLocationCombox.value.onFocus();
});
return;
}
@ -254,85 +244,77 @@
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发货明细',
res => {
that.getfocus();
}
)
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => {
getfocus();
});
return;
} else {
//
uni.showLoading({
title: '加载中',
mask: true
})
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses,
balanceRes => {
});
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, balanceRes => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录',
res => {
this.packGetFocus();
})
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => {
packGetFocus();
});
} else if (balanceRes.data.list.length == 1) {
let balance = balanceRes.data.list[0];
this.afterGetBalance(result.label, balance, packageInfo);
afterGetBalance(result.label, balance, packageInfo);
} else {
this.label = result.label;
this.showBalanceSelect(balanceRes.data.list, packageInfo);
label.value = result.label;
showBalanceSelect(balanceRes.data.list, packageInfo);
}
} else {
this.showErrorMessage(balanceRes.message.message);
showErrorMessage(balanceRes.message.message);
}
uni.hideLoading();
});
}
} catch (e) {
this.showErrorMessage(e.stack)
showErrorMessage(e.stack);
uni.hideLoading();
}
},
selectBalanceItem(balance) {
this.afterGetBalance(balance, balance, this.packageInfo);
},
};
const selectBalanceItem = (balance) => {
afterGetBalance(balance, balance, packageInfo.value);
};
afterGetBalance(label, balance, packageInfo) {
let that = this;
const afterGetBalance = (label, balance, packageInfo) => {
try {
let itemCode = label.itemCode;
let packingCode = label.packingNumber;
let lot = label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
let fromLocation = item.Locations.find(l => l.fromLocationCode == fromLocationCode.value);
// --
if(!fromLocation){
if (!fromLocation) {
fromLocation = {
Batchs:[{
Recommends:[],
Batchs: [{
Recommends: [],
Records: [],
batch: label.batch,
detail:{
detail: {
...packageInfo,
fromLocationCode: balance.locationCode,
toLocationCode:this.toLocationCode
toLocationCode: toLocationCode.value
},
handleQty: 0,
packingNumber: null,
// packingNumber: label.packingNumber,
qty: label.qty,
uom: label.uom
}],
toLocationCode:this.toLocationCode,
toLocationCode: toLocationCode.value,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: label.qty,
uom: label.uom
}
item.Locations.push(fromLocation)
};
item.Locations.push(fromLocation);
}
if (fromLocation != undefined) {
let batch = fromLocation.Batchs.find(r => r.batch == lot);
@ -343,96 +325,87 @@
let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) {
//
if (batch.Recommends&&batch.Recommends.length > 0) {
//
if (batch.Recommends && batch.Recommends.length > 0) {
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
if (recommend != undefined) {
that.addRecord(batch, label, balance, packageInfo)
addRecord(batch, label, balance, packageInfo);
} else {
//
if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
that.addRecord(batch, label, balance, packageInfo);
//
if (jobContent.value.allowModifyPackingNumber == 'TRUE') {
addRecord(batch, label, balance, packageInfo);
} else {
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => {
that.getfocus();
}
)
showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', res => {
getfocus();
});
}
}
} else {
that.addRecord(batch, label, balance, packageInfo)
addRecord(batch, label, balance, packageInfo);
}
} else {
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱',
res => {
that.getfocus();
}
)
showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', res => {
getfocus();
});
}
} else {
if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
if (jobContent.value.allowModifyBatch == "TRUE") {
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance,packageInfo);
let batch = createBatchInfo(label, balance, packageInfo);
fromLocation.Batchs.unshift(batch);
}
})
});
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发货明细',
res => {
that.getfocus();
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => {
getfocus();
});
}
}
} else {
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发货明细',
res => {
that.getfocus();
}
)
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => {
getfocus();
});
}
} catch (e) {
that.showErrorMessage(e.stack,
res => {
that.getfocus();
}
)
showErrorMessage(e.stack, res => {
getfocus();
});
}
},
};
createBatchInfo(data, balance, packageInfo) {
const createBatchInfo = (data, balance, packageInfo) => {
let batch = {
batch: data.lot||data.batch,
batch: data.lot || data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(data.qty),
Records: [],
detail:{
fromLocationCode:this.fromLocationCode, //balance.locationCode
toLocationCode:this.toLocationCode,
itemCode:data.itemCode,
detail: {
fromLocationCode: fromLocationCode.value, //balance.locationCode
toLocationCode: toLocationCode.value,
itemCode: data.itemCode,
handleQty: Number(data.qty),
packingNumber:data.packingNumber,
packingNumber: data.packingNumber,
qty: 0,
uom:data.uom,
itemName:packageInfo.itemName,
itemDesc1:packageInfo.itemDesc1,
itemDesc2:packageInfo.itemDesc2,
singlePrice:balance.singlePrice,
amount:balance.amount
}
}
let record = this.creatRecord(data, balance, packageInfo);
uom: data.uom,
itemName: packageInfo.itemName,
itemDesc1: packageInfo.itemDesc1,
itemDesc2: packageInfo.itemDesc2,
singlePrice: balance.singlePrice,
amount: balance.amount
}
};
let record = creatRecord(data, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
issueRecord.value.unshift(record);
return batch;
},
};
creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty
balance.packUnit = packageInfo.packUnit
const creatRecord = (label, balance, packageInfo) => {
balance.packQty = packageInfo.packQty;
balance.packUnit = packageInfo.packUnit;
let record = {
scaned: true,
itemCode: label.itemCode,
@ -442,141 +415,141 @@
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: this.toLocationCode,
toLocationCode: toLocationCode.value,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty,
singlePrice:balance.singlePrice,
amount:balance.amount
}
singlePrice: balance.singlePrice,
amount: balance.amount
};
return record;
},
};
calcBatchHandleQty(batch) {
const calcBatchHandleQty = (batch) => {
let handleQty = 0;
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
handleQty = calc.add(handleQty, res.qty);
});
batch.handleQty = handleQty;
},
};
addRecord(batch, label, balance, packageInfo) {
let record = this.creatRecord(label, balance, packageInfo);
const addRecord = (batch, label, balance, packageInfo) => {
let record = creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
},
issueRecord.value.unshift(record);
calcBatchHandleQty(batch);
getfocus();
};
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
const getfocus = () => {
if (comscan.value != undefined) {
comscan.value.getfocus();
}
},
};
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
const losefocus = () => {
if (comscan.value != undefined) {
comscan.value.losefocus();
}
},
};
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
const expands = () => {
expand.value = !expand.value;
expendIcon.value = expand.value ? "arrow-down" : "arrow-up";
};
swipeClick(e, item, index) {
const swipeClick = (e, item, index) => {
if (e.content.text == "详情") {
this.detail(item)
detail(item);
} else if (e.content.text == "编辑") {
this.edit(item)
edit(item);
} else if (e.content.text == "移除") {
this.remove(item, index)
remove(item, index);
}
},
edit(item) {
this.editItem = item;
// item.balance.balanceQty = item.balance.qty;
};
const edit = (item) => {
editItem.value = item;
item.balance.balanceQty = item.balance.qty;
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty);
},
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
};
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(record, index) {
this.showQuestionMessage("确定移除扫描信息?",
res => {
const detail = (item) => {
showItem.value = item;
receiptHint.value.openScanPopup();
};
const remove = (record, index) => {
showQuestionMessage("确定移除扫描信息?", res => {
if (res) {
record.qty = 0;
this.issueRecord.splice(index, 1)
issueRecord.value.splice(index, 1);
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode);
let item = toLocation.value.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b
.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record
.packingNumber && r
.batch == record.batch);
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
})
});
}
this.$emit('updateData', item);
emit('updateData', item);
}
});
},
};
packGetFocus() {
this.$refs.comscan.getfocus();
},
packLoseFocus() {
this.$refs.comscan.losefocus();
},
showMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showMessage(message, callback);
})
},
showErrorMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, callback);
const packGetFocus = () => {
comscan.value.getfocus();
};
})
},
showQuestionMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showQuestionMessage(message, callback);
})
},
confirm(val) {
this.editItem.qty = Number(val);
this.$emit('updateData', this.editItem)
},
cancle() {
this.closeScanPopup()
}
}
}
const packLoseFocus = () => {
comscan.value.losefocus();
};
const showMessage = (message, callback) => {
setTimeout(() => {
packLoseFocus();
comMessage.value.showMessage(message, callback);
});
};
const showErrorMessage = (message, callback) => {
setTimeout(() => {
packLoseFocus();
comMessage.value.showErrorMessage(message, callback);
});
};
const showQuestionMessage = (message, callback) => {
setTimeout(() => {
packLoseFocus();
comMessage.value.showQuestionMessage(message, callback);
});
};
const confirm = (val) => {
editItem.value.qty = Number(val);
emit('updateData', editItem.value);
};
const cancle = () => {
closeScanPopup();
};
</script>
<style lang="scss">
button {
button {
border: none;
}
}
button::after {
button::after {
border: none
}
}
.scroll-view {
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
padding: 10rpx;
}
}
</style>

548
src/pages/deliver/job/deliverDetailBatch.vue

@ -9,17 +9,17 @@
<view class="cell_box uni-flex uni-row">
<view class="cell_info">
<view class="text_lightblue">发货类型</view>
<view>{{jobContent.deliverType}}</view>
<view>{{ jobContent.deliverType }}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">客户代码</view>
<view>{{jobContent.customerCode}}</view>
<view>{{ jobContent.customerCode }}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">目标库位</view>
<view>{{toLocationCode}}</view>
<view>{{ toLocationCode }}</view>
</view>
</view>
</view>
@ -53,271 +53,243 @@
</view>
</template>
<script>
import {
<script setup lang="ts">
import {
getDeliverDetail,
takeDeliverJob,
cancleTakeDeliverJob,
deliverJobSubmit
} from '@/api/request2.js';
} from '@/api/request2.js';
import {
import {
calc
} from '@/common/calc.js';
} from '@/common/calc.js';
import {
import {
goHome,
navigateBack,
getRemoveOption,
getCurrDateTime,
getPackingNumberAndBatch,
deepCopyData
} from '@/common/basic.js';
} from '@/common/basic.js';
import {
import {
getDataSource
} from '@/pages/issue/js/issue.js';
} from '@/pages/issue/js/issue.js';
import {
import {
getManagementPrecisions
} from '@/common/balance.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comDeliverDetailCardBatch,
comScanDeliverPackBatch,
jobTop
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
status: "",
toLocationCode: "",
jobStatus: ""
};
},
props: {
},
onLoad(option) {
} from '@/common/balance.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import {ref} from 'vue';
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app';
const id = ref('');
const jobContent = ref({});
const subList = ref([]);
const detailSource = ref([]);
const detailOptions = ref([]);
const scanOptions = ref([]);
const status = ref("");
const toLocationCode = ref("");
const jobStatus = ref("");
const dataContent = ref('')
const managementList = ref([]);
const comMessage = ref(null);
const scanPopup = ref(null);
const comScanIssuePack = ref(null);
import {useCountStore} from '@/store'
const store = useCountStore();
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title + '详情'
})
this.id = option.id;
if (this.id != undefined) {
//
});
id.value = option.id;
if (id.value != undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
receive(() => {
getDetail();
});
} else {
this.getDetail();
getDetail();
}
}
},
});
onNavigationBarButtonTap(e) {
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
},
});
//
onBackPress(e) {
//
onBackPress((e) => {
//
if (e.from == 'backbutton') {
if (this.jobStatus == "2") {
//
cancleTakeDeliverJob(this.id).then(res => {
if (jobStatus.value == "2") {
//
cancleTakeDeliverJob(id.value).then(() => {
uni.navigateBack();
}).catch(error => {
}).catch(() => {
uni.navigateBack();
})
});
} else {
uni.navigateBack();
}
return true;
}
});
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeDeliverJob(this.id).then(res => {
const receive = (callback) => {
if (id.value != null) {
takeDeliverJob(id.value).then(() => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}).catch((error) => {
showErrorMessage(error);
});
}
},
};
getDetail() {
var that = this;
const getDetail = () => {
uni.showLoading({
title: "加载中....",
mask: true
});
getDeliverDetail(that.id).then(res => {
getDeliverDetail(id.value).then((res) => {
uni.hideLoading();
if (res.data && res.data.subList.length > 0) {
that.jobContent = res.data;
that.jobStatus = res.data.status;
that.subList = res.data.subList;
that.detailSource = res.data;
that.toLocationCode = that.subList[0].toLocationCode
that.resizeCollapse();
jobContent.value = res.data;
jobStatus.value = res.data.status;
subList.value = res.data.subList;
detailSource.value = res.data;
toLocationCode.value = subList.value[0].toLocationCode;
resizeCollapse();
} else {
that.showMessage('未获取到详情');
showMessage('未获取到详情');
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
},
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const closeScan = () => {
resizeCollapse();
};
const resizeCollapse = () => {
//
};
submit() {
const submit = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource.subList[0].toLocationCode
this.detailSource.subList.forEach(item => {
itemCodes.push(item.itemCode)
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
//
const itemCodes = [];
const locationCode = detailSource.value.subList[0].toLocationCode;
detailSource.value.subList.forEach((item) => {
itemCodes.push(item.itemCode);
});
//
getManagementPrecisions(itemCodes, locationCode, (res) => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
managementList.value = res.list;
submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
showErrorMessage(res.message);
}
});
// //使
// if (locationCode == null) {
// this.submitJob();
// } else {
// //
// getManagementPrecisions(itemCodes, locationCode, res => {
// if (res.success) {
// this.managementList = res.list;
// this.submitJob();
// } else {
// uni.hideLoading();
// this.showErrorMessage(res.message);
// }
// });
// }
},
checkCount() {
let str = ""
var taskQty = 0;
var totalQty = 0;
this.detailSource.subList.forEach(item => {
item.taskQty = calc.add(taskQty, item.qty)
var hanleQty = item.qty ? item.qty : 0
totalQty = calc.add(totalQty, hanleQty)
//
item.totalQty = totalQty
})
//
this.detailSource.subList.forEach(detail => {
if (this.jobContent.allowPartialComplete == "FALSE") {
if (item.taskQty != item.totalQty) {
str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
};
const checkCount = () => {
let str = "";
let taskQty = 0;
let totalQty = 0;
detailSource.value.subList.forEach((item) => {
taskQty = calc.add(taskQty, item.qty);
const handleQty = item.qty ? item.qty : 0;
totalQty = calc.add(totalQty, handleQty);
//
item.totalQty = totalQty;
});
//
if (jobContent.value.allowPartialComplete == "FALSE") {
detailSource.value.subList.forEach((detail) => {
if (taskQty != totalQty) {
str += `物料号【${detail.itemCode}】任务数量【${taskQty}】与实际提交数量【${totalQty}】不一致\n`;
}
});
}
})
if (str) {
str = '不允许提交\n' + str
this.showErrorMessage(str)
str = '不允许提交\n' + str;
showErrorMessage(str);
}
return str ? false : true
},
return str ? false : true;
};
submitJob() {
var params = this.setParams()
const submitJob = () => {
const params = setParams();
console.log("提交参数", params);
if (params.subList.length == 0) {
uni.hideLoading()
this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
return
uni.hideLoading();
comMessage.value.showConfirmMessageModal('请扫描箱码');
return;
}
if (!this.checkCount()) {
uni.hideLoading()
if (!checkCount()) {
uni.hideLoading();
return;
}
deliverJobSubmit(params).then(res => {
uni.hideLoading()
deliverJobSubmit(params).then((res) => {
uni.hideLoading();
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data)
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data);
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
showErrorMessage("提交失败[" + res.msg + "]");
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.subList.forEach(r => {
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const setParams = () => {
const subList = [];
const createTime = getCurrDateTime();
const creator = store.id;
detailSource.value.subList.forEach((r) => {
if (r.scaned) {
let subItem = {
...r
}
subItem.recordList = []
let record = {};
const subItem = {...r};
subItem.recordList = [];
const record = {};
record.handleQty = r.handleQty;
record.toContainerNumber = r.ContainerNumber;
record.toInventoryStatus = r.inventoryStatus;
record.toLocationCode = subItem.toLocationCode;
record.supplierCode = r.supplierCode;
var info = getPackingNumberAndBatch(this.managementList, r.itemCode, r.packingNumber, r.batch);
const info = getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch);
record.toPackingNumber = info.packingNumber;
record.packingNumber = info.packingNumber;
record.fromPackingNumber = info.packingNumber;
@ -325,155 +297,141 @@
subItem.toPackingNumber = info.packingNumber;
subItem.packingNumber = info.packingNumber;
subItem.fromPackingNumber = info.packingNumber;
// //使
// if (this.toLocationCode == null) {
// record.toPackingNumber = r.packingNumber;
// record.toBatch = r.batch;
// } else {
// var info = getPackingNumberAndBatch(this.managementList, r.itemCode,r.packingNumber, r.batch);
// record.toPackingNumber = info.packingNumber;
// record.toBatch = info.batch;
// }
subItem.recordList.push(record);
subList.push(deepCopyData(subItem));
}
})
});
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
jobContent.value.subList = subList;
jobContent.value.createTime = createTime;
jobContent.value.creator = creator;
return jobContent.value;
};
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
const cancel = () => {
comMessage.value.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', (res) => {
if (res) {
that.clearInfo();
clearInfo();
}
});
},
};
clearInfo() {
this.dataContent.itemCodeList.forEach(res => {
const clearInfo = () => {
dataContent.value.itemCodeList.forEach((res) => {
if (res.recommendList != null) {
res.recommendList.forEach(res1 => {
res.recommendList.forEach((res1) => {
if (res1.locationCodeList != null) {
res1.locationCodeList.forEach(res2 => {
res1.locationCodeList.forEach((res2) => {
if (res2.packingCodeList != null) {
res2.packingCodeList.forEach(res3 => {
res2.packingCodeList.forEach((res3) => {
res3.itemCode = "";
res3.qty = 0;
})
});
}
})
});
}
})
});
}
});
};
})
},
updateData(record) {
},
const updateData = (record) => {
};
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus();
}
},
};
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
const showMessage = (message) => {
comMessage.value.showMessage(message, (res) => {
if (res) {
this.afterCloseMessage()
afterCloseMessage();
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
};
const showErrorMessage = (message) => {
comMessage.value.showErrorMessage(message, (res) => {
if (res) {
this.afterCloseMessage()
afterCloseMessage();
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
confirm(data) {
this.dataContent = data;
},
confirmResult(result) {
this.dataContent = result;
this.$forceUpdate();
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
}
};
};
const showScanMessage = (message) => {
comMessage.value.showScanMessage(message);
};
const showCommitSuccess = () => {
comMessage.value.showCommitSuccess();
};
const showCommitSuccessMessage = (hint) => {
comMessage.value.showSuccessMessage(hint, (res) => {
navigateBack(1);
});
};
const showRescanMessage = (message) => {
comMessage.value.showRescanMessage(message);
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const closeScanMessage = () => {
scanPopupGetFocus();
};
const confirm = (data) => {
dataContent.value = data;
};
const confirmResult = (result) => {
dataContent.value = result;
};
const openScanDetailPopup = () => {
const datacontent = {...detailSource.value}; //
comScanIssuePack.value.openScanPopup(datacontent, jobContent.value);
};
const closeScanPopup = () => {
// updateCommitBtn();
};
</script>
<style scoped lang="scss">
.uni-numbox__value {
.uni-numbox__value {
width: 40px;
}
}
button[disabled] {
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
}
}
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
</style>
Loading…
Cancel
Save