王志国
2 weeks ago
6 changed files with 886 additions and 91 deletions
@ -0,0 +1,785 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header-view"> |
||||
|
<view class="header_job_top"> |
||||
|
<job-top :dataContent="jobContent"></job-top> |
||||
|
</view> |
||||
|
<work-station :workshopCode="jobContent.workShopCode" |
||||
|
:productionLineCode="jobContent.detailProductionLineCode" |
||||
|
:workStationCode="jobContent.detailWorkStationCode" |
||||
|
:rawLocationCode="jobContent.detailToLocationCode"> |
||||
|
</work-station> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view v-for="(toLocation, index) in detailSource"> |
||||
|
<comIssueDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent" |
||||
|
@updateData='updateData'> |
||||
|
</comIssueDetailCardBatch> |
||||
|
<view class="split_line"></view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="autoCommit()">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<!-- <com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData' |
||||
|
@afterScan='afterScan' :locationCode='fromLocationCode'> |
||||
|
</com-scan-issue-pack> --> |
||||
|
|
||||
|
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup" |
||||
|
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'> |
||||
|
</winScanPackAndLocation> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { |
||||
|
takeIssueJob, |
||||
|
cancleTakeIssueJob, |
||||
|
getIssueJobDetail, |
||||
|
issueJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
navigateBack, |
||||
|
getCurrDateTime, |
||||
|
compareAsc |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getTreeDataSource, |
||||
|
calcTreeHandleQty, |
||||
|
getScanCount, |
||||
|
getThreeDataSource, |
||||
|
getDataSource, |
||||
|
calcHandleQty, |
||||
|
} from '@/common/detail.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
|
||||
|
import WinScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import JobTop from '@/mycomponents/job/jobTop.vue' |
||||
|
import WinScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
|
||||
|
import {ref, nextTick, getCurrentInstance} from 'vue'; |
||||
|
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app'; |
||||
|
const { proxy } = getCurrentInstance() |
||||
|
const id = ref(''); |
||||
|
const jobContent = ref({}); |
||||
|
const subList = ref([]); |
||||
|
const detailSource = ref([]); |
||||
|
const detailOptions = ref([]); |
||||
|
const scanOptions = ref([]); |
||||
|
const status = ref(""); |
||||
|
const toLocationCode = ref(""); |
||||
|
const jobStatus = ref(""); |
||||
|
const dataContent = ref({}) |
||||
|
const allowBiggerQty = ref('TRUE') |
||||
|
const managementType = ref('') |
||||
|
const scanCount = ref('') |
||||
|
const balanceinfo = ref('') |
||||
|
const fromLocationCode = ref('') |
||||
|
const scanMessage = 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(); |
||||
|
|
||||
|
onLoad((option) => { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title + '详情' |
||||
|
}); |
||||
|
id.value = option.id; |
||||
|
scanMessage.value = option.scanMessage || ''; |
||||
|
if (id.value != undefined) { |
||||
|
// 新建的任务自动接收 |
||||
|
if (option.status == "1") { |
||||
|
receive(() => { |
||||
|
getDetail(); |
||||
|
}); |
||||
|
} else { |
||||
|
getDetail(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
onNavigationBarButtonTap((e) => { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
onBackPress((e) => { |
||||
|
// 已经接收但是没提交任务 |
||||
|
if (e.from == 'backbutton') { |
||||
|
if (jobStatus.value == "2") { |
||||
|
// 取消承接任务 |
||||
|
cancleTakeIssueJob(id.value).then(() => { |
||||
|
uni.navigateBack(); |
||||
|
}).catch(() => { |
||||
|
uni.navigateBack(); |
||||
|
}); |
||||
|
} else { |
||||
|
uni.navigateBack(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const receive = (callback) => { |
||||
|
if (id.value != null) { |
||||
|
takeIssueJob(id.value).then(() => { |
||||
|
callback(); |
||||
|
}).catch((error) => { |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const getDetail = () => { |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getIssueJobDetail(id.value).then((res) => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data && res.data.subList.length > 0) { |
||||
|
jobContent.value = res.data; |
||||
|
jobStatus.value = res.data.status; |
||||
|
subList.value = res.data.subList; |
||||
|
// detailSource.value = res.data; |
||||
|
detailSource.value = getThreeDataSource(jobContent.value) |
||||
|
jobContent.value.detailToLocationCode = res.data.subList[0].toLocationCode |
||||
|
toLocationCode.value = subList.value[0].toLocationCode; |
||||
|
fromLocationCode.value = subList[0].value.fromLocationCode |
||||
|
//任务中已经扫描,模拟扫描赋值 |
||||
|
if (scanMessage.value) { |
||||
|
openScanPopupSimulate(this.scanMessage); |
||||
|
} |
||||
|
setTimeout(()=>{ |
||||
|
resizeCollapse(); |
||||
|
},200) |
||||
|
} else { |
||||
|
showMessage('列表数据为0'); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const closeScan = () => { |
||||
|
resizeCollapse(); |
||||
|
}; |
||||
|
|
||||
|
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) |
||||
|
} |
||||
|
} |
||||
|
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: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
// 目前任务只到一个库位 |
||||
|
const itemCodes = []; |
||||
|
const locationCode = detailSource.value[0].subList[0].toLocationCode; |
||||
|
detailSource.value.forEach((item) => { |
||||
|
itemCodes.push(item.itemCode); |
||||
|
}); |
||||
|
|
||||
|
// 获取管理模式,封装参数 |
||||
|
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); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const checkCount = () => { |
||||
|
let str = ""; |
||||
|
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; |
||||
|
}); |
||||
|
|
||||
|
// 如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 |
||||
|
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() |
||||
|
console.log("提交参数", params); |
||||
|
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(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){ |
||||
|
// if (!checkCountBatch()) { |
||||
|
// uni.hideLoading() |
||||
|
// return; |
||||
|
// } |
||||
|
// }else{ |
||||
|
// if (!checkCount()) { |
||||
|
// uni.hideLoading() |
||||
|
// return; |
||||
|
// } |
||||
|
// } |
||||
|
issueJobSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data) |
||||
|
} else { |
||||
|
showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
showErrorMessage(error) |
||||
|
}) |
||||
|
}; |
||||
|
|
||||
|
const setParams = () => { |
||||
|
const subList = []; |
||||
|
const createTime = getCurrDateTime(); |
||||
|
const creator = store.id; |
||||
|
|
||||
|
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.supplierCode = record.supplierCode; |
||||
|
obj1.batch = record.batch; |
||||
|
obj1.copyContent = record.copyContent; |
||||
|
obj1.fromInventoryStatus = record.fromInventoryStatus; |
||||
|
obj1.fromLocationCode = record.fromLocationCode; |
||||
|
obj1.handleQty = record.handleQty; |
||||
|
obj1.inventoryStatus = record.fromInventoryStatus; |
||||
|
obj1.packQty = record.packQty; |
||||
|
obj1.packUnit = record.packUnit; |
||||
|
obj1.packingNumber = record.packingNumber; |
||||
|
obj1.qty = record.qty; |
||||
|
obj1.scaned = record.scaned; |
||||
|
obj1.toLocationCode = record.toLocationCode; |
||||
|
obj1.fromPackingNumber = ''; |
||||
|
obj1.fromBatch = record.batch; |
||||
|
obj1.toBatch = record.batch; |
||||
|
obj1.toInventoryStatus = record.inventoryStatus; |
||||
|
obj1.toPackingNumber = ""; |
||||
|
obj1.packingNumber = ""; |
||||
|
let single_price = record.balance.singlePrice == null ? 0 : record.balance.singlePrice; |
||||
|
obj1.singlePrice = single_price; |
||||
|
obj1.amount = single_price * record.qty; |
||||
|
obj.recordList.push(obj1) |
||||
|
}) |
||||
|
subList.push(obj) |
||||
|
}) |
||||
|
|
||||
|
jobContent.value.subList = subList; |
||||
|
jobContent.value.createTime = createTime; |
||||
|
jobContent.value.creator = creator; |
||||
|
return jobContent.value; |
||||
|
}; |
||||
|
|
||||
|
const cancel = () => { |
||||
|
comMessageRef.value.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', (res) => { |
||||
|
if (res) { |
||||
|
clearInfo(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const clearInfo = () => { |
||||
|
dataContent.value.itemCodeList.forEach((res) => { |
||||
|
if (res.recommendList != null) { |
||||
|
res.recommendList.forEach((res1) => { |
||||
|
if (res1.locationCodeList != null) { |
||||
|
res1.locationCodeList.forEach((res2) => { |
||||
|
if (res2.packingCodeList != null) { |
||||
|
res2.packingCodeList.forEach((res3) => { |
||||
|
res3.itemCode = ""; |
||||
|
res3.qty = 0; |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const updateData = (record) => { |
||||
|
detailSource.value.forEach(item=>{ |
||||
|
item.handleQty = 0 |
||||
|
item.subList.forEach(cur=>{ |
||||
|
item.handleQty = calc.add(cur.handleQty,item.handleQty) |
||||
|
}) |
||||
|
}) |
||||
|
}; |
||||
|
const autoCommit = ()=> { |
||||
|
// this.$throttle(this.submit, 2000, this)() |
||||
|
let str = "" |
||||
|
let str1 = "" |
||||
|
let totalQty = 0; |
||||
|
let taskQty = 0; |
||||
|
detailSource.value.forEach(detail => { |
||||
|
detail.subList.forEach(item => { |
||||
|
if (item.scaned) { |
||||
|
taskQty = calc.add(taskQty, item.qty) |
||||
|
totalQty = calc.add(totalQty, item.handleQty) |
||||
|
if (item.handleQty < item.qty) { |
||||
|
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.qty}】不一致\n` |
||||
|
} |
||||
|
if (item.handleQty > item.balance.qty) { |
||||
|
str1 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}】` |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}) |
||||
|
if(str1){ |
||||
|
comMessageRef.value.showMessage(str1, res => { |
||||
|
if (res) { |
||||
|
afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
return |
||||
|
} |
||||
|
if(str){ |
||||
|
str = '任务明细未全部完成,是否提交?\n' + str |
||||
|
} |
||||
|
if(totalQty!=taskQty){ |
||||
|
str ="扫描数量["+totalQty+"]与任务数量不一致["+taskQty+"],是否提交" |
||||
|
comMessageRef.value.showQuestionMessage1(str, 'red', res => { |
||||
|
if (res) { |
||||
|
//防止重复点击 |
||||
|
proxy.$throttle(submit, 2000, proxy)() |
||||
|
} else { |
||||
|
// this.detailSource.forEach(detail => { |
||||
|
// detail.Items.forEach(item => { |
||||
|
// taskQty =calc.add(taskQty,item.qty) |
||||
|
// item.Locations.forEach(lco => { |
||||
|
// lco.Batchs.forEach(batch => { |
||||
|
// batch.Records = [] |
||||
|
// }) |
||||
|
// }) |
||||
|
// }) |
||||
|
// }) |
||||
|
// this.$refs.comScanIssuePack.clearList() |
||||
|
scanPopupGetFocus() |
||||
|
} |
||||
|
}); |
||||
|
}else { |
||||
|
//防止重复点击 |
||||
|
proxy.$throttle(submit, 2000, proxy)() |
||||
|
} |
||||
|
} |
||||
|
const scanPopupGetFocus = () => { |
||||
|
if (scanPopup.value != undefined) { |
||||
|
scanPopup.value.packGetFocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const showMessage = (message) => { |
||||
|
comMessageRef.value.showMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
afterCloseMessage(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message) => { |
||||
|
comMessageRef.value.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
afterCloseMessage(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showScanMessage = (message) => { |
||||
|
comMessageRef.value.showScanMessage(message); |
||||
|
}; |
||||
|
|
||||
|
const showCommitSuccess = () => { |
||||
|
comMessageRef.value.showCommitSuccess(); |
||||
|
}; |
||||
|
|
||||
|
const showCommitSuccessMessage = (hint) => { |
||||
|
comMessageRef.value.showSuccessMessage(hint, (res) => { |
||||
|
navigateBack(1); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showRescanMessage = (message) => { |
||||
|
comMessageRef.value.showRescanMessage(message); |
||||
|
}; |
||||
|
|
||||
|
const afterCloseMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const closeScanMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const confirm = (data) => { |
||||
|
dataContent.value = data; |
||||
|
}; |
||||
|
|
||||
|
const confirmResult = (result) => { |
||||
|
dataContent.value = result; |
||||
|
}; |
||||
|
// const openScanDetailPopup = () => { |
||||
|
// const datacontent = {...detailSource.value}; // 深度克隆 |
||||
|
// comScanIssuePack.value.openScanPopup(datacontent, jobContent.value); |
||||
|
// }; |
||||
|
|
||||
|
const closeScanPopup = () => { |
||||
|
// updateCommitBtn(); |
||||
|
}; |
||||
|
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 openScanPopupSimulate = (scanMessage)=> { |
||||
|
comScanIssuePack.value.openScanPopupForJobSimulate(detailSource.value, jobContent.value, scanMessage); |
||||
|
} |
||||
|
const confirmFromLocation = (fromLocationCodeParams)=>{ |
||||
|
fromLocationCode.value = fromLocationCodeParams |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.uni-numbox__value { |
||||
|
width: 40px; |
||||
|
} |
||||
|
|
||||
|
button[disabled] { |
||||
|
background-color: #3C9CFF; |
||||
|
color: #fff; |
||||
|
opacity: 0.7; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// /deep/ .input-value { |
||||
|
// font-size: 16px; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item__title-text { |
||||
|
// font-size: 16px; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item--border { |
||||
|
// border-bottom-width: 0px; |
||||
|
// border-bottom-color: #ebeef5; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item--border { |
||||
|
// border-bottom-width: 1px; |
||||
|
// border-bottom-color: #ebeef5; |
||||
|
// } |
||||
|
</style> |
Loading…
Reference in new issue