|
|
@ -102,12 +102,13 @@ import { ref, getCurrentInstance, nextTick } from 'vue' |
|
|
|
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
|
import { isCheckMesCode, planReceiptSubmit, |
|
|
|
createPutawayRequestByPlan, createInspectRequestByPlan, |
|
|
|
getPlanByNumber,getBalanceToPackage, |
|
|
|
getPlanByNumber,getBalanceToPackage,createByPlanSubmit, |
|
|
|
batchPrintingLable } from '@/api/request2.js' |
|
|
|
import { calc } from '@/common/calc.js' |
|
|
|
import storage from '@/common/utils/storage.js' |
|
|
|
import { getRemoveOption, deepCopyData, |
|
|
|
getCurrDateTime, compare,getSwitchInfoByCode} from '@/common/basic.js' |
|
|
|
import {Exception} from 'sass'; |
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
|
import comReceiptPopup from '@/pages/fg/coms/comReceiptPopup.vue' |
|
|
@ -129,7 +130,8 @@ const pageSize = ref(500) |
|
|
|
const comReceiptPopupRef = ref() |
|
|
|
const scanPopup = ref() |
|
|
|
const comMessageRef = ref() |
|
|
|
|
|
|
|
const settingPutAwayRequestSwitch = ref(true) |
|
|
|
const settingPutAwayInspectSwitch = ref(true) |
|
|
|
onLoad(() => { |
|
|
|
options.value = getRemoveOption() |
|
|
|
openFg() |
|
|
@ -174,8 +176,12 @@ const requestConfirm = (result) => { |
|
|
|
packUnit: result.packUnit, |
|
|
|
workStationCode: result.workStationCode, |
|
|
|
fgLocationCode: result.fgLocationCode, |
|
|
|
putAwayRequestSwitch: result.putAwayRequestSwitch, |
|
|
|
putAwayInspectSwitch: result.putAwayInspectSwitch, |
|
|
|
subList: [] |
|
|
|
} |
|
|
|
settingPutAwayRequestSwitch.value = result.putAwayRequestSwitch |
|
|
|
settingPutAwayInspectSwitch.value = result.putAwayInspectSwitch |
|
|
|
} |
|
|
|
const initList = () => { |
|
|
|
index.value = 1 |
|
|
@ -221,7 +227,9 @@ const submit = () => { |
|
|
|
} |
|
|
|
|
|
|
|
const commit = async () => { |
|
|
|
let list = [] |
|
|
|
try { |
|
|
|
let startTime = new Date() |
|
|
|
uni.showLoading({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
@ -230,9 +238,9 @@ const commit = async () => { |
|
|
|
console.log(JSON.stringify(params)) |
|
|
|
|
|
|
|
const list = [] |
|
|
|
const planData = await planReceiptSubmit(params) |
|
|
|
if (planData.data) { |
|
|
|
planData.data.forEach((item) => { |
|
|
|
const planData = await createByPlanSubmit(params) |
|
|
|
if (planData.data.tb1 && planData.data.tb1.length > 0) { |
|
|
|
planData.data.tb1.forEach((item) => { |
|
|
|
list.push({ |
|
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
|
itemName: item.itemName, // 物品名称 |
|
|
@ -252,73 +260,67 @@ const commit = async () => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
throw new Error('提交失败') |
|
|
|
throw new Error('提交失败未获取到打印信息') |
|
|
|
} |
|
|
|
|
|
|
|
//装配收货记录 生成后 创建 制品上架申请 |
|
|
|
let createProductputawaySwitch = getSwitchInfoByCode( |
|
|
|
"CreateProductputawayRequestAfterProductreceiptRecordCreated") |
|
|
|
if (createProductputawaySwitch) { |
|
|
|
createPutawayRequestByPlan(list[0].requestNumber).then(res => { |
|
|
|
createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
if (planData.data.tb2 && planData.data.tb2.list.length > 0) { |
|
|
|
let planInfo = planData.data.tb2.list[0] |
|
|
|
if (planInfo.goodQty >= planInfo.planQty) { |
|
|
|
uni.showToast({ |
|
|
|
title:"计划已完成", |
|
|
|
duration:2000 |
|
|
|
}) |
|
|
|
} else { //创建检验申请 |
|
|
|
createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
|
|
|
|
const queryParams = { |
|
|
|
filters: [ |
|
|
|
{ |
|
|
|
column: 'plan_type', |
|
|
|
action: '==', |
|
|
|
value: 'assemble' |
|
|
|
}, |
|
|
|
{ |
|
|
|
column: 'number', |
|
|
|
action: '==', |
|
|
|
value: dataContent.value.planNumber |
|
|
|
} |
|
|
|
], |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100 |
|
|
|
} |
|
|
|
let isAllSubmit = Number(Number(dataContent.value.goodQty)+ Number(showList.value.length))==Number(dataContent.value.planQty) |
|
|
|
const planeInfo = await getPlanByNumber(queryParams) |
|
|
|
if (planeInfo.data && planeInfo.data.list.length > 0) { |
|
|
|
if (planeInfo.data.list[0].goodQty >= planeInfo.data.list[0].planQty) { |
|
|
|
clear() |
|
|
|
clearData() |
|
|
|
} else { |
|
|
|
dataContent.value.planNumber = planeInfo.data.list[0].number |
|
|
|
dataContent.value.handleQty = 0 |
|
|
|
dataContent.value.planQty = planeInfo.data.list[0].planQty |
|
|
|
dataContent.value.goodQty = planeInfo.data.list[0].goodQty |
|
|
|
;(dataContent.value.noGoodQty = calc.sub(planeInfo.data.list[0].planQty, planeInfo.data.list[0].goodQty)), (dataContent.value.subList = []) |
|
|
|
//更新已完工数和未完工数 |
|
|
|
dataContent.value.planQty = planInfo.data.list[0].planQty |
|
|
|
dataContent.value.goodQty = planInfo.data.list[0].goodQty |
|
|
|
dataContent.value.noGoodQty = calc.sub(planInfo.planQty, planInfo.goodQty) |
|
|
|
dataContent.value.handleQty = 0; |
|
|
|
dataContent.value.subList = [] |
|
|
|
showList.value = [] |
|
|
|
allList.value = [] |
|
|
|
index.value = 1 |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new Error('未查找到单据信息') |
|
|
|
throw new Error('提交失败未获取到计划信息') |
|
|
|
} |
|
|
|
uni.hideLoading() |
|
|
|
let hintMsg = "提交成功\n生成装配收货记录\n"; |
|
|
|
// showCommitSuccessMessage('提交成功<br>生成装配收货记录<br>', list) |
|
|
|
if(isAllSubmit){ |
|
|
|
clearData() |
|
|
|
}else { |
|
|
|
showList.value = []; |
|
|
|
allList.value = []; |
|
|
|
index.value = 1; |
|
|
|
dataContent.value.handleQty = 0; |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
hintMsg += list[0].requestNumber |
|
|
|
} |
|
|
|
nextTick(() => { |
|
|
|
showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + list[0].requestNumber, list) |
|
|
|
showCommitSuccessMessage(hintMsg, list) |
|
|
|
}) |
|
|
|
} catch (error) { |
|
|
|
uni.hideLoading() |
|
|
|
const hint = error.message ? error.message : error |
|
|
|
if (hint.indexOf('请返回开工阶段') > -1) { |
|
|
|
showMessage('计划已完成') |
|
|
|
clearData() |
|
|
|
} else { |
|
|
|
showErrorMessage(hint) |
|
|
|
} |
|
|
|
} |
|
|
|
startSetting(list) |
|
|
|
} |
|
|
|
const startSetting = async (list)=> { |
|
|
|
//创建上架申请 |
|
|
|
if (settingPutAwayRequestSwitch.value) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createPutawayRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//创建检验申请 |
|
|
|
if (settingPutAwayInspectSwitch.value) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const setParams = () => { |
|
|
|
allList.value.forEach((res) => { |
|
|
|
res.outsideItemCode = res.itemCode |
|
|
@ -407,6 +409,8 @@ const scanPopupLoseFocus = () => { |
|
|
|
const getH5BatchPrintingLable = (number)=> { |
|
|
|
batchPrintingLable(number).then(resLable => { |
|
|
|
console.log('batchPrintingLable', resLable) |
|
|
|
uni.hideLoading() |
|
|
|
if(resLable.data){ |
|
|
|
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712` |
|
|
|
const webData = { |
|
|
|
token: storage.getStorage(storage.constant.token), |
|
|
@ -415,7 +419,11 @@ const getH5BatchPrintingLable = (number)=> { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` |
|
|
|
}); |
|
|
|
}else { |
|
|
|
showErrorMessage(number + "批量打印标签 H5失败") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
@ -436,13 +444,27 @@ const print = (pointData)=> { |
|
|
|
showErrorMessage('包装号不能为空!') |
|
|
|
return |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title: "正在获取打印信息", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
getBalanceToPackage({ |
|
|
|
packingNumber: packingNumber.join(',') |
|
|
|
}).then(res => { |
|
|
|
console.log('PC打印', res) |
|
|
|
if (res.data && res.data.number) { |
|
|
|
getH5BatchPrintingLable(res.data.number) |
|
|
|
|
|
|
|
} else { |
|
|
|
uni.hideLoading() |
|
|
|
let hint = "" |
|
|
|
packingNumber.forEach(item => { |
|
|
|
hint += item |
|
|
|
}) |
|
|
|
hint += "根据库存余额获取包装信息" |
|
|
|
showErrorMessage(hint) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error) |
|
|
|
}) |
|
|
|
// #endif |
|
|
@ -459,11 +481,16 @@ const showErrorMessage = (message) => { |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const showMessage = (message)=> { |
|
|
|
comMessageRef.value.showMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
openFg(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
|
|
|
|
|
|
|
.item { |
|
|
|
background-color: #fff; |
|
|
|
} |
|
|
|