Browse Source

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

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

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

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

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

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

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

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