Browse Source

page/purchaseReturn 文件迁移 8/8-10/25

pull/1/head
test 4 months ago
parent
commit
21a6f3a18a
  1. 176
      src/pages/purchaseReturn/coms/comReturnDetailCard.vue
  2. 153
      src/pages/purchaseReturn/coms/comReturnDetailCardBatch.vue
  3. 2
      src/pages/purchaseReturn/coms/comReturnJobCard.vue
  4. 1033
      src/pages/purchaseReturn/coms/comScanReturnPack.vue
  5. 558
      src/pages/purchaseReturn/coms/comScanReturnPackBatch.vue
  6. 309
      src/pages/purchaseReturn/job/returnDetail.vue
  7. 111
      src/pages/purchaseReturn/js/return.js
  8. 5
      src/pages/purchaseReturn/record/returnRecord.vue
  9. 6
      src/pages/purchaseReturn/request/returnRequestCreate.vue

176
src/pages/purchaseReturn/coms/comReturnDetailCard.vue

@ -0,0 +1,176 @@
<template>
<view>
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view v-for="(item,index) in dataContent.Items">
<u-collapse ref="collapse">
<u-collapse-item :open="true">
<template v-slot:title>
<view class="split_line"></view>
<!-- 物品 -->
<u-swipe-action ref="swipeAction" @click="(...event)=>itemCoceClick(event,item,index)" :options="removeOptions">
<item-qty :dataContent="item" :isShowBalanceQty="false" :handleQty="item.handleQty"></item-qty>
</u-swipe-action>
<!-- <com-issue-request-info :workShopCode="dataContent.workShopCode" :dataContent="dataContent">
</com-issue-request-info> -->
</template>
<view v-for="(loacation,locatonIndex) in item.Locations">
<view>
<view class="uni-flex uni-row space-between">
<!-- 推荐库位 -->
<location :locationCode="loacation.fromLocationCode">
</location>
</view>
<view v-for="(batch,batchIndex) in loacation.Batchs">
<recommend-balance style='margin-left: 0rpx;' :detail="batch" :isShowLocation="false"
:isShowPack="batch.packingNumber!=null && batch.packingNumber!=''">
</recommend-balance>
<view class="uni-flex uni-row " v-if='batch.Records.length>0'>
<view class="center "
style=" width: 20px;background-color: #0CC2B6; color: #fff; margin-left: 40px;padding: 0px 2px;">
扫描
</view>
<view class="uni-flex uni-column scan_view" style="width: 100%;">
<view v-for="(record,recordIndex) in batch.Records">
<u-swipe-action ref="swipeAction"
:options="settingParam.allowModifyQty=='TRUE'?scanOptions:removeOptions"
@click="(...event)=>swipeClick(event,batch,record,recordIndex,batchIndex,loacation.Batchs,locatonIndex,item.Locations)">
<handle-balance :detail="record" :isShowLocation="false" :isShowBatch="false"></handle-balance>
</u-swipe-action>
</view>
</view>
</view>
</view>
</view>
</view>
</u-collapse-item>
</u-collapse>
</view>
</view>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage>
</template>
<script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalance from '@/mycomponents/balance/recommendBalance.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 balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
import {
getDetailOption,
getEditRemoveOption,
getRemoveOption
} from '@/common/array.js';
import { ref, onMounted, watch, nextTick } from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
},
settingParam: {
type: Object,
default: () => ({})
}
});
const option = ref([]);
const showItem = ref({});
const editItem = ref({});
const batchItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
const removeOptions = ref([]);
const collapse = ref(null);
const balanceQtyEdit = ref(null);
const receiptHint = ref(null);
const message = ref(null);
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getEditRemoveOption();
removeOptions.value = getRemoveOption();
});
const resizeCollapse = () => {
nextTick(() => {
if (collapse.value) {
collapse.value.forEach(r => {
r.childrens.forEach(i => {
i.init();
});
r.resize();
});
}
});
};
const swipeClick = (e, batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
if (e.content.text === "编辑") {
edit(batch, record);
} else if (e.content.text === "移除") {
remove(batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations);
}
};
const itemCoceClick = (e, item, index) => {
if (e.content.text === "移除") {
props.dataContent.Items.splice(index, 1);
emit('removeItemCode');
}
};
const edit = (batch, item) => {
editItem.value = item;
batchItem.value = batch;
item.balance.balanceQty = item.balance.qty;
if (balanceQtyEdit.value) {
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
}
};
const detail = (item) => {
showItem.value = item;
if (receiptHint.value) {
receiptHint.value.openScanPopup();
}
};
const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
if (message.value) {
message.value.showQuestionMessage("确定移除扫描信息?", res => {
if (res) {
batch.Records.splice(recordIndex, 1);
if (batch.Records.length === 0 && Batchs[batchIndex].isNewAdd) {
Batchs.splice(batchIndex, 1);
}
if (batch.Records.length === 0 && Locations[locatonIndex].isNewAdd) {
Locations.splice(locatonIndex, 1);
}
resizeCollapse();
emit('updateData', record);
}
});
}
};
const confirm = (val) => {
editItem.value.qty = val;
emit('updateData', editItem.value);
};
const emit = defineEmits(['removeItemCode', 'updateData']);
</script>
<style>
</style>

