Browse Source

page/issue/coms 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
3cb5df117e
  1. 28
      src/pages/issue/coms/comIssueDetailCard.vue
  2. 150
      src/pages/issue/coms/comIssueDetailCardBatch.vue
  3. 4
      src/pages/issue/coms/comIssueJobCard.vue
  4. 229
      src/pages/issue/coms/comScanIssuePack.vue
  5. 732
      src/pages/issue/coms/comScanIssuePack0816.vue

28
src/pages/issue/coms/comIssueDetailCard.vue

@ -12,18 +12,21 @@
</view>
</template>
<view v-for="(loacation, index) in item.Locations" :key="index">
<view v-for="(loacation, locatonIndex) in item.Locations" :key="locatonIndex">
<view>
<view class="uni-flex uni-row space-between">
<!-- 推荐库位 -->
<location :locationCode="loacation.fromLocationCode"> </location>
</view>
<view v-for="(batch, index1) in loacation.Batchs" :key="index1">
<view v-for="(batch, batchIndex) in loacation.Batchs" :key="batchIndex">
<recommend-balance style="margin-left: 0rpx" :detail="batch" :isShowLocation="false" :isShowPack="batch.packingNumber != null && batch.packingNumber != ''"> </recommend-balance>
<view class="" v-if="batch.Records.length > 0">
<view class="center" style="width: 20px; background-color: #0cc2b6; color: #fff; padding: 0px 2px; font-size: 24rpx"> 扫描 </view>
<view class="uni-flex uni-column scan_view" style="flex: 1">
<u-swipe-action :show="record.show" :index="key" v-for="(record, key) in batch.Records" :key="key" :options="scanOptions" bg-color="rgba(255,255,255,0)" @click="(...event) => swipeClick(event, batch, record)" style="width: 100%">
<u-swipe-action :show="record.show" :index="key" v-for="(record, recordIndex) in batch.Records"
:key="recordIndex" :options="settingParam.allowModifyQty=='TRUE'?scanOptions:removeOptions"
bg-color="rgba(255,255,255,0)"
@click="swipeClick($event,batch,record,recordIndex,batchIndex,loacation.Batchs,locatonIndex,item.Locations)" style="width: 100%">
<handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null"> </handle-balance>
</u-swipe-action>
</view>
@ -102,12 +105,11 @@ const resizeCollapse = () => {
})
})
}
const swipeClick = (params, batch, record) => {
const { text } = scanOptions.value[params[1]]
if (text == '编辑') {
const swipeClick = (e, batch, record,recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
if (e.content.text == '编辑') {
edit(batch, record)
} else if (text == '移除') {
remove(batch, record, params[0])
} else if (e.content.text == '移除') {
remove(batch, record, recordIndex,batchIndex,Batchs,locatonIndex,Locations)
}
}
const itemCoceClick = (params, item) => {
@ -124,10 +126,16 @@ const edit = (batch, item) => {
balanceQtyEditRef.value.openEditPopup(item.balance, item.qty)
}
const remove = (batch, record, index) => {
const remove = (batch, record, recordIndex,batchIndex,Batchs,locatonIndex,Locations) => {
comMessageRef.value.showQuestionMessage('确定移除扫描信息?', (res) => {
if (res) {
batch.Records.splice(index, 1)
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)
}

150
src/pages/issue/coms/comIssueDetailCardBatch.vue

@ -0,0 +1,150 @@
<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" :options="removeOptions"
@click="(...event)=>itemCoceClick(event,item,index)">
<item-qty :dataContent="item" :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 v-if="locatonIndex ==0">
<view class="uni-flex uni-row space-between">
<!-- 推荐库位 -->
<location :locationCode="loacation.fromLocationCode">
</location>
</view>
<view v-for="(batch,batchIndex) in loacation.Batchs">
<batch :batch="batch.detail.batch" v-if="batchIndex ==0"></batch>
</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 lang="ts" setup>
import {ref, onMounted, nextTick} from 'vue';
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 {getDetailOption, getEditRemoveOption, getRemoveOption} from '@/common/array.js';
const emit = defineEmits(['updateData', "removeItemCode"])
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 dataContent = ref({});
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(() => {
const collapseRefs = ref(null);
collapseRefs.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 === "移除") {
dataContent.value.Items.splice(index, 1);
emit('removeItemCode');
}
};
const edit = (batch, item) => {
editItem.value = item;
batchItem.value = batch;
item.balance.balanceQty = item.balance.qty;
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
};
const detail = (item) => {
showItem.value = item;
receiptHint.value.openScanPopup();
};
const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => {
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);
};
</script>
<style>
</style>

4
src/pages/issue/coms/comIssueJobCard.vue

@ -9,13 +9,15 @@
</view>
</view>
</view>
<view class='split_line' v-show="dataContent.acceptUserName"></view>
<jobAccept :dataContent="dataContent" v-show="dataContent.acceptUserName"></jobAccept>
</job-com-main-card>
</template>
<script setup lang="ts">
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue'
import jobComMainDetailCard from '@/mycomponents/job/jobComMainDetailCard.vue'
import jobAccept from '@/mycomponents/job/jobAccept.vue'
const props = defineProps({
dataContent: {
type: Object,

229
src/pages/issue/coms/comScanIssuePack.vue

@ -132,8 +132,9 @@ const openScanPopup = (content, jobcontentParams) => {
initData()
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
// "-" + this.jobContent.subList[0].workStationCode
show.value = true
setTimeout((res) => {
show.value = true
getfocus()
}, 500)
}
const closeScanPopup = () => {
@ -221,13 +222,15 @@ const queryBalance = (result) => {
let status = getInventoryStatusDesc(params.inventoryStatus)
let areaType = getListLocationAreaTypeDesc(params.areaType)
let hint =
"按物料号 [" + params.itemCode + "] <br>" +
"包装号 [" + params.packingNumber + "] <br>" +
"批次 [" + params.batch + "] <br>" +
"状态 [" + status + "] <br>" +
"库区 [" + areaType + "] <br>" +
"按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" +
"未查找到库存余额"
showErrorMessage(hint)
showErrorMessage(hint,res=>{
getfocus()
})
} else if (res.data.length == 1) {
result.balance = res.data[0]
@ -246,11 +249,15 @@ const queryBalance = (result) => {
uni.hideLoading()
}).catch(error => {
uni.hideLoading()
showErrorMessage(error)
showErrorMessage(error,res=>{
getfocus()
})
})
}
} catch (e) {
showErrorMessage(e.stack)
showErrorMessage(e.stack,res=>{
getfocus()
})
uni.hideLoading()
}
}
@ -326,6 +333,8 @@ const onScan = (result) => {
} else {
getToLocationBalance(result)
}
}else{
queryBalance(result)
}
}
//
@ -334,61 +343,62 @@ const getToLocationBalance = (result)=> {
title: '查询中',
mask: true
})
let filters = []
if (result.package.parentNumber) {
let packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: toLocationAreaTypeList.value.join(',')
})
let params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
queryBalance(result);
}
// callback(res.data)
}).catch(err => {
uni.hideLoading()
showErrorMessage(err.message);
})
queryBalance(result)
// let filters = []
// if (result.package.parentNumber) {
// let packingNumber = result.package.parentNumber + "," + result.package.number;
// filters.push({
// column: "packingNumber",
// action: "in",
// value: packingNumber
// })
// } else {
// filters.push({
// column: "packingNumber",
// action: "==",
// value: result.package.number
// })
// }
//
// filters.push({
// column: "itemCode",
// action: "==",
// value: result.package.itemCode
// })
// filters.push({
// column: "batch",
// action: "==",
// value: result.package.batch
// })
//
// filters.push({
// column: "areaType",
// action: "in",
// value: toLocationAreaTypeList.value.join(',')
// })
//
//
// let params = {
// filters: filters,
// pageNo: 1,
// pageSize: 100,
// }
// getBalanceByFilter(params).then(res => {
// uni.hideLoading()
// if (res.data.list.length > 0) {
// showErrorMessage("" + res.data.list[0].locationCode + "");
// } else {
// queryBalance(result);
// }
// // callback(res.data)
// }).catch(err => {
// uni.hideLoading()
// showErrorMessage(err.message);
// })
}
const selectBalanceItem = (balance) => {
afterGetBalance(label.value, balance, packageInfo.value)
afterGetBalance(balance, balance, packageInfo.value)
}
const afterGetBalance = (label, balance, packageInfo) => {
@ -399,13 +409,12 @@ const afterGetBalance = (label, balance, packageInfo) => {
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
fromLocationCode.value = balance.locationCode;
const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value)
if (fromLocation != undefined) {
if (fromLocation) {
const batch = fromLocation.Batchs.find((r) => r.batch == lot)
if (batch != undefined) {
if (batch.Records == undefined) {
batch.Records = []
}
const record = batch.Records.find((r) => r.packingNumber == packingCode)
if (record == undefined) {
//
@ -426,7 +435,6 @@ const afterGetBalance = (label, balance, packageInfo) => {
} else {
addRecord(batch, label, balance, packageInfo)
}
emit('afterScan')
} else {
showErrorMessage(`箱码【${packingCode}】已经扫描,请继续扫描下一箱`, (res) => {
getfocus()
@ -441,6 +449,7 @@ const afterGetBalance = (label, balance, packageInfo) => {
batch.detail = fromLocation.Batchs[0].detail
}
fromLocation.Batchs.unshift(batch)
getfocus()
emit('afterScan')
}
})
@ -450,8 +459,23 @@ const afterGetBalance = (label, balance, packageInfo) => {
})
}
} else {
let locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
//
if (jobContent.value.allowModifyLocation == "TRUE") {
showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,是否要继续发料?", res => {
if (res) {
let locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
getfocus();
emit("afterScan");
}
})
} else {
showErrorMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,不允许继续发料?")
}
// showErrorMessage(`${fromLocationCode.value}`, (res) => {
// getfocus()
// })
@ -462,13 +486,14 @@ const afterGetBalance = (label, balance, packageInfo) => {
})
}
}
//
//
const createLocationInfo = (label, balance, packageInfo)=> {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
}
let batch = createBatchInfo(label, balance, packageInfo);
@ -479,10 +504,11 @@ const createLocationInfo = (label, balance, packageInfo)=> {
const createBatchInfo = (data, balance, packageInfo) => {
const batch = {
isNewAdd: true,
batch: data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(balance.handleQty),
handleQty: Number(balance.qty),
Records: []
}
const record = creatRecord(data, balance, packageInfo)
@ -501,8 +527,8 @@ const creatRecord = (label, balance, packageInfo) => {
batch: label.batch,
// qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
qty: balance.handleQty,
handleQty:balance.handleQty,
qty: Number(balance.qty),
handleQty: Number(balance.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance,
@ -521,11 +547,58 @@ const calcBatchHandleQty = (batch) => {
batch.handleQty = handleQty
}
const addRecord = (batch, label, balance, packageInfo) => {
const record = creatRecord(label, balance, packageInfo)
batch.Records.push(record)
issueRecord.value.unshift(record)
calcBatchHandleQty(batch)
getfocus()
if (packageInfo.parentNumber) {
let checkData = batch.Records.find(r => {
if (r.packingNumber == packageInfo.parentNumber &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
showErrorMessage("箱码[" + packageInfo.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
} else {
const record = creatRecord(label, balance, packageInfo)
batch.Records.push(record)
issueRecord.value.unshift(record)
calcBatchHandleQty(batch)
getfocus()
emit("afterScan");
}
} else {
//
let checkData = batch.Records.find(r => {
if (r.parentPackingNumber == packageInfo.number &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
comMessageRef.value.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" +
balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
batch.Records = [];
const record = creatRecord(label, balance, packageInfo)
batch.Records.push(record)
issueRecord.value.unshift(record)
calcBatchHandleQty(batch)
getfocus()
emit("afterScan");
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
const record = creatRecord(label, balance, packageInfo)
batch.Records.push(record)
issueRecord.value.unshift(record)
calcBatchHandleQty(batch)
getfocus()
emit("afterScan");
}
}
}
const getfocus = () => {
@ -587,7 +660,7 @@ const remove = (record, index) => {
if (item != undefined) {
item.Locations.forEach((l) => {
const batch = l.Batchs.find((b) => b.packingNumber == record.packingNumber && b.batch == record.batch)
const batch = l.Batchs.find(b => b.batch == record.batch);
if (batch && batch.Records && batch.Records.length > 0) {
const rIndex = batch.Records.findIndex((r) => r.packingNumber == record.packingNumber && r.batch == record.batch)
@ -599,7 +672,9 @@ const remove = (record, index) => {
}
})
}
const clearList = ()=>{
issueRecord.value = []
}
const packGetFocus = () => {
if (comscan.value) {
comscan.value.getfocus()

732
src/pages/issue/coms/comScanIssuePack0816.vue

@ -0,0 +1,732 @@
<template>
<view>
<uni-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="">
<view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan>
<view style="width: 100%;">
<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%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowFromLocation="false"
:isShowStdPack="false"></balance>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-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>
<!-- 模拟扫描功能 -->
<!-- <win-com-scan v-show="false" ref="comscansimulate" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan> -->
</view>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
getDetailOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getWorkShopLineStation,
getBalanceByFilter,
getBalanceByParams,
} from '@/api/request2.js';
import {
uniqueArray
} from '@/common/basic.js';
import {
getLabelInfo
} from '@/common/label.js';
import {
calc
} from '@/common/calc.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
import {
getDirectoryItemArray
} from '../../../common/directory.js';
export default {
name: 'winScanPack',
emits: ["afterScan", "closeScan"],
components: {
winComScan,
balance,
balanceQtyEdit,
balanceSelect
},
props: {
title: {
type: String,
default: ''
},
},
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: [],
fromInventoryStatuses: "",
packageInfo: {},
label: {},
inputStyleObject: {
fontSize: "100rpx"
},
bussinessCode: 'Issue',
toLocationAreaTypeList: []
}
},
created() {
},
watch: {},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
},
methods: {
openScanPopupForJobSimulate(content, jobcontent, scanMessage) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
getLabelInfo(scanMessage, "HPQ,HMQ", callback => {
if (callback.success) {
this.onScan(callback);
} else {
this.showErrorMessage(callback.message, res => {})
}
})
},
openScanPopup(content, jobcontent) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
// "-" + this.jobContent.subList[0].workStationCode
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus();
}, 500)
},
closeScanPopup() {
this.losefocus()
this.$refs.popup.close();
this.$emit("closeScan")
//
// Object.assign(this.$data, this.$options.data());
},
initData() {
let that = this;
that.fromLocationList = [];
if (that.dataContent != null) {
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses
that.toLocation = that.dataContent[0];
that.toLocationCode = that.dataContent[0].toLocationCode;
that.toLocationAreaTypeList = getDirectoryItemArray(this.jobContent.toAreaTypes)
// that.fromLocationList = that.getFromLocationList();
}
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
// getFromLocationList() {
// let list = [];
// this.dataContent.forEach(location => {
// location.Items.forEach(item => {
// item.Locations.forEach(f => {
// let item = list.find(l => l == f.fromLocationCode);
// if (item == undefined) {
// list.push(f.fromLocationCode)
// }
// })
// })
// });
// //
// list = uniqueArray(list);
// this.fromLocationCode = list[0];
// return list;
// },
fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation)
if (location == undefined) {
this.fromLocationCode = ''
this.showErrorMessage('发料库位【' + fromlocation + '】不存在')
}
},
queryBalance(result) {
try {
let that = this;
let packageInfo = result.package;
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发料明细',
res => {
that.getfocus();
}
)
return;
} else {
var params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: this.jobContent.outInventoryStatuses.split(','),
areaType: this.jobContent.fromAreaTypes.split(','),
bussinessCode: this.jobContent.businessType
}
uni.showLoading({
title: '查询中',
mask: true
})
getBalanceByParams(params).then(res => {
if (res.data.length == 0) {
var status = getInventoryStatusDesc(params.inventoryStatus)
var areaType = getListLocationAreaTypeDesc(params.areaType)
var hint =
"按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" +
"未查找到库存余额"
this.showErrorMessage(hint,
res => {
that.getfocus();
})
} else if (res.data.length == 1) {
result.balance = res.data[0]
if (result.label.packingNumber != result.balance.packingNumber) {
result.balance.qty = Number(result.label.qty)
} else {
result.balance.qty = Number(result.balance.qty)
}
this.afterGetBalance(result.label, result.balance, result.package);
} else {
//
this.$refs.balanceSelect.openPopup(res.data);
}
uni.hideLoading()
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error,
res => {
that.getfocus();
})
})
}
} catch (e) {
this.showErrorMessage(e.stack, res => {
that.getfocus();
})
uni.hideLoading();
}
},
getBalance(label, packageInfo, callback) {
var filters = []
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
onScan(result) {
if (!result.package) {
this.showErrorMessage('扫描数据错误[' + result.label.code + "]",
res => {
this.getfocus();
}
)
return;
}
if (this.toLocation && result.package.packUnit) {
let item = this.toLocation.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) {
this.showErrorMessage('扫描物料【' + result.package.itemCode + '】不属于该任务');
return
}
if (result.package.packUnit !== item.packUnit) {
this.$refs.comMessage.showQuestionMessage(
`扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => {
if (res) {
this.getToLocationBalance(result)
}
});
} else {
this.getToLocationBalance(result)
}
}
},
//
getToLocationBalance(result) {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
if (result.package.parentNumber) {
var packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: this.toLocationAreaTypeList.join(',')
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
this.queryBalance(result);
}
// callback(res.data)
}).catch(err => {
uni.hideLoading()
this.showErrorMessage(err.message);
})
},
selectBalanceItem(balance) {
this.afterGetBalance(this.label, balance, this.packageInfo);
},
afterGetBalance(label, balance, packageInfo) {
let that = this;
try {
let itemCode = label.itemCode;
let packingCode = label.packingNumber;
let lot = label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
that.fromLocationCode = balance.locationCode;
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
if (fromLocation != undefined) {
let batch = fromLocation.Batchs.find(r => r.batch == lot);
if (batch != undefined) {
if (batch.Records == undefined) {
batch.Records = [];
}
let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) {
//
if (batch.Recommends != undefined && batch.Recommends.length > 0) {
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
if (recommend != undefined) {
that.addRecord(batch, label, balance, packageInfo)
} else {
//
if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
that.addRecord(batch, label, balance, packageInfo);
} else {
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => {
that.getfocus();
return;
}
)
}
}
} else {
that.addRecord(batch, label, balance, packageInfo)
}
that.$emit("afterScan");
} else {
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱',
res => {
that.getfocus();
}
)
}
} else {
if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
'】的发料明细,是否要继续发料?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance, packageInfo);
//details
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch);
that.$emit("afterScan");
}
})
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发料明细',
res => {
that.getfocus();
});
}
}
} else {
let locaion = that.createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
}
} catch (e) {
that.showErrorMessage(e.stack,
res => {
that.getfocus();
}
)
}
},
//
createLocationInfo(label, balance, packageInfo) {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
Batchs: []
}
let batch = this.createBatchInfo(label, balance, packageInfo);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
},
createBatchInfo(data, balance, packageInfo) {
let batch = {
batch: data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(balance.qty),
Records: []
}
let record = this.creatRecord(data, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
return batch;
},
creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty
balance.packUnit = packageInfo.packUnit
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch,
// qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
qty: Number(balance.qty),
handleQty: Number(balance.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: this.toLocationCode,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty
}
return record;
},
calcBatchHandleQty(batch) {
let handleQty = 0;
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
},
addRecord(batch, label, balance, packageInfo) {
let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
},
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
}
},
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
}
},
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
swipeClick(e, item, index) {
if (e.content.text == "详情") {
this.detail(item)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(item, index)
}
},
edit(item) {
this.editItem = item;
// item.balance.balanceQty = item.balance.qty;
item.balance.balanceQty = item.balance.qty;
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty);
},
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(record, index) {
this.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
record.qty = 0;
this.issueRecord.splice(index, 1)
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b
.batch == record.batch);
if (batch && batch.Records && batch.Records.length > 0) {
let rIndex = batch.Records.findIndex(r => r.packingNumber == record
.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
}
})
}
this.$emit('updateData', item);
}
});
},
packGetFocus() {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus();
}
},
packLoseFocus() {
if (this.$refs.comscan) {
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);
})
},
showQuestionMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showQuestionMessage(message, callback);
})
},
confirm(val) {
this.editItem.qty = Number(val);
this.$emit('updateData', this.editItem)
},
cancle() {
this.closeScanPopup()
}
}
}
</script>
<style lang="scss">
button {
border: none;
}
button::after {
border: none
}
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
padding: 10rpx;
}
.my-combox {
font-size: 50px;
}
</style>
Loading…
Cancel
Save