diff --git a/src/pages/fg/coms/comNoReceiptPopup.vue b/src/pages/fg/coms/comNoReceiptPopup.vue index aa6ce59a..4a7e9e9b 100644 --- a/src/pages/fg/coms/comNoReceiptPopup.vue +++ b/src/pages/fg/coms/comNoReceiptPopup.vue @@ -99,6 +99,28 @@ + + + + 创建上架申请 + + + + + + + + + + + 创建检验申请 + + + + + @@ -127,7 +149,8 @@ import { getCurrDate, getBatch8, dateFormatData, - lastThreeDays + lastThreeDays, + getSwitchInfoByCode } from '@/common/basic.js'; import { @@ -176,6 +199,9 @@ export default { rawLocationCode: "", workshop: "", bomVersion: "", + putAwayRequestSwitch:true, + putAwayInspectSwitch:true, + EnableQms:true } }, props: { @@ -188,8 +214,10 @@ export default { default: [] }, }, + mounted() { + this.EnableQms = getSwitchInfoByCode('EnableQms') + }, methods: { - openRequestPopup() { this.initData(); this.planDate = getCurrDate() @@ -210,8 +238,8 @@ export default { this.productLineCode = "" this.batch = "" this.packUnitName = "请选择包装规格" - this.packUnit = "", - this.packQtyHint = "" + this.packUnit = "" + this.packQtyHint = "" this.showPackUnitSelect = false // this.packUnitList = [] this.itemCodeList = [] @@ -223,7 +251,9 @@ export default { this.fgLocationCode = "" this.rawLocationCode = "" this.workshop = "" - + this.bomVersion = "" + this.putAwayRequestSwitch = true + this.putAwayInspectSwitch = true }, closeRequestPopup() { @@ -263,7 +293,9 @@ export default { this.showErrorMessage("请选择包装规格") return } - + if (!this.EnableQms) { + this.putAwayInspectSwitch = false + } this.callback(); }, @@ -285,7 +317,10 @@ export default { workStationCode: this.workStationCode, fgLocationCode: this.fgLocationCode, rawLocationCode: this.rawLocationCode, - workshop: this.workshop + workshop: this.workshop, + bomVersion: this.bomVersion, + putAwayRequestSwitch: this.putAwayRequestSwitch, + putAwayInspectSwitch: this.putAwayInspectSwitch }; this.closeRequestPopup(); this.$emit("confirm", item); @@ -474,6 +509,16 @@ export default { return item.label } }, + switchPutAwayRequest(value){ + console.log(value) + console.log("打印"+this.putAwayRequestSwitch) + this.putAwayRequestSwitch = value; + }, + + switchPutAwayInspect(value){ + console.log(value) + this.putAwayInspectSwitch = value; + } } } diff --git a/src/pages/fg/coms/comReceiptPopup.vue b/src/pages/fg/coms/comReceiptPopup.vue index 68d39f9f..83098653 100644 --- a/src/pages/fg/coms/comReceiptPopup.vue +++ b/src/pages/fg/coms/comReceiptPopup.vue @@ -78,6 +78,27 @@ + + + + 创建上架申请 + + + + + + + + + + 创建检验申请 + + + + + @@ -95,7 +116,7 @@ import { getIssueJobByProductionline, getPlaneInfoByproductLine, getPackUnitByItemCode, getProductionlineAndWorkStation } from '@/api/request2.js' import { getPackUnitName, getUomInfo } from '@/common/directory.js' -import { getCurrDate, getBatch8, dateFormatData, lastThreeDays } from '@/common/basic.js' +import { getCurrDate, getBatch8, dateFormatData, lastThreeDay, getSwitchInfoByCode } from '@/common/basic.js' import { calc } from '@/common/calc.js' @@ -138,7 +159,10 @@ export default { showDateSelect: false, planDateList: [], fgLocationCode: '', - rawLocationCode: '' + rawLocationCode: '', + putAwayRequestSwitch:true, + putAwayInspectSwitch:true, + EnableQms:true } }, props: { @@ -151,6 +175,10 @@ export default { default: [] } }, + mounted() { + this.EnableQms = getSwitchInfoByCode('EnableQms') + console.log(777,this.EnableQms) + }, methods: { openRequestPopup() { this.initData() @@ -185,6 +213,8 @@ export default { this.planDateList = [] this.fgLocationCode = '' this.rawLocationCode = '' + this.putAwayRequestSwitch=true + this.putAwayInspectSwitch=true }, closeRequestPopup() { @@ -220,7 +250,9 @@ export default { this.showErrorMessage('请选择包装规格') return } - + if (!this.EnableQms) { + this.putAwayInspectSwitch = false + } this.callback() }, @@ -240,7 +272,9 @@ export default { planNumber: this.planNumber, workStationCode: this.workStationCode, fgLocationCode: this.fgLocationCode, - rawLocationCode: this.rawLocationCode + rawLocationCode: this.rawLocationCode, + putAwayRequestSwitch:this.putAwayRequestSwitch, + putAwayInspectSwitch:this.putAwayInspectSwitch } this.closeRequestPopup() this.$emit('confirm', item) @@ -336,6 +370,8 @@ export default { // this.packUnitList = [] this.itemCodeList = [] this.showSelectItemCode() + this.putAwayRequestSwitch=true + this.putAwayInspectSwitch=true }, showItemList() { @@ -466,7 +502,18 @@ export default { return uom } return item.label + }, + switchPutAwayRequest(value){ + console.log(value) + console.log("打印"+this.putAwayRequestSwitch) + this.putAwayRequestSwitch =value; + }, + + switchPutAwayInspect(value){ + console.log(value) + this.putAwayInspectSwitch =value; } + } } diff --git a/src/pages/fg/receiptByPlan.vue b/src/pages/fg/receiptByPlan.vue index e178813f..597ac2ec 100644 --- a/src/pages/fg/receiptByPlan.vue +++ b/src/pages/fg/receiptByPlan.vue @@ -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,71 +260,65 @@ 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) - }) - } 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() + 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 + }) + 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('提交成功
生成装配收货记录
', 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("提交成功
生成装配收货记录
" + list[0].requestNumber, list) + nextTick(() => { + showCommitSuccessMessage(hintMsg, list) }) } catch (error) { uni.hideLoading() const hint = error.message ? error.message : error - showErrorMessage(hint) + 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 = () => { @@ -407,15 +409,21 @@ const scanPopupLoseFocus = () => { const getH5BatchPrintingLable = (number)=> { batchPrintingLable(number).then(resLable => { console.log('batchPrintingLable', resLable) - const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712` - const webData = { - token: storage.getStorage(storage.constant.token), - asn_number: resLable.data + 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), + asn_number: resLable.data + } + uni.navigateTo({ + url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` + }); + }else { + showErrorMessage(number + "批量打印标签 H5失败") } - uni.navigateTo({ - url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` - }); }).catch(error => { + uni.hideLoading() showErrorMessage(error) }) } @@ -432,17 +440,31 @@ const print = (pointData)=> { pointData.forEach(item=>{ packingNumber.push(item.packageCode) }) - if(packingNumber.length==0){ + if(packingNumber.length == 0){ showErrorMessage('包装号不能为空!') return } + uni.showLoading({ + title: "正在获取打印信息", + mask: true + }) getBalanceToPackage({ packingNumber: packingNumber.join(',') }).then(res => { console.log('PC打印', res) - getH5BatchPrintingLable(res.data.number) - + 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(); + } + }); +}