153
src/pages/purchaseReturn/coms/comReturnDetailCardBatch.vue

@ -0,0 +1,153 @@
<template>
<view>
<view v-for="(item,index) in dataContent.subList">
<view class="split_line"></view>
<!-- 物品 -->
<u-swipe-action ref="swipeAction" :class="item.scaned?'scan_view':''"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>itemCoceClick(event,item,index)" >
<item-qty :dataContent="item" :isShowBalanceQty="false" :handleQty="item.handleQty"></item-qty>
<location :locationCode="item.fromLocationCode">
</location>
<batch :batch="item.batch"></batch>
</u-swipe-action>
</view>
</view>
<!-- <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> -->
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage>
</template>
<script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalance from '@/mycomponents/balance/recommendBalance.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 balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
import batch from '@/mycomponents/balance/batch.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import {
getDetailOption,
getPurchaseReceiptOption,
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
import { ref, onMounted, watch, nextTick } from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
},
settingParam: {
type: Object,
default: () => ({})
},
isEdit: {
type: Boolean,
default: true
}
});
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();
});
const resizeCollapse = () => {
nextTick(() => {
if (collapse.value) {
collapse.value.forEach(r => {
r.childrens.forEach(i => {
i.init();
});
r.resize();
});
}
});
};
const swipeClick = (e, batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
if (e.content.text === "编辑") {
edit(batch, record);
} else if (e.content.text === "移除") {
remove(batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations);
}
};
const itemCoceClick = (e, item, index) => {
if (e.content.text === "编辑") {
edit(item);
} else if (e.content.text === "移除") {
props.dataContent.Items.splice(index, 1);
emit('removeItemCode');
}
};
const edit = (item) => {
editItem.value = item;
if (balanceQtyEdit.value) {
balanceQtyEdit.value.openEditPopup(item);
}
};
const detail = (item) => {
showItem.value = item;
if (receiptHint.value) {
receiptHint.value.openScanPopup();
}
};
const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
if (message.value) {
message.value.showQuestionMessage("确定移除扫描信息?", res => {
if (res) {
batch.Records.splice(recordIndex, 1);
if (batch.Records.length === 0 && Batchs[batchIndex].isNewAdd) {
Batchs.splice(batchIndex, 1);
}
if (batch.Records.length === 0 && Locations[locatonIndex].isNewAdd) {
Locations.splice(locatonIndex, 1);
}
resizeCollapse();
emit('updateData', record);
}
});
}
};
const confirm = (val) => {
editItem.value.handleQty = Number(val);
emit('updateData', editItem.value);
};
const emit = defineEmits(['removeItemCode', 'updateData']);
</script>
<style>
</style>

2
src/pages/purchaseReturn/coms/comReturnJobCard.vue

@ -1,6 +1,6 @@
<template>
<job-com-main-card :dataContent="dataContent">
<jobComMainDetailCard :dataContent="dataContent"></jobComMainDetailCard>
<jobComMainDetailCard :dataContent="dataContent" :isShowPack="false" :isShowBatch="false"></jobComMainDetailCard>
</job-com-main-card>
</template>

