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