Browse Source

deliver/job 文件迁移Vue2升级Vue3 10/25-11/8

hella_vue3
王志国 2 weeks ago
parent
commit
a57256000c
  1. 7
      src/pages/count/job/countJob.vue
  2. 2
      src/pages/count/job/fuzzyCountJob.vue
  3. 106
      src/pages/customerReturn/job/returnDetail.vue
  4. 2
      src/pages/customerReturn/job/returnJob.vue
  5. 55
      src/pages/customerReturn/record/returnRecord.vue
  6. 95
      src/pages/deliver/coms/comDeliverDetailCardBatch.vue
  7. 550
      src/pages/deliver/coms/comScanDeliverPackBatch.vue
  8. 449
      src/pages/deliver/job/deliverDetailBatch.vue

7
src/pages/count/job/countJob.vue

@ -23,7 +23,7 @@
<u-loadmore :status="loadingType" />
</view>
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
<win-scan-button @goScan="openScanPopup" v-if="manageModel!='BY_BATCH' && jobList.length > 0"></win-scan-button>
<winScanPackJob title="库位" ref="scanPopup" @getResult="getScanResult"> </winScanPackJob>
<jobListView ref="jobListRef" @selectItem="selectItem"></jobListView>
<com-message ref="comMessageRef" />
@ -76,7 +76,8 @@ const queryParams = reactive({
creationTime: "",
status: "1,2",
fromLocationCode: ""
} )
})
const manageModel = import.meta.env.VITE_MANAGE_MODEL
onShow(() => {
setTimeout(()=>{
getList('refresh')
@ -180,7 +181,7 @@ const setQueryParam = ()=> {
if (queryParams.creationTime) {
filterParams.push({
column: "create_time",
action: "betweeen",
action: "between",
value: queryParams.creationTime
})
}

2
src/pages/count/job/fuzzyCountJob.vue

@ -131,7 +131,7 @@ export default {
if (this.checkedToday) {
filters.push({
column: 'create_time',
action: 'betweeen',
action: 'between',
value: this.todayTime
})
}

106
src/pages/customerReturn/job/returnDetail.vue

@ -58,7 +58,7 @@ import { getCustomerReturnJobDetail, takeCustomerReturnJob, cancleTakeCustomerRe
import { goHome, navigateBack, getPackingNumberAndBatch, getInventoryStatusName, getDirectoryItemArray } from '@/common/basic.js'
import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js'
import { calc } from '@/common/calc'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue'
@ -67,7 +67,7 @@ import comDetailCardBatch from "@/mycomponents/detail/comDetailCardBatch.vue"
import detailInfoPopup from '@/pages/customerReturn/coms/detailInfoPopup.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import { useCountStore } from '@/store'
// store
const store = useCountStore()
const { proxy } = getCurrentInstance()
const id = ref('')
@ -205,13 +205,55 @@ const openDetail = (item) => {
detailInfoPopupRef.value.openPopup(item)
}
const openScanPopup = () => {
detailInfoPopupRef.value.openPopup()
detailInfoPopupRef.value.openPopup(fromLocationCode.value)
}
const closeScanPopup = () => {
scanPopup.value.closeScanPopup()
}
const getScanResult = (result)=> {
managementType.value == result.managementType
if(result.managementType == "BY_BATCH" || result.managementType == "BY_QUANTITY" ){
setDataBatch(result)
}else{
setData(result)
}
}
const setDataBatch = (result)=>{
try {
const packingNumber = result.package.number;
const batch = result.label.batch;
const qty = result.label.qty;
const itemCode = result.label.itemCode;
const detail = detailSource.value.find(r => r.itemCode == itemCode);
const getScanResult = (result) => {
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
console.log(366,batch)
console.log(366,detail.subList)
let itemDetail = detail.subList.find(r => {
return r.batch == batch
})
if (itemDetail == undefined) {
showErrorMessage( "批次[" + batch + "]不在列表中")
} else {
if (itemDetail.scaned) {
// this.showErrorMessage("[" + packingNumber + "]" + "[" + batch + "]")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty)
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty)
itemDetail.packQty = Number(result.package.packQty)
itemDetail.packUnit = result.package.packUnit
calcHandleQty();
}
}
}
} catch (e) {
showMessage(e.message)
}
}
const setData = (result) => {
try {
const { packingNumber } = result.label
const { batch } = result.label
@ -255,12 +297,20 @@ const commit = () => {
// //
if (scanCount.value == subList.value.length) {
checkCount();
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount();
}
} else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == "TRUE") {
//
checkCount();
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount();
}
} else {
//
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
@ -315,6 +365,50 @@ const checkCount = () => {
submitJob()
}
}
const checkCountBatch = ()=>{
//
let str = ''
let str1 = ''
let str2 = ''
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
let tempHandleQty = 0
if(cur.handleQty){
tempHandleQty = cur.handleQty
}else {
tempHandleQty =0
}
str += `批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
if(cur.handleQty > cur.qty){
str1 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以大于推荐数量【${cur.qty}`
}
if(cur.handleQty < cur.qty){
str2 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以小于推荐数量【${cur.qty}`
}
})
})
jobContent.value.allowBiggerQty = 'FALSE'
if(jobContent.value.allowBiggerQty == 'FALSE' &&str1){
comMessageRef.value.showConfirmWarningModal(str1)
return
}
if(jobContent.value.allowSmallerQty == 'FALSE' && str2){
comMessageRef.value.showConfirmWarningModal(str2)
return
}
if (str) {
str = '任务明细未全部完成,是否提交?\n'+str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
submitJob()
}
});
} else {
submitJob()
}
}
const submitJob = () => {
proxy.$modal.loading('提交中...')
const itemCodes = []

2
src/pages/customerReturn/job/returnJob.vue

@ -111,7 +111,7 @@ const getList = (type) => {
if (checkedToday.value) {
filters.push({
column: 'create_time',
action: 'betweeen',
action: 'between',
value: todayTime.value
})
}

55
src/pages/customerReturn/record/returnRecord.vue

@ -44,7 +44,7 @@ import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { getBasicCustomerList, customerReturnRecordSubmit } from '@/api/request2.js'
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js'
import { calc } from '@/common/calc.js';
import { getPrecisionStrategyList } from '@/common/balance.js'
import { goHome, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js'
@ -81,6 +81,7 @@ const comMessageRef = ref()
const scanPopup = ref()
const scanLocationCode = ref()
const toInventoryStatuses = ref('')
const managementType = ref('')
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
@ -103,7 +104,16 @@ onNavigationBarButtonTap((e) => {
goHome()
}
})
const getScanResult = (result) => {
const getScanResult = (result,managementTypeParams)=> {
managementType.value = managementTypeParams
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
setDataBatch(result)
} else {
setData(result)
}
}
const setData = (result) => {
const { balance } = result
const { label } = result
const pack = result.package
@ -133,11 +143,42 @@ const getScanResult = (result) => {
}
handleCalcHandleQty()
}
const setDataBatch = (result)=>{
let balance = result.balance;
let label = result.label;
let pack = result.package;
let item = detailSource.value.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
const itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.packingNumber =pack.number
newDetail.handleQty =result.label.qty
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
const detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
handleCalcHandleQty();
}
const handleCalcHandleQty = () => {
calcHandleQty(detailSource.value)
}
const removeItem = (index, item) => {
detailSource.value.splice(index, 1)
}
@ -323,6 +364,12 @@ const showCommitSuccessMessage = (hint) => {
}
})
}
const showErrorMessage = (message)=> {
comMessageRef.value.showErrorMessage(message, res => {
if (res) {
}
});
}
const clearData = () => {
fromLocationCode.value = ''
subList.value = []

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

@ -1,21 +1,27 @@
<template>
<view>
<u-collapse ref="collapse">
<u-collapse-item :open="true" :class="dataContent.scaned?'scan_view':''">
<template #title>
<view class="split_line"></view>
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
</template>
<view v-for="(item,index) in dataContent.subList" style="margin-top: 10px;">
<u-swipe-action ref="swipeAction"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>itemCoceClick(event,item,index)">
<view class="" :class="item.scaned?'scan_view':''">
<recommend :detail="item" :isShowLocation="false" :isShowFromLocation="true" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</view>
</u-swipe-action>
</view>
</u-collapse-item>
</u-collapse>
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view v-for="(item,index) in dataContent.subList" style="margin-bottom: 20rpx;">
<u-swipe-action ref="swipeAction"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>swipeClick(event,item,index)"
:class="item.scaned? 'scan_view':''">
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
<location :locationCode="item.fromLocationCode"></location>
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false"
:isShowPack="item.packingNumber"></recommendBalanceBatch>
</u-swipe-action>
</view>
</view>
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage>
</template>
@ -23,18 +29,19 @@
<script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue'
import RecommendBalance from '@/mycomponents/balance/recommendBalance.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 requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.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';
@ -43,8 +50,8 @@ import {ref, nextTick, onMounted} from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
type: Array,
default: () => ([])
},
settingParam: {
type: Object,
@ -55,7 +62,7 @@ const props = defineProps({
default: true
}
});
const emit = defineEmits(['updateData']);
const emit = defineEmits(['updateData','removeItemCode']);
const option = ref([]);
const showItem = ref({});
@ -66,36 +73,49 @@ const scanOptions = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const collapse = ref(null);
const balanceQtyEdit = ref(null);
const receiptEdit = ref(null);
const receiptHint = ref(null);
const message = ref(null);
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getEditRemoveOption();
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
});
const resizeCollapse = () => {
nextTick(() => {
collapse.value.forEach(r => {
r.childrens.forEach(i => {
i.init();
});
r.resize();
collapse.value.init()
collapse.value.childrens.forEach(r => {
r.init();
});
});
};
const swipeClick = (e, item, index) => {
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 === "移除") {
remove(item, index);
item.scaned = false
item.handleQty=0
emit('updateData')
}
};
const edit = (item) => {
editItem.value = item;
balanceQtyEdit.value.openEditPopup(item);
receiptEdit.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
};
const detail = (item) => {
@ -103,11 +123,18 @@ const detail = (item) => {
receiptHint.value.openScanPopup();
};
const remove = (item, index) => {
const remove = (batch, record, recordIndex,batchIndex,Batchs,locatonIndex,Locations) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.handleQty = 0;
item.scaned = false;
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)
}
});
};

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

@ -35,7 +35,7 @@
</view>
<u-line class='line_color'></u-line> -->
<view class="uni-flex uni-row" style="align-items: center;
<!--<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
@ -48,12 +48,12 @@
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox>
</view>
</view>
</view>-->
<view class="">
<view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
:headerType="headerType" :isShowHistory="false">
headerType="HPQ,HMQ" :isShowHistory="false" :locationCode='locationCode'>
</win-com-scan>
<view style="width: 100%;">
@ -75,7 +75,7 @@
<u-swipe-action ref="swipeAction" :options="scanOptions"
@click="(...event)=>swipeClick(event,record,index)">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false"
<balance :dataContent="record" :isShowFromLocation="false"
:isShowStdPack="false"></balance>
</view>
</u-swipe-action>
@ -93,6 +93,10 @@
<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>
@ -109,14 +113,23 @@ import {
import {
getDirectoryItemArray,
getListLocationAreaTypeDesc,
getInventoryStatusDesc
} from '@/common/directory.js';
import {
getLabelInfo
} from '@/common/label.js';
import {
calc
} from '@/common/calc.js';
import {
getWorkShopLineStation
getWorkShopLineStation,
getBalanceByFilter,
getBalanceByParams,
} from '@/api/request2.js';
import {
uniqueArray
} from '@/common/basic.js';
import {
getBalanceByManagementPrecision
@ -124,7 +137,17 @@ import {
import {ref, onMounted} from 'vue';
const props = defineProps({
title: {
type: String,
default: ''
},
locationCode:{
type: String,
default: ''
}
})
const emit = defineEmits(['closeScan','afterScan'])
const detailOptions = ref(getDetailOption());
const scanOptions = ref(getDetailEditRemoveOption());
const issueRecord = ref([]);
@ -149,20 +172,35 @@ const toLocationCombox = ref(null)
const comscan = ref(null)
const balanceQtyEdit = ref(null)
const receiptHint = ref(null)
const emit = defineEmits(['closeScan','afterScan'])
const inputStyleObject = ref({
fontSize: "100rpx"
})
const bussinessCode = ref('Issue')
const toLocationAreaTypeList = ref([])
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption();
});
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage)=> {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
getLabelInfo(scanMessage, "HPQ,HMQ", callback => {
if (callback.success) {
onScan(callback);
} else {
showErrorMessage(callback.message, res => {})
}
})
}
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;
// positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode +
// "-" + jobContent.value.subList[0].workStationCode;
show.value = true
setTimeout(() => {
getfocus();
@ -183,85 +221,239 @@ const initData = () => {
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses);
toLocation.value = dataContent.value.subList;
toLocationCode.value = dataContent.value.subList[0].toLocationCode;
fromLocationList.value = getFromLocationList();
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
// fromLocationList.value = getFromLocationList();
}
};
const showBalanceSelect = (items, packageInfoValue) => {
packageInfo.value = packageInfoValue;
const showBalanceSelect = (items) => {
balanceSelect.value.openPopup(items);
};
const getFromLocationList = () => {
let list = [];
let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value);
if (location != undefined) {
dataContent.value.subList.forEach(item => {
list.push(item.fromLocationCode);
});
fromLocationCode.value = list[0];
return list;
} else {
comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => {
toLocationCode.value = '';
});
}
};
// const getFromLocationList = () => {
// let list = [];
// let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value);
// if (location != undefined) {
// dataContent.value.subList.forEach(item => {
// list.push(item.fromLocationCode);
// });
// fromLocationCode.value = list[0];
// return list;
// } else {
// comMessage.value.showErrorMessages('' + toLocationCode.value + '', res => {
// toLocationCode.value = '';
// });
// }
// };
const fromLocationUpdate = (fromlocation) => {
let location = fromLocationList.value.find(r => r == fromlocation);
fromLocationCode.value = fromlocation;
let location = fromLocationList.value.find(r => r == fromlocation)
if (location == undefined) {
fromLocationCode.value = ''
showErrorMessage('发货库位【' + fromlocation + '】不存在')
}
};
const onScan = (result) => {
const queryBalance = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', res => {
toLocationCombox.value.onFocus();
});
return;
}
// if (fromLocationCode.value == '') {
// showErrorMessage('', res => {
// toLocationCombox.value.onFocus();
// });
// return;
// }
let packageInfoValue = result.package;
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = toLocation.value.find(r => r.itemCode == itemCode);
let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
if (item == undefined) {
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => {
getfocus();
});
return;
} else {
const params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: jobContent.value.outInventoryStatuses.split(','),
areaType: jobContent.value.fromAreaTypes.split(','),
bussinessCode: jobContent.value.businessType
}
uni.showLoading({
title: '加载中',
title: '查询中',
mask: true
});
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value,
balanceRes => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => {
packGetFocus();
});
} else if (balanceRes.data.list.length == 1) {
let 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();
});
getBalanceByParams(params).then(res => {
if (res.data.length == 0) {
const status = getInventoryStatusDesc(params.inventoryStatus)
const areaType = getListLocationAreaTypeDesc(params.areaType)
const hint =
"按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" +
"未查找到库存余额"
showErrorMessage(hint,
res => {
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)
}
afterGetBalance(result.label, result.balance, result.package);
} else {
//
balanceSelect.value.openPopup(res.data);
}
uni.hideLoading()
}).catch(error => {
uni.hideLoading()
showErrorMessage(error,
res => {
getfocus();
})
})
}
} catch (e) {
showErrorMessage(e.stack);
showErrorMessage(e.stack,res=>{
getfocus()
});
uni.hideLoading();
}
};
const getBalance = (label, packageInfo, callback)=> {
let filters = []
if (packageInfo.parentNumber) {
const 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 (fromInventoryStatuses.value != null && fromInventoryStatuses.value != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses.value
})
}
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
showErrorMessage(err.message);
})
}
const onScan = (result)=> {
if (!result.package) {
showErrorMessage('扫描数据错误[' + result.label.code + "]",
res => {
getfocus();
}
)
return;
}
if (toLocation.value) {
let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) {
showErrorMessage('扫描物料代码不属于该任务');
return
}
getToLocationBalance(result)
}
}
//
const getToLocationBalance = (result)=> {
uni.showLoading({
title: '查询中',
mask: true
})
let filters = []
if (result.package.parentNumber) {
const 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(',')
})
const 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(balance, balance, packageInfo.value);
};
@ -271,55 +463,80 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => {
let itemCode = labelValue.itemCode;
let packingCode = labelValue.packingNumber;
let lot = labelValue.batch;
let item = toLocation.value.find(r => r.itemCode == itemCode);
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value);
if (!fromLocation) {
fromLocation = {
Batchs: [{
Recommends: [],
Records: [],
batch: labelValue.batch,
detail: {
...packageInfoValue,
fromLocationCode: balance.locationCode,
toLocationCode: toLocationCode.value
},
handleQty: 0,
packingNumber: null,
qty: labelValue.qty,
uom: labelValue.uom
}],
toLocationCode: toLocationCode.value,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: labelValue.qty,
uom: labelValue.uom
};
item.Locations.push(fromLocation);
}
if (fromLocation != undefined) {
let batch = fromLocation.batch;
if (batch != undefined) {
addRecord(item.batch, labelValue, balance, packageInfoValue);
} else {
let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
fromLocationCode.value = balance.locationCode;
let fromLocation = item.Locations.find(l => l.fromLocationCode == fromLocationCode.value);
if (fromLocation) {
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) {
addRecord(batch, label, balance, packageInfo)
} else {
//
if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
addRecord(batch, label, balance, packageInfo);
} else {
showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => {
getfocus();
return;
}
)
}
}
} else {
addRecord(batch, label, balance, packageInfo)
}
} else {
addRecord(batch, label, balance, packageInfo)
}
}else {
if (jobContent.value.allowModifyBatch == "TRUE") {
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => {
if (res) {
let batch = createBatchInfo(labelValue, balance, packageInfoValue);
let batch = createBatchInfo(label, balance, packageInfo);
//details
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch);
getfocus();
emit("afterScan");
}
});
})
} else {
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => {
getfocus();
});
showErrorMessage('未查找到批次【' + lot + '】的发货明细',
res => {
getfocus();
});
}
}
} else {
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => {
getfocus();
});
}else {
//
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 +
"】与推荐的库位不一致,不允许继续发货?")
}
}
} catch (e) {
showErrorMessage(e.stack, res => {
@ -327,28 +544,30 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => {
});
}
};
//
const createLocationInfo = (label, balance, packageInfoValue)=> {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
}
let batch = createBatchInfo(label, balance, packageInfoValue);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
}
const createBatchInfo = (data, balance, packageInfoValue) => {
let batch = {
batch: data.lot || data.batch,
isNewAdd: true,
batch: data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(data.qty),
handleQty: Number(balance.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
}
};
let record = creatRecord(data, balance, packageInfoValue);
batch.Records.push(record);
@ -366,7 +585,7 @@ const creatRecord = (labelValue, balance, packageInfoValue) => {
parentPackingNumber: packageInfoValue.parentNumber,
batch: labelValue.batch,
qty: Number(balance.qty),
handleQty: 0,
handleQty: Number(balance.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
@ -374,36 +593,68 @@ const creatRecord = (labelValue, balance, packageInfoValue) => {
supplierCode: labelValue.supplierCode,
packUnit: packageInfoValue.packUnit,
packQty: packageInfoValue.packQty,
fromLocationCode: balance.locationCode
};
return record;
};
const calcBatchHandleQty = (batch, labelValue, balance) => {
dataContent.value.subList.forEach(item => {
if (item.itemCode == labelValue.itemCode && item.batch == labelValue.batch) {
item.handleQty = item.handleQty || 0;
item.handleQty = calc.add(item.handleQty, labelValue.qty);
}
});
const calcBatchHandleQty = (batch) => {
let handleQty = 0;
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
};
const addRecord = (batch, labelValue, balance, packageInfoValue) => {
let checkData = dataContent.value.subList.find(r => {
if (r.batch == balance.batch) {
return r;
if(packageInfoValue.parentNumber){
let checkData = batch.Records.find(r => {
if (r.packingNumber == packageInfoValue.parentNumber && r.batch == balance.batch) {
return r;
}
});
if (checkData) {
showErrorMessage("箱码[" + packageInfoValue.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
} else {
let record = creatRecord(labelValue, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
dataContent.value.subList.push(record);
calcBatchHandleQty(batch);
getfocus();
emit("afterScan");
}
}else {
//
let checkData = batch.Records.find(r => {
if (r.parentPackingNumber == packageInfoValue.number &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
comMessage.value.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" +
balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
batch.Records = [];
let record = creatRecord(label, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus();
emit("afterScan");
}
})
} else {
let record = creatRecord(label, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus();
emit("afterScan");
}
});
if (checkData) {
checkData.scaned = true;
calcBatchHandleQty(batch, labelValue, balance);
getfocus();
} else {
let record = creatRecord(labelValue, balance, packageInfoValue);
dataContent.value.subList.push(record);
calcBatchHandleQty(batch, labelValue, balance);
getfocus();
emit("afterScan");
}
};
@ -454,8 +705,10 @@ const remove = (record, index) => {
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
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);
}
});
}
emit('updateData', item);
@ -464,11 +717,15 @@ const remove = (record, index) => {
};
const packGetFocus = () => {
comscan.value.getfocus();
if (comscan.value) {
comscan.value.getfocus();
}
};
const packLoseFocus = () => {
comscan.value.losefocus();
if (comscan.value) {
comscan.value.losefocus();
}
};
const showMessage = (message, callback) => {
@ -517,4 +774,7 @@ button::after {
max-height: 300rpx;
padding: 10rpx;
}
.my-combox {
font-size: 50px;
}
</style>

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

@ -29,9 +29,12 @@
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view>
<comDeliverDetailCardBatch ref='comIssueDetailCard' :dataContent="detailSource" :settingParam="jobContent"
@updateData='updateData'>
</comDeliverDetailCardBatch>
<view v-for="(toLocation, index) in detailSource" :key="index">
<comDeliverDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData' :allowBiggerQty='allowBiggerQty'>
</comDeliverDetailCardBatch>
<view class="split_line"></view>
</view>
</view>
</scroll-view>
</view>
@ -46,9 +49,11 @@
</view>
</view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanDeliverPackBatch>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<!-- <comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'></comScanDeliverPackBatch>-->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation>
<comMessage ref="comMessageRef"></comMessage>
</view>
</template>
@ -72,12 +77,18 @@ import {
getRemoveOption,
getCurrDateTime,
getPackingNumberAndBatch,
deepCopyData
deepCopyData,
compareAsc
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
getTreeDataSource,
calcTreeHandleQty,
getScanCount,
getThreeDataSource,
getDataSource,
calcHandleQty,
} from '@/common/detail.js';
import {
getManagementPrecisions
@ -85,13 +96,13 @@ import {
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import WinScanButton from '@/mycomponents/scan/winScanButton.vue'
import ComDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import JobTop from '@/mycomponents/job/jobTop.vue'
import WinScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import {ref} from 'vue';
import {ref,nextTick} from 'vue';
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app';
const id = ref('');
@ -104,11 +115,17 @@ const status = ref("");
const toLocationCode = ref("");
const jobStatus = ref("");
const dataContent = ref('')
const allowBiggerQty = ref('TRUE')
const managementType = ref('')
const scanCount = ref('')
const balanceinfo = ref('')
const fromLocationCode = ref('')
const managementList = ref([]);
const comMessageRef = ref(null);
const scanPopup = ref(null);
const comScanIssuePack = ref(null);
const comIssueDetailCardBatch = ref(null)
import {useCountStore} from '@/store'
const store = useCountStore();
@ -173,8 +190,10 @@ const getDetail = () => {
jobContent.value = res.data;
jobStatus.value = res.data.status;
subList.value = res.data.subList;
detailSource.value = res.data;
// detailSource.value = res.data;
detailSource.value = getThreeDataSource(jobContent.value)
toLocationCode.value = subList.value[0].toLocationCode;
allowBiggerQty.value = res.data.allowBiggerQty;
resizeCollapse();
} else {
showMessage('未获取到详情');
@ -190,9 +209,188 @@ const closeScan = () => {
};
const resizeCollapse = () => {
//
nextTick(r => {
comIssueDetailCardBatch.value.forEach(r => {
r.resizeCollapse();
})
});
};
const getScanResult = (result, managementTypeParams)=> {
managementType.value = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
setDataBatch(result)
}else{
setData(result)
}
}
const setDataBatch = (result)=> {
try {
balanceinfo.value = result.balance
let packingNumber = result.label.packingNumber;
let batch = result.label.batch;
let qty = result.label.qty;
let itemCode = result.label.itemCode;
let locationCode = result.fromLocationCode;
if (!result.balance) {
showMessage("没有库存余额")
return;
}
// var inventoryStatus = "OK";
let detail = detailSource.value.find(r => r.itemCode == itemCode);
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
let itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
let isExit;
for (let subItem of detail.subList) {
let item;
// for (let pack of subItem.packList) {
// if (pack.batch == batch) {
// item = pack;
// isExit = pack;
// break;
// }
// }
// if (item != undefined) {
// subItem.scaned = true
// subItem.handleQty = 0;
// item = undefined
// }
}
if (isExit == undefined) {
// this.showErrorMessage("" + batch + "" + result
// .fromLocationCode + "")
detail.subList.push({
scaned:true,
fromLocationCode:fromLocationCode.value,
toLocationCode:toLocationCode.value,
batch:result.label.batch,
handleQty:result.label.qty,
qty:result.balance.qty,
inventoryStatus:result.balance.inventoryStatus,
toLocation:result.balance.toLocation,
balance:result.balance,
balanceQty:result.balance.qty,
packQty:result.package.packQty,
packUnit:result.package.packUnit,
uom:result.balance.uom,
// packList:[{
// scaned : true,
// handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode,
// }]
})
detail.handleQty = 0
detail.qty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
detail.qty = calc.add(detail.qty,item.qty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
setTimeout(r => {
resizeCollapse();
}, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = toLocationCode.value;
}
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.balance = result.balance
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
// calcHandleQtyAdd(this.detailSource, result.label);
}
continueScan()
} else {
let scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (itemDetail.scaned ) {
// this.showMessage("" + packingNumber + "")
// calcHandleQtyAdd(this.detailSource, result.label);
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
} else {
itemDetail.scaned = true;
detailSource.value[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
itemDetail.scaned = true
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.packQty=result.package.packQty
itemDetail.packUnit=result.package.packUnit
itemDetail.fromlocationCode=fromLocationCode.value
itemDetail.toLocationCode=toLocationCode.value
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// })
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcTreeHandleQty(this.detailSource);
continueScan()
}
}
}
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
})
})
} catch (e) {
showMessage(e.message)
}
}
//
const continueScan = ()=> {
scanCount.value = getScanCount(subList.value);
if (scanCount.value == subList.value.length) {
closeScanPopup();
} else {
scanPopupGetFocus();
}
}
const submit = () => {
uni.showLoading({
title: "提交中....",
@ -201,8 +399,8 @@ const submit = () => {
//
const itemCodes = [];
const locationCode = detailSource.value.subList[0].toLocationCode;
detailSource.value.subList.forEach((item) => {
const locationCode = detailSource.value[0].subList[0].toLocationCode;
detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode);
});
@ -210,68 +408,129 @@ const submit = () => {
getManagementPrecisions(itemCodes, locationCode, (res) => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value && managementList.value[0] ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING'
submitJob();
} else {
uni.hideLoading();
showErrorMessage(res.message);
// showErrorMessage(res.message);
}
});
};
const checkCount = () => {
let str = "";
let taskQty = 0;
let totalQty = 0;
detailSource.value.subList.forEach((item) => {
taskQty = calc.add(taskQty, item.qty);
const handleQty = item.qty ? item.qty : 0;
totalQty = calc.add(totalQty, handleQty);
detailSource.value.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){
const hanleQty = record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty)
}
})
})
})
//
item.totalQty = totalQty;
});
//
if (jobContent.value.allowPartialComplete == "FALSE") {
detailSource.value.subList.forEach((detail) => {
if (taskQty != totalQty) {
str += `物料号【${detail.itemCode}】任务数量【${taskQty}】与实际提交数量【${totalQty}】不一致\n`;
detailSource.value.forEach((detail) => {
detail.Items.forEach(item=>{
if(jobContent.value.allowPartialComplete=="FALSE"){
if(item.taskQty!=item.totalQty){
str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
}
}
});
}
})
});
if (str) {
str = '不允许提交\n' + str;
showErrorMessage(str);
}
return str ? false : true;
};
const checkCountBatch = ()=> {
let str = ""
let str1 = ""
let str2 = ""
detailSource.value.forEach(detail => {
let taskQty = 0;
let totalQty = 0;
detail.subList.forEach(item => {
if (item.scaned) {
item.taskQty = 0
item.totalQty = 0
item.taskQty = calc.add(item.taskQty, item.qty)
item.totalQty = calc.add(item.totalQty, item.handleQty)
if (jobContent.value.allowPartialComplete == "FALSE") {
if (item.handleQty != item.taskQty) {
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.taskQty}】不一致\n`
}
}
if (allowBiggerQty.value == 'FALSE') {
if (item.taskQty < item.totalQty) {
str1 += '数量[' + item.totalQty + ']不允许大于任务数量[' + item.taskQty + ']'
}
}
if (item.handleQty > item.balance.qty) {
str2 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
}
})
})
if (str) {
str = '不允许提交\n' + str
showErrorMessage(str)
}
if (str1) {
str1 = '不允许提交\n' + str1
showErrorMessage(str1)
}
if (str2) {
str2 = '不允许提交\n' + str2
showErrorMessage(str2)
}
return !(str || str1 || str2)
}
const submitJob = () => {
const params = setParams();
const params = setParams()
console.log("提交参数", params);
if (params.subList.length == 0) {
uni.hideLoading();
comMessageRef.value.showConfirmMessageModal('请扫描箱码');
return;
const isTrue = params.subList.some(item=>{
console.log(item.recordList.some(cur=>cur.scaned))
return item.recordList.some(cur=>cur.scaned) == true
})
if(!isTrue){
uni.hideLoading()
showErrorMessage("请扫描您需要提交的发货任务")
return
}
if (!checkCount()) {
uni.hideLoading();
return;
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
if (!checkCountBatch()) {
uni.hideLoading()
return;
}
}else{
if (!checkCount()) {
uni.hideLoading()
return;
}
}
deliverJobSubmit(params).then((res) => {
uni.hideLoading();
deliverJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data);
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data)
} else {
showErrorMessage("提交失败[" + res.msg + "]");
showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
}).catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
};
const setParams = () => {
@ -279,28 +538,33 @@ const setParams = () => {
const createTime = getCurrDateTime();
const creator = store.id;
detailSource.value.subList.forEach((r) => {
if (r.scaned) {
const subItem = {...r};
subItem.recordList = [];
const record = {};
record.handleQty = r.handleQty;
record.toContainerNumber = r.ContainerNumber;
record.toInventoryStatus = r.inventoryStatus;
record.toLocationCode = subItem.toLocationCode;
record.supplierCode = r.supplierCode;
const info = getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch);
record.toPackingNumber = info.packingNumber;
record.packingNumber = info.packingNumber;
record.fromPackingNumber = info.packingNumber;
record.toBatch = info.batch;
subItem.toPackingNumber = info.packingNumber;
subItem.packingNumber = info.packingNumber;
subItem.fromPackingNumber = info.packingNumber;
subItem.recordList.push(record);
subList.push(deepCopyData(subItem));
}
});
detailSource.value.forEach(toLocationCode => {
let obj = {...toLocationCode}
delete obj.subList
obj.recordList = []
let obj1 ={}
let arr = toLocationCode.subList.filter(item=>item.scaned)
arr.forEach(record=>{
obj1.scaned =record.scaned;
obj1.handleQty =record.handleQty;
obj1.fromLocationCode =record.fromLocationCode;
obj1.fromInventoryStatus =record.fromInventoryStatus;
obj1.copyContent =record.copyContent;
obj1.toContainerNumber = record.ContainerNumber;
obj1.toInventoryStatus =record.inventoryStatus;
obj1.toLocationCode = record.toLocationCode;
obj1.supplierCode = record.supplierCode;
obj1.toPackingNumber ='';
obj1.packingNumber = ''
obj1.fromPackingNumber = '';
obj1.toBatch = record.batch;
obj1.toPackingNumber = '';
obj1.packingNumber = '';
obj1.fromPackingNumber ='';
obj.recordList.push(obj1)
})
subList.push(obj)
})
jobContent.value.subList = subList;
jobContent.value.createTime = createTime;
@ -336,11 +600,12 @@ const clearInfo = () => {
};
const updateData = (record) => {
calcHandleQty(detailSource.value)
};
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus();
scanPopup.value.packGetFocus();
}
};
@ -394,15 +659,39 @@ const confirmResult = (result) => {
dataContent.value = result;
};
const openScanDetailPopup = () => {
const datacontent = {...detailSource.value}; //
comScanIssuePack.value.openScanPopup(datacontent, jobContent.value);
};
// const openScanDetailPopup = () => {
// const datacontent = {...detailSource.value}; //
// comScanIssuePack.value.openScanPopup(datacontent, jobContent.value);
// };
const closeScanPopup = () => {
// updateCommitBtn();
};
const openScanPopup = ()=> {
let fromLocationCodeMes = '';
let fromlocationList = [];
for (let i = 0; i < detailSource.value.length; i++) {
let item = detailSource.value[i];
item.subList.forEach(l => {
//
let location = fromlocationList.find(res => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode);
}
//
if (fromLocationCode == '') {
if (!l.scaned) {
fromLocationCodeMes = l.fromLocationCode;
}
}
})
}
fromLocationCode.value = fromLocationCodeMes
scanPopup.value.openScanPopupForJob(fromLocationCodeMes, fromlocationList,jobContent.value);
}
const confirmFromLocation = (fromLocationCodeParams)=>{
fromLocationCode.value = fromLocationCodeParams
}
</script>
<style scoped lang="scss">

Loading…
Cancel
Save