1033
src/pages/purchaseReturn/coms/comScanReturnPack.vue

File diff suppressed because it is too large

558
src/pages/purchaseReturn/coms/comScanReturnPackBatch.vue

@ -0,0 +1,558 @@
<template>
<view>
<u-popup ref="popup" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描箱码
</view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image>
</view>
</view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
padding:20rpx;
border-radius: 8rpx;">
<view class="uni-center">
位置 :
</view>
<view class="" style="width: 75%;padding: 0rpx">
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 15rpx;font-size: 30rpx;">
{{positionInfo}}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList"
@confirm="confirmSelect"></u-select>
</view>
</view>
</view>
<u-line class='line_color'></u-line> -->
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
margin-top: 8rpx;
border-radius: 8rpx;">
<view class="uni-center" style="width: 25%; ">
来源库位
</view>
<view v-if='allowModifyLocation' class="" style="width: 75%; padding: 8rpx;">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox>
</view>
<view v-else>
<text style="padding: 5px">
{{fromLocationCode}}
</text>
</view>
</view> -->
<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 8rpx;
height: 30px;">
<view class="uni-center" style="width: 25%;font-size: 36rpx; ">
来源库位
</view>
<!-- style="width: 75%;padding: 8rpx" -->
<view class="">
<!-- <input v-model="fromLocationCode" placeholder="请扫描来源库位" :focus="locationOnFocus"
placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> -->
<view v-if='allowModifyLocation'>
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位"
@confirm="fromLocationUpdate"
style='height: 30rpx;border:1px solid #fff ;'></uni-combox>
</view>
<view v-else>
<text style="padding: 5px;font-size: 36rpx;">
{{ fromLocationCode }}
</text>
</view>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
:headerType="headerType" :isShowHistory="false">
</win-com-scan>
<view style="width: 100%;" v-if="false">
<view style="width: 100%;" v-if="issueRecord.length>0">
<view class="uni-flex uni-row space-between u-col-center">
<view class="" style="padding: 10rpx;">
历史记录
</view>
<view class="" style="padding-right: 10rpx;">
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon>
</view>
</view>
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'>
</u-line>
<scroll-view scroll-y="true" class="scroll-view"
v-if="expand&&issueRecord.length>0">
<view class="uni-flex u-col" v-for="(record,index) in issueRecord">
<view style="width: 100%;">
<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>
</u-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
</view>
</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 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 {
getDetailOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getDirectoryItemArray,
} from '@/common/directory.js';
import {
calc
} from '@/common/calc.js';
import {
getWorkShopLineStation
} from '@/api/request2.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
import {ref, reactive, onMounted, watch} from 'vue';
const props = defineProps({
title: {
type: String,
default: ''
},
headerType: {
type: String,
default: "HPQ,HMQ"
},
allowModifyLocation: {
type: Boolean,
default: false
}
});
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 detailOptions = ref([]);
const popup = ref(null);
const balanceSelect = ref(null);
const comscan = ref(null);
const receiptHint = ref(null);
const comMessage = ref(null);
const toLocationCombox = ref(null)
const balanceQtyEdit = ref(null)
const showItem = ref(null)
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;
popup.value.open('bottom');
setTimeout(() => {
getfocus();
}, 500);
};
const closeScanPopup = () => {
losefocus();
popup.value.close();
emit("closeScan");
//
// Object.assign(dataContent, {});
};
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 = () => {
const list = [];
dataContent.value.subList.forEach(item => {
list.push(item.fromLocationCode);
});
fromLocationCode.value = list[0];
return list;
};
const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find(r => r == fromlocation);
// 退--
// if (location == undefined) {
fromLocationCode.value = fromlocation;
// this.showErrorMessage('退' + fromlocation + '')
// }
};
const onScan = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', () => {
toLocationCombox.value.onFocus();
});
return;
}
const packageInfoValue = result.package;
const itemCode = result.label.itemCode;
const packingCode = result.label.packingNumber;
const lot = result.label.batch;
const item = toLocation.value.find(r => r.itemCode == itemCode);
if (item == undefined) {
showErrorMessage('未查找到物料【' + itemCode + '】的退货明细', () => {
getfocus();
});
return;
} else {
uni.showLoading({
title: '加载中',
mask: true
});
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value,
(balanceRes) => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', () => {
packGetFocus();
});
} else if (balanceRes.data.list.length == 1) {
console.log(2222);
const balance = balanceRes.data.list[0];
afterGetBalance(result.label, balance, packageInfoValue);
} else {
label.value = result.label;
showBalanceSelect(balanceRes.data.list, packageInfoValue);
}
} else {
showErrorMessage(balanceRes.message.message);
}
uni.hideLoading();
});
}
} catch (e) {
showErrorMessage(e.stack);
uni.hideLoading();
}
};
const selectBalanceItem = (balance) => {
afterGetBalance(balance, balance, packageInfo.value);
};
const afterGetBalance = (label, balance, packageInfoValue) => {
try {
const itemCode = label.itemCode;
const packingCode = label.packingNumber;
const lot = label.batch;
const item = toLocation.value.find(r => r.itemCode == itemCode);
item.scaned = true;
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value);
// 退--
if (!fromLocation) {
fromLocation = {
Batchs: [{
Recommends: [],
Records: [],
batch: label.batch,
detail: {
...packageInfoValue,
fromLocationCode: balance.locationCode,
toLocationCode: toLocationCode.value
},
handleQty: 0,
packingNumber: null,
qty: label.qty,
uom: label.uom
}],
toLocationCode: toLocationCode.value,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: label.qty,
uom: label.uom
};
item.Locations.push(fromLocation);
}
if (fromLocation != undefined) {
const batch = fromLocation.Batchs.find(b => b.batch == label.batch);
if (batch != undefined) {
addRecord(batch, label, balance, packageInfoValue);
} else {
if (jobContent.value.allowModifyBatch == "TRUE") {
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot +
'】的退货明细,是否要继续退货?', (res) => {
if (res) {
const batch = createBatchInfo(label, balance, packageInfoValue);
fromLocation.Batchs.unshift(batch);
}
});
} else {
showErrorMessage("未查找到\n物料【" + itemCode + "】批次【" + lot + "】的退货明细", () => {
getfocus();
});
}
}
} else {
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的退货明细', () => {
getfocus();
});
}
} catch (e) {
showErrorMessage(e.stack, () => {
getfocus();
});
}
};
const createBatchInfo = (data, balance, packageInfoValue) => {
const batch = {
batch: data.lot || data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(data.qty),
Records: [],
detail: {
fromLocationCode: fromLocationCode.value, //balance.locationCode
toLocationCode: toLocationCode.value,
itemCode: data.itemCode,
handleQty: Number(data.qty),
packingNumber: data.packingNumber,
qty: 0,
uom: data.uom,
itemName: packageInfoValue.itemName,
itemDesc1: packageInfoValue.itemDesc1,
itemDesc2: packageInfoValue.itemDesc2,
singlePrice: balance.singlePrice,
amount: balance.amount
}
};
const record = creatRecord(data, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record);
return batch;
};
const creatRecord = (label, balance, packageInfoValue) => {
balance.packQty = packageInfoValue.packQty;
balance.packUnit = packageInfoValue.packUnit;
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
batch: label.batch,
qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: toLocationCode.value,
supplierCode: label.supplierCode,
packUnit: packageInfoValue.packUnit,
packQty: packageInfoValue.packQty,
singlePrice: balance.singlePrice,
amount: balance.amount
};
return record;
};
const calcBatchHandleQty = (batch, label, balance) => {
dataContent.value.subList.forEach(item => {
if (item.itemCode == balance.itemCode && item.batch == batch) {
item.handleQty = item.handleQty || 0;
item.handleQty = item.handleQty + label.qty;
}
});
};
const addRecord = (batch, label, balance, packageInfoValue) => {
calcBatchHandleQty(batch, label, balance);
getfocus();
};
const getfocus = () => {
if (comscan.value != undefined) {
comscan.value.getfocus();
}
};
const losefocus = () => {
if (comscan.value != undefined) {
comscan.value.losefocus();
}
};
const expands = () => {
expand.value = !expand.value;
expendIcon.value = expand.value ? "arrow-down" : "arrow-up";
};
const swipeClick = (e, item, index) => {
if (e.content.text == "详情") {
detail(item);
} else if (e.content.text == "编辑") {
edit(item);
} else if (e.content.text == "移除") {
remove(item, index);
}
};
const edit = (item) => {
editItem.value = item;
item.balance.balanceQty = item.balance.qty;
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
};
const detail = (item) => {
showItem.value = item;
receiptHint.value.openScanPopup();
};
const remove = (record, index) => {
showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
record.qty = 0;
issueRecord.value.splice(index, 1);
const item = toLocation.value.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) {
item.Locations.forEach(l => {
const batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch);
const rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
});
}
emit('updateData', item);
}
});
};
const packGetFocus = () => {
comscan.value.getfocus();
};
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 {
border: none;
}
button::after {
border: none
}
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
padding: 10rpx;
}
</style>

