| | |
| | | classes: '', |
| | | //责任工序 |
| | | responsibleProcess: '', |
| | | //包装方式 |
| | | packagingMethod:'', |
| | | order: { |
| | | //客户编号 |
| | | customerId: '', |
| | |
| | | |
| | | }) |
| | | |
| | | let btnValue=company.storageBtn |
| | | let teamsTypeValue=company.teamsType |
| | | //是否点击报工入库 |
| | | let storageBtn = ref(false) |
| | | //箱号 库位 备注 |
| | | const storageRegion = ref(null); |
| | | const container = ref(null); |
| | | const remark = ref(null); |
| | | |
| | | //包装方式 |
| | | const mannerPacking = ref(null) |
| | | const mannerPackingOp = [ |
| | | // { |
| | | // value: t('reportingWorks.early'), |
| | | // label: t('reportingWorks.early'), |
| | | // }, |
| | | // { |
| | | // value: t('reportingWorks.nightShift'), |
| | | // label: t('reportingWorks.nightShift'), |
| | | // }, |
| | | { |
| | | value: '木箱', |
| | | label: '木箱', |
| | | }, |
| | | { |
| | | value: '铁架', |
| | | label: '铁架', |
| | | }, |
| | | { |
| | | value: '倒架', |
| | | label: '倒架', |
| | | }, |
| | | ] |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | |
| | | && titleUploadData.value.thisProcess!=null){ |
| | | getWork() |
| | | getQuantity() |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | // {code: 'sameOneDamage', name: '次破一列相同'}, |
| | | {code: 'saveReportingWork', name: t('basicData.save'), status: 'primary', icon: 'vxe-icon-save',disabled:true}, |
| | | {code: 'saveReportingWorkReview', name: t('reportingWorks.saveAndReview'), status: 'primary', icon: 'vxe-icon-save',disabled:true}, |
| | | {code: 'saveWorkStorage', name: t('reportingWorks.saveWorkStorage'), status: 'primary', icon: 'vxe-icon-save'}, |
| | | ], |
| | | // import: false, |
| | | // export: true, |
| | |
| | | // }) |
| | | |
| | | break |
| | | } |
| | | case 'saveWorkStorage':{ |
| | | if(xGrid.value.getTableData().fullData.length===0){ |
| | | ElMessage.warning(t('reportingWorks.selectProcessCardData')) |
| | | return |
| | | } |
| | | const device = titleUploadData.value.deviceName |
| | | if(device === null || device === undefined || device === ''){ |
| | | ElMessage.error(t('reportingWorks.selectWorkReportingEquipment')) |
| | | return |
| | | } |
| | | const teamsGroupsName = titleUploadData.value.teamsGroupsName |
| | | if(teamsGroupsName === null || teamsGroupsName === undefined || teamsGroupsName === ''){ |
| | | ElMessage.error(t('reportingWorks.selectWorkReportingTeam')) |
| | | return |
| | | } |
| | | |
| | | if (mannerPacking.value === null || mannerPacking.value === undefined || mannerPacking.value === ''){ |
| | | ElMessage.error(t('reportingWorks.msgMannerPacking')) |
| | | return |
| | | } |
| | | const parts = technologicalProcess.split('->'); |
| | | const last = parts[parts.length - 1]; |
| | | let processId = titleUploadData.value.processId |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | | const resultProcessId = processId.match(regex); |
| | | //流程卡号 |
| | | let processIdStr = resultProcessId[1]; |
| | | //层号 |
| | | let technologyStr = resultProcessId[2]; |
| | | if (last != titleUploadData.value.thisProcess){ |
| | | ElMessage.error('请选择最后工序报工入库') |
| | | return |
| | | } |
| | | storageBtn.value = true |
| | | //报工新增 |
| | | saveReportingWork(0,'save') |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | //第一次加载数据 |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | const initTiltle = async () => { |
| | | hideButton() |
| | | await request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process |
| | |
| | | return false |
| | | } |
| | | } |
| | | |
| | | //包装方式 |
| | | titleUploadData.value.packagingMethod = mannerPacking.value |
| | | titleUploadData.value.creator = user.user.userName |
| | | titleUploadData.value.creatorId = user.user.userId |
| | | const requestDetailData = xGrid.value.getTableData().fullData.filter((row) => { |
| | |
| | | request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success(t('reportingWorks.successfulJobApplication')) |
| | | //报工入库 |
| | | if(storageBtn.value == true){ |
| | | getStorageWork(); |
| | | } |
| | | router.push({path:'/main/reportingWorks/AddReportingWork',query:{processId:titleUploadData.value.processId,random:Math.random()}}) |
| | | }else{ |
| | | const errorObj = JSON.parse(res.msg) |
| | |
| | | //设备下拉框 |
| | | titleSelectJson.value.deviceType = res.data.device |
| | | //班组下拉框 |
| | | //titleSelectJson.value.teamsType = res.data.teams |
| | | if (teamsTypeValue==true){ |
| | | titleSelectJson.value.teamsType = res.data.teams |
| | | } |
| | | |
| | | //当前流程卡工序 |
| | | titleSelectJson.value.thisProcessType = res.data.thisProcess |
| | | //历史班组 |
| | |
| | | } |
| | | }) |
| | | |
| | | |
| | | //报工入库方法 |
| | | const getStorageWork = () => { |
| | | let processId = titleUploadData.value.processId |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | | const resultProcessId = processId.match(regex); |
| | | //流程卡号 |
| | | let processIdStr = resultProcessId[1]; |
| | | //层号 |
| | | let technologyStr = resultProcessId[2]; |
| | | //开始处理入库需要的数据 |
| | | let rawData = xGrid.value.getTableData().fullData |
| | | const seen = new Set(); |
| | | const result = rawData.filter(item => { |
| | | // 1. 先把 completedQuantity 为 0 的剔除 |
| | | if (item.completedQuantity === 0) { |
| | | return false; |
| | | } |
| | | // 2. 遇到相同 order_number,只保留第一次,后面都丢弃 |
| | | if (seen.has(item.order_number)) { |
| | | return false; |
| | | } |
| | | seen.add(item.order_number); |
| | | return true; |
| | | }); |
| | | |
| | | // 给每条记录追加 order 字段 |
| | | const resultData = result.map(item => ({ |
| | | ...item, |
| | | order: { |
| | | orderId: titleUploadData.value.orderId |
| | | }, |
| | | processId:processIdStr, |
| | | orderNumber:item.order_number |
| | | })); |
| | | let flowData = ref({ |
| | | decValue:company.decValue, |
| | | userId: user.user.userId, |
| | | userName: user.user.userName, |
| | | storageRegion: storageRegion.value, |
| | | remark: remark.value, |
| | | container: container.value, |
| | | flowCard: resultData, |
| | | }) |
| | | //调用入库接口 |
| | | request.post("/finishedGoodsInventory/addSelectWarehousing",flowData.value).then((res) => { |
| | | if(res.code==200 && res.data==="true"){ |
| | | ElMessage.success(t('productStock.receivedSuccessfully')) |
| | | // router.push({path:'/maiggn/productStock/CreateProductStock',query:{random:Math.random()}}) |
| | | }else if(res.data==="false1"){ |
| | | ElMessage.warning(t('basicData.msg.quantityError')) |
| | | }else if(res.data==="false2"){ |
| | | ElMessage.warning(t('basicData.msg.dataDoesNotExist')) |
| | | }else{ |
| | | ElMessage.warning(t('productStock.entryFailure')) |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | | router.push("/login") |
| | | }) |
| | | } |
| | | |
| | | const hideButton = () => { |
| | | if (btnValue == false){ |
| | | const els = document.querySelectorAll('.inventory_content'); |
| | | els.forEach(el => { |
| | | el.style.display = 'none'; |
| | | }); |
| | | } |
| | | gridOptions.toolbarConfig.buttons = gridOptions.toolbarConfig.buttons.filter(button => { |
| | | // 如果 type 不为空时,隐藏 print 按钮 |
| | | if (btnValue == false && button.code === 'saveWorkStorage') { |
| | | return false; // 隐藏 print 按钮 |
| | | } |
| | | |
| | | |
| | | // 默认返回 true,表示保留按钮 |
| | | return true; |
| | | }); |
| | | }; |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | |
| | | <el-button :disabled="disabledFlag" :loading="loadingFlag" @click="reviewReportingWork" type="primary">{{$t('reportingWorks.passAudit')}} |
| | | </el-button> |
| | | |
| | | <span class="inventory_content"> |
| | | <el-select style="width: 100px" v-model="mannerPacking" class="processesSt" :placeholder="$t('reportingWorks.mannerPacking')"> |
| | | <el-option |
| | | v-for="item in mannerPackingOp" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-input style="width: 100px" v-model="container" class="m-2" :placeholder="$t('productStock.pleaseEnterTheBoxNumber')"> |
| | | </el-input> |
| | | <el-input style="width: 100px" v-model="storageRegion" class="m-2" :placeholder="$t('productStock.pleaseEnterTheStorageLocation')"> |
| | | </el-input> |
| | | <el-input style="width: 200px" v-model="remark" class="m-2" :placeholder="$t('productStock.pleaseEnterANote')"> |
| | | </el-input> |
| | | </span> |
| | | <!-- <el-button type="primary">审核不通过</el-button>--> |
| | | |
| | | <label>{{technologicalProcess}}</label> |
| | |
| | | <el-option |
| | | v-for="item in titleSelectJson['teamsType']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName" |
| | | :label="item.user_name" |
| | | :value="item.user_name" |
| | | /> |
| | | </el-select> |
| | | </el-col> |