309
src/pages/purchaseReturn/job/returnDetail.vue

@ -5,17 +5,33 @@
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<view class="header_item"> 申请单号{{ jobContent.requestNumber }} </view>
<view class="cen_card" style="padding: 5rpx;">
<view class="cell_box uni-flex uni-row">
<view class="cell_info">
<view class="text_lightblue">订单号</view>
<view>{{poNumber}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">来源库位</view>
<view>{{fromLocationCode}}</view>
</view>
</view>
</view>
<view class="split_line"></view>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-detail-card :dataContent="item" :settingParam="jobContent" @remove="updateData" :queryBalance="false" @updateData="updateData" @openDetail="openDetail"> </com-detail-card>
</view>
<view v-for="(toLocation, index) in detailSource" >
<comReturnDetailCard
ref='comIssueDetailCard'
:dataContent="toLocation"
:settingParam="jobContent"
@updateData='updateData'>
</comReturnDetailCard>
<view class="split_line"></view>
</view>
</scroll-view>
</view>
@ -24,12 +40,13 @@
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%">
<view class=""> </view>
<button class="btn_single_commit" style="flex: 1" hover-class="btn_commit_after" @click="commit">提交</button>
<button class="btn_single_commit" style="flex: 1" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
<win-scan-button @goScan="openScanPopup"></win-scan-button>
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :queryBalance="false"></win-scan-pack-and-location>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanReturnPack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanReturnPack>
<return-detail-info-popup ref="jobDetailPopup"></return-detail-info-popup>
<com-message ref="comMessageRef" />
</view>
@ -43,15 +60,18 @@ import { getPurchasereturnJobDetail, purchaseReturnJobsubmit, cancleTakePurchase
import { goHome, getCurrDateTime, getPackingNumberAndBatch, navigateBack } from '@/common/basic.js'
import { getInventoryStatusName } from '@/common/directory.js'
import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js'
import { createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js'
import { getManagementPrecisions } from '@/common/balance.js'
import { getDataSource } from '@/pages/issue/js/issue.js';
import { calc } from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue'
import comDetailCard from '@/mycomponents/detail/comDetailCard.vue'
import returnDetailInfoPopup from '@/pages/purchaseReturn/coms/returnDetailInfoPopup.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import comReturnDetailCard from '@/pages/purchaseReturn/coms/comReturnDetailCard.vue'
import comReturnDetailCardBatch from '@/pages/purchaseReturn/coms/comReturnDetailCardBatch.vue'
import comScanReturnPack from '@/pages/purchaseReturn/coms/comScanReturnPack.vue'
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -73,6 +93,11 @@ const scanPopup = ref()
const comScanLocation = ref()
const comMessageRef = ref()
const jobDetailPopup = ref()
const poNumber = ref('')
const fromLocationCode = ref('')
const managementList = ref('')
const comIssueDetailCard = ref()
const comScanIssuePack = ref(null)
onLoad((option) => {
uni.setNavigationBarTitle({
title: `${option.title}详情`
@ -145,7 +170,9 @@ const getDetail = () => {
jobStatus.value = res.data.status
subList.value = res.data.subList
toLocationCode.value = jobContent.value.toLocationCode
detailSource.value = getDataSource(subList.value)
detailSource.value = getDataSource(detailSource.value,subList.value);
fromLocationCode.value = subList.value[0].fromLocationCode
poNumber.value = subList.value[0].poNumber
} else {
showMessage('列表数据为0')
}
@ -155,9 +182,16 @@ const getDetail = () => {
showErrorMessage(error)
})
}
const calcHandleQty1 = () => {
calcHandleQty(detailSource.value)
continueScan()
const closeScan = ()=> {
resizeCollapse();
}
const resizeCollapse = ()=> {
nextTick(r => {
comIssueDetailCard.value.forEach(r => {
r.resizeCollapse();
})
});
}
const calcScanCount = (closeScan) => {
const items = subList.value.filter((r) => {
@ -179,48 +213,108 @@ const continueScan = () => {
scanPopupGetFocus()
}
}
const updateData = () => {
calcHandleQty1()
}
const getScanResult = (result) => {
try {
const { packingNumber } = result.label
const { batch } = result.label
const { qty } = result.label
const { itemCode } = result.label
let itemDetail
const detail = detailSource.value.find((r) => r.itemCode == itemCode)
if (detail == undefined) {
showMessage(`物料号【${itemCode}】不在列表中`)
} else {
//
itemDetail = detail.subList.find((r) => {
return r.packingNumber == packingNumber && r.batch == batch && r.fromLocationCode == result.fromLocationCode
const updateData = (record) => {
if(record){
let requestLocation = detailSource.value.find(r => r.toLocationCode == record.toLocationCode);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch ==
record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
}
})
// const balanceStatus = getInventoryStatusName(result.balance.inventoryStatus)
//
if (itemDetail == undefined) {
showErrorMessage(`箱码【${packingNumber}】<br>批次【${batch}】<br>库位【${result.fromLocationCode}】<br>状态【${balanceStatus}】<br>未找到明细`)
return
}
if (itemDetail.scaned) {
showErrorMessage(`箱码【${packingNumber}】<br>批次【${batch}】<br>库位【${result.fromLocationCode}】已经扫描`)
return
item.handleQty=itemHandleQty;
}
}else {
//
detailSource.value.forEach(detail => {
detail.Items.forEach(item => {
let taskQty = 0;
item.taskQty = calc.add(taskQty,item.qty)
let totalQty = 0;
item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => {
batch.Records.forEach(record => {
if(record){
let handleQty =record.qty?record.qty:0
totalQty = calc.add(totalQty,handleQty)
}
})
})
})
//
item.handleQty =totalQty
})
})
}
}
const submit = ()=>{
uni.showLoading({
title: "提交中....",
mask: true
});
let params = setParams()
console.log("提交参数", JSON.stringify(params));
if (params.subList.length == 0) {
uni.hideLoading()
comMessageRef.value.showConfirmMessageModal('请扫描箱码')
return
}
if(!checkCount()){
uni.hideLoading()
return ;
}
submitJob()
}
const checkCount = ()=>{
let str=""
let commitHint=""
//
detailSource.value.forEach(detail=>{
detail.Items.forEach(item=>{
if(jobContent.value.allowPartialComplete=="FALSE"){
if(item.taskQty!=item.handleQty){
str += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.taskQty}】不一致\n`
}
}else {
//
if(item.taskQty!=item.handleQty){
commitHint += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.taskQty}】不一致,是否提交?\n`
}
}
itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty)
itemDetail.toInventoryStatus = itemDetail.inventoryStatus
itemDetail.balance = {
packQty: Number(result.package.packQty),
uom: result.package.uom
})
})
if(str){
str = '不允许提交\n' + str
showErrorMessage(str)
}
if(commitHint){
showQuestionMessage(commitHint,res=>{
if(res){
submitJob()
}
calcHandleQty1()
}
scanPopupGetFocus()
} catch (e) {
showErrorMessage(e.message)
})
}
if(str||commitHint){
return false
}else {
return true
}
}
const commit = () => {
scanCount.value = getScanCount(subList.value)
if (scanCount.value == 0) {
@ -237,7 +331,7 @@ const commit = () => {
//
submitJob()
} else {
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => {
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交\n' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => {
if (res) {
openScanPopup()
}
@ -247,68 +341,83 @@ const commit = () => {
}
const submitJob = () => {
proxy.$modal.loading('提交中...')
const params = setParams()
purchaseReturnJobsubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(res.data)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
})
.catch((error) => {
uni.hideLoading()
showErrorMessage(error)
let itemCodes = []
detailSource.value.forEach(item => {
item.Items.forEach(cur=>{
itemCodes.push(cur.itemCode)
})
})
//
getManagementPrecisions(itemCodes, fromLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
const params = setParams()
purchaseReturnJobsubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(res.data)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
})
.catch((error) => {
uni.hideLoading()
showErrorMessage(error)
})
}
})
}
const setParams = () => {
const subList = []
const creator = store.id
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
if (detail.scaned) {
detail.toPackingNumber = detail.packingNumber
detail.toContainerNumber = detail.containerNumber
detail.toBatch = detail.batch
detailSource.value.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.handleQty =batch.handleQty
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.toContainerNumber = r.ContainerNumber;
record.inventoryStatus = r.inventoryStatus;
record.toLocationCode = subItem.toLocationCode;
record.supplierCode = r.supplierCode;
detail.toLocationCode = detail.toLocationCode
subList.push(detail)
}
//使
let info = getPackingNumberAndBatch(managementList.value, detail.itemCode,record.packingNumber, detail.batch);
record.toPackingNumber = info.packingNumber;
record.packingNumber = info.packingNumber;
record.fromPackingNumber = info.packingNumber;
record.fromBatch = r.batch;
record.fromPackingNumber = r.packingNumber
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
jobContent.value.subList = subList
jobContent.value.createTime = createTime;
jobContent.value.creator = creator
return jobContent.value
}
const openScanPopup = () => {
let fromlocationCode = ''
const fromlocationList = []
for (let i = 0; i < detailSource.value.length; i++) {
const item = detailSource.value[i]
item.subList.forEach((l) => {
//
const location = fromlocationList.find((res) => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode)
}
//
if (fromlocationCode == '') {
if (!l.scaned) {
fromlocationCode = l.fromLocationCode
}
}
})
}
scanPopup.value.openScanPopupForJob(fromlocationCode, fromlocationList, jobContent.value)
comScanIssuePack.value.openScanPopup(detailSource.value, jobContent.value);
}
const closeScanPopup = () => {
scanPopup.value.closeScanPopup()
}
const scanPopupGetFocus = () => {
scanPopup.value.packGetFocus()
if(scanPopup.value){
scanPopup.value.packGetFocus()
}
}
const scanPopupLoseFocus = () => {
scanPopup.value.packLoseFocus()
@ -317,6 +426,7 @@ const openDetail = (item) => {
jobDetailPopup.value.openPopup(item)
}
const showMessage = (message) => {
scanPopupLoseFocus()
setTimeout((r) => {
comMessageRef.value.showMessage(message, (res) => {
if (res) {
@ -326,6 +436,7 @@ const showMessage = (message) => {
})
}
const showErrorMessage = (message) => {
scanPopupLoseFocus()
setTimeout((r) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
@ -335,7 +446,7 @@ const showErrorMessage = (message) => {
})
}
const showQuestionMessage = (message, callback) => {
setTimeout((r) => {
setTimeout(() => {
scanPopupLoseFocus()
comMessageRef.value.showQuestionMessage(message, (res) => {
if (res) {
@ -345,8 +456,8 @@ const showQuestionMessage = (message, callback) => {
})
}
const showCommitSuccessMessage = (number) => {
setTimeout((r) => {
comMessageRef.value.showSuccessMessage(`提交成功<br>生成退货记录:${number}`, (res) => {
setTimeout(() => {
comMessageRef.value.showSuccessMessage(`提交成功\n生成退货记录:${number}`, (res) => {
if (res) {
navigateBack(1)
}

111
src/pages/purchaseReturn/js/return.js

@ -0,0 +1,111 @@
import {
calc
} from '@/common/calc.js';
export function getDataSource(list, subList) {
for (var i = 0; i < subList.length; i++) {
let detail = subList[i];
var location = list.find(r =>
r.toLocationCode == detail.toLocationCode)
if (location == undefined) {
location = {
toLocationCode: detail.toLocationCode,
productionLineCode: detail.productionLineCode,
workStationCode: detail.workStationCode,
Items: []
}
list.push(location);
}
createDetailInfo(location, detail);
}
return list;
}
//树形结构:需求库位 -> 物料Items -> 库位 Locations-> 批次Batchs -> 记录Records
export function createDetailInfo(location, detail) {
var item = location.Items.find(r =>
r.itemCode == detail.itemCode)
if (item == undefined) {
item = createItemInfo(detail);
location.Items.push(item)
} else {
item.qty = calc.add(item.qty,detail.qty)
//在物料下查找库位
let location = item.Locations.find(r => r.fromLocationCode == detail.fromLocationCode);
if (location == undefined) {
location = createLocationInfo(detail);
item.Locations.push(location);
} else {
//在库位下查找批次
let batch = location.Batchs.find(r => r.batch == detail.batch);
if (batch == undefined) {
let batch = createBatchInfo(detail);
location.Batchs.push(batch);
} else {
if (detail.packingNumber != "" && detail.packingNumber != null) {
batch.Recommends.push(detail);
}
}
}
}
}
export function createItemInfo(detail) {
let item = {
itemCode: detail.itemCode,
itemName: detail.itemName,
onTheWayLocationCode:detail.onTheWayLocationCode,
productionLineCode: detail.productionLineCode,
workStationCode: detail.workStationCode,
packQty: detail.packQty,
packUnit: detail.packUnit,
qty: detail.qty,
uom: detail.uom,
handleQty: 0,
Locations: []
}
let location = createLocationInfo(detail);
item.Locations.push(location);
return item;
}
export function createLocationInfo(detail) {
let location = {
fromLocationCode: detail.fromLocationCode,
qty: detail.qty,
uom: detail.uom,
handleQty: 0,
Batchs: []
}
let batch = createBatchInfo(detail);
location.Batchs.push(batch);
return location;
}
export function createBatchInfo(detail) {
let batch = {
detail: detail,
batch: detail.batch,
packingNumber: detail.packingNumber,
qty: detail.qty,
uom: detail.uom,
handleQty: 0,
Recommends: [],
Records: [],
}
//推荐到了箱码和批次
if (detail.packingNumber != "" && detail.packingNumber != null) {
batch.Recommends.push(detail);
}
return batch;
}
export function createRecordInfo(detail) {
var record = {}
detail.scaned = true;
// let record = JSON.parse(JSON.stringify(detail));
//克隆对象,深度克隆,防止双向绑定同一个变量
Object.assign(record, detail)
record.toLocationCode = this.toLocationCode;
return record;
}

5
src/pages/purchaseReturn/record/returnRecord.vue

@ -155,10 +155,11 @@ const getDataSource = (result) => {
const newDetail = createDetailInfo(balance, pack)
item.subList.push(newDetail)
} else {
showErrorMessage(`箱码[${balance.packingNumber}]已经在列表中`)
showErrorMessage(`箱码[${balance.packingNumber}]重复扫描`)
}
}
calcHandleQty(detailSource.value)
scanPopupGetFocus()
}
const updateData = () => {
calcHandleQty(detailSource.value)
@ -195,7 +196,7 @@ const commit = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成采购退货记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成采购退货记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

6
src/pages/purchaseReturn/request/returnRequestCreate.vue

@ -116,7 +116,7 @@ const getDataSource = (result) => {
detailSource.value.push(itemInfo)
} else {
const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus && r.scaned == true) {
if (r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus && r.scaned == true) {
return r
}
})
@ -125,7 +125,7 @@ const getDataSource = (result) => {
const newDetail = createDetailInfo(balance, pack)
item.subList.push(newDetail)
} else {
showErrorMessage(`箱码[${balance.packingNumber}]已经在列表中`)
showErrorMessage(`批次[${balance.batch}]重复扫描`)
}
}
calcHandleQty(detailSource.value)
@ -160,7 +160,7 @@ const commit = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成采购退货申请<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成采购退货申请\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

Loading…
Cancel
Save