| | |
| | | import {computed, nextTick, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; |
| | | import {useRouter,useRoute} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {ElCheckbox, ElMessage} from "element-plus"; |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import domZIndex from 'dom-zindex' |
| | | import {indexOf} from "xe-utils"; |
| | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const user=userInfo() |
| | | //是否复合工序 |
| | | const laminating = ref(null) |
| | | |
| | | //定义表头数据 |
| | | const titleUploadData = ref({ |
| | | //是否合片工序 |
| | | laminating:'', |
| | | reportingWorkId: null, |
| | | //流程卡号 |
| | | processId: null, |
| | |
| | | classes: '', |
| | | //责任工序 |
| | | responsibleProcess: '', |
| | | //包装方式 |
| | | packagingMethod:'', |
| | | order: { |
| | | //客户编号 |
| | | customerId: '', |
| | |
| | | let detail = ref([]) |
| | | let layer='' |
| | | let technologicalProcess='' |
| | | let processName = ref([]) |
| | | |
| | | //隐藏全部完工序号 |
| | | let hiddenVal = ref(1) |
| | | |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | |
| | | |
| | | }) |
| | | |
| | | 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: t('reportingWorks.woodenBox'), |
| | | label: t('reportingWorks.woodenBox'), |
| | | }, |
| | | { |
| | | value: t('reportingWorks.brandreth'), |
| | | label: t('reportingWorks.brandreth'), |
| | | }, |
| | | { |
| | | value: t('reportingWorks.tilting'), |
| | | label: t('reportingWorks.tilting'), |
| | | }, |
| | | ] |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | | onMounted(async () =>{ |
| | | await initTiltle() |
| | | if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){ |
| | | titleUploadData.value.processId = route.query.processId |
| | | //当质检审核后加载明细信息 |
| | | if(route.query.reviewStatus === '1'){ |
| | | if(titleUploadData.value.thisProcess !== undefined |
| | | && titleUploadData.value.thisProcess!=='' |
| | | && titleUploadData.value.thisProcess!=null){ |
| | | getWork() |
| | | getQuantity() |
| | | |
| | | } |
| | | } |
| | | } |
| | | //route.query.reportingWorkId = 'BG2403150004' |
| | | //判断是否传入报工编号 |
| | | if(route.query.reportingWorkId !== '' && route.query.reportingWorkId!=null){ |
| | | gridOptions.loading = true |
| | | request.post(`reportingWork/selectUpdateReportingWork/${route.query.reportingWorkId}`).then(res=>{ |
| | | if(res.code === '200'){ |
| | | titleUploadData.value = res.data.reportingWork |
| | |
| | | code: 'update', |
| | | name: t('basicData.update'), |
| | | status: 'primary', |
| | | disabled:'false' |
| | | } |
| | | if(route.query.reviewStatus === "1"){ |
| | | button.name=t('basicData.review') |
| | | titleUploadData.value.qualityInspector=user.user.userName |
| | | } |
| | | |
| | | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | for (let i = 0; i < res.data.reportingWorkDetails.length; i++) { |
| | | if (res.data.reportingWorkDetails[i].patchStatusOther === '已补片') { |
| | | gridOptions.toolbarConfig.buttons[2].disabled=true |
| | | break |
| | | } |
| | | else{ |
| | | gridOptions.toolbarConfig.buttons[2].disabled=false |
| | | } |
| | | } |
| | | } |
| | | // getQuantity() |
| | | gridOptions.loading = false |
| | | inputDisabled.value = true |
| | | }) |
| | | } |
| | |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | // remote: true |
| | | // remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | |
| | | }, |
| | | menuConfig: { |
| | | body: { |
| | | //右键菜单 |
| | | //右键菜单 |
| | | options: [ |
| | | [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | code: 'SecondaryBreakage', |
| | | name: "序号次破相同", |
| | | name: t('reportingWorks.secondaryBreakage'), |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'checkedBreakage', |
| | | name: "选中次破相同", |
| | | name: t('reportingWorks.checkedBreakage'), |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | |
| | | }, |
| | | {field: 'completed', width: 90, title:t('reportingWorks.completed'),}, |
| | | {field: 'onceBroken', width: 90, title: t('reportingWorks.onceBroken'),}, |
| | | { |
| | | field: 'reviewed_state', |
| | | title: t('processCard.reviewedState'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | |
| | | ], |
| | | //表单验证 |
| | | editRules: { |
| | | completedQuantity: [ |
| | | { |
| | | validator ({ row }) { |
| | | validator ({ row ,cellValue }) { |
| | | const regex = /^[0-9]\d*$/ |
| | | const brokenNum = |
| | | (row.breakageQuantity === undefined || row.breakageQuantity===null) ? 0 : row.breakageQuantity |
| | | //整数验证 |
| | | if (row.completedQuantity && !regex.test(row.completedQuantity)) { |
| | | return new Error(t('reportingWorks.enterIntegerGreaterThanEqualTo')) |
| | | //完工+次破数量不能大于可完工数量 |
| | | }else if((row.completedQuantity*1+brokenNum*1)>row.quantity*1){ |
| | | return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`)) |
| | | return new Error(t('reportingWorks.pleaseNumber11')) |
| | | //本次完工数量不能大于完工数量 |
| | | }else if(row.quantity_card<row.completedQuantity){ |
| | | return new Error("完工数不能大于流程卡数量") |
| | | return new Error(t('reportingWorks.pleaseNumber10')) |
| | | } |
| | | const nextProcess = titleUploadData.value.nextProcess//下工序 |
| | | |
| | | const completedSum = Number(row.thisQuantitySum) //总完工数量 |
| | | let nextQuantitySum = '' |
| | | if (nextProcess!=''){ |
| | | nextQuantitySum = Number(row.nextQuantitySum) //总下工序完工数量 |
| | | }else { |
| | | nextQuantitySum = Number(row.received_quantity) //总下工序完工数量 |
| | | } |
| | | const totalQuantity = Number(row.quantity) //可完工数量 |
| | | const val = Number(cellValue) //输入值 |
| | | |
| | | //完工数 |
| | | const completedNum = |
| | | (row.completedQuantity === undefined || row.completedQuantity===null || row.completedQuantity==='') ? 0 : row.completedQuantity |
| | | if(titleUploadData.value.reportingWorkId!=null && completedNum>row.minQuantity){ |
| | | return new Error(`${t('reportingWorks.pleaseGreaterThanOrEqual1')} |
| | | ${row.minQuantity} |
| | | ${t('reportingWorks.pleaseGreaterThanOrEqual2')}`) |
| | | } |
| | | // |
| | | const okVal = completedSum - totalQuantity + row.breakageQuantity |
| | | |
| | | //当可操作数量为0,并且完工数量不等于可完工数量时 |
| | | if(row.minQuantity===0 && val!==(totalQuantity-row.breakageQuantity) ){ |
| | | return new Error(`${t('reportingWorks.pleaseNumber12')} ${okVal}+${val}=${okVal+val}\n |
| | | ${t('reportingWorks.pleaseNumber13')} ${nextQuantitySum}\n |
| | | ${t('reportingWorks.pleaseNumber14')} |
| | | `) |
| | | } |
| | | if(titleUploadData.value.reportingWorkId!=null){ |
| | | if (nextProcess!=''){//非最后一道工序 |
| | | if(row.completedQuantityComputed>=row.minQuantity ){ |
| | | if((val<(row.completedQuantityComputed-row.minQuantity || val>=row.completedQuantityComputed))){ |
| | | return new Error(`${row.completedQuantityComputed-row.minQuantity} |
| | | <=val<= |
| | | ${row.completedQuantityComputed}`) |
| | | } |
| | | }else{ |
| | | if((val>row.completedQuantityComputed)){ |
| | | return new Error(`val |
| | | <= |
| | | ${row.completedQuantityComputed}`) |
| | | } |
| | | } |
| | | }else {//最后一道工序 |
| | | if (val<row.completedQuantityComputed){ |
| | | //库存数量、已入库数量 |
| | | if (val>(row.inventory_quantity-row.received_quantity)){ |
| | | return new Error(`val |
| | | <= |
| | | ${row.inventory_quantity-row.received_quantity}`) |
| | | }else { |
| | | if (val < (row.inventory_quantity-row.received_quantity)){ |
| | | //完工总数、本次完工数、已入库数量 |
| | | if (completedSum-row.completedQuantityComputed <row.received_quantity){ |
| | | return new Error(`${t('reportingWorks.pleaseNumber15')}`) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | toolbarConfig: {//表头按钮 |
| | | buttons: [ |
| | | // {code: 'empty', name: '清空报工数量'}, |
| | | // {code: 'sameCompletion', name: '完工相同'}, |
| | | // {code: 'sameDamage', name: '次破相同'}, |
| | | // {code: 'sameOneCompletion', name: '完工一列相同'}, |
| | | // {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, |
| | | // print: true, |
| | | // slots: { |
| | | // tools: 'toolbar_buttons' |
| | | // }, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'saveReportingWork': { |
| | | case 'saveReportingWork': {//保存 |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | |
| | | saveReportingWork(1,'save') |
| | | break |
| | | } |
| | | case 'update': { |
| | | case 'update': {//修改 |
| | | //根据补片状态判断是否能修改 |
| | | // request.post(`/reportingWork/getPatchCondition/${route.query.reportingWorkId}`).then(async (res) => { |
| | | // if (res.code == 200) { |
| | |
| | | |
| | | 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(t('reportingWorks.pleaseNumber16')) |
| | | return |
| | | } |
| | | storageBtn.value = true |
| | | //报工新增 |
| | | saveReportingWork(0,'save') |
| | | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | cellDblclick (params) {//表格内容双击打开产品界面 |
| | | cellDblclick (params) {//表格内容双击打开次破界面 |
| | | const { row } = params |
| | | brokenRow.value = row |
| | | if(brokenRow.value.damageDetails=== undefined){ |
| | |
| | | const { rows, column, cell } = params; // 解构获取行、列和单元格信息 |
| | | //点击次破数量时打开明细界面 |
| | | if(column.field=="breakageQuantity"){ |
| | | if (row.patchStatusOther!="已补片"){ |
| | | // if (row.patchStatusOther!="已补片"){ |
| | | brokenVisible.value = true |
| | | } |
| | | //} |
| | | } |
| | | }, |
| | | menuClick({menu, row, column}) { |
| | | menuClick({menu, row, column}) {//右键菜单 |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | |
| | | }, |
| | | { |
| | | field: 'responsiblePersonnel', |
| | | title: '责任信息', |
| | | title: t('rework.responsibilityInformation'), |
| | | editRender: {name: 'input', attrs: {placeholder: ''}} |
| | | |
| | | }, |
| | |
| | | } |
| | | } |
| | | } |
| | | const openedBrokenTable = () => { |
| | | |
| | | const brokenGridKey = ref(0) |
| | | const openedBrokenTable = async () => { |
| | | brokenGridKey.value++ |
| | | await nextTick() |
| | | console.log('breakageType:', titleSelectJson.value.breakageType) |
| | | console.log('breakageReason:', titleSelectJson.value.breakageReason) |
| | | //addListener(brokenGrid.value,brokenGridOptions) |
| | | let damage =ref(brokenRow.value.damageDetails) |
| | | brokenGrid.value.reloadData(damage.value) |
| | |
| | | }) |
| | | const maxQuantity = Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0)) |
| | | let process = titleUploadData.value.thisProcess |
| | | let laminating = titleUploadData.value.laminating |
| | | equalByOrderNum.forEach((row) =>{ |
| | | if (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框'){ |
| | | if (laminating != ''){ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | |
| | | |
| | | //第一次加载数据 |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = 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 |
| | | processName = res.data.processNameList |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = false |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | function checkSameNumForId(data, targetId) { |
| | | // 初始化一个对象来存储遇到的id及其对应的num值 |
| | |
| | | return |
| | | } |
| | | |
| | | const reportingWorkTime = titleUploadData.value.reportingWorkTime |
| | | const currentTime = new Date() |
| | | const targetTime = new Date(reportingWorkTime) |
| | | //未来时间 |
| | | if (targetTime > currentTime) { |
| | | ElMessage.error(t('reportingWorks.futureTime')) |
| | | return |
| | | } |
| | | // 两个时间的毫秒差 |
| | | const diffMs = currentTime - targetTime |
| | | // 转换为天数 |
| | | const diffDays = diffMs / (1000 * 60 * 60 * 24) |
| | | if (diffDays > 396 && saveType!="update") { |
| | | ElMessage.error(t('reportingWorks.longTime')) |
| | | return |
| | | } |
| | | |
| | | const seenIds = {} |
| | | const uniqueByOrderNum = xGrid.value.getTableData().fullData.filter(item => { |
| | | // 检查item的id是否已经在seenIds中 |
| | |
| | | return item.saveFlag === 0 |
| | | }) |
| | | let process = titleUploadData.value.thisProcess |
| | | //暂时取消 |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number ) && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | | const result = processName.find(item => item.basic_name === process); |
| | | const nickname = result ? result.nickname : null; |
| | | if(!checkSameNumForId(notFinishList,item.order_number ) && nickname && nickname.includes('step')){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}: |
| | | ${item.order_number} |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber1')}`) |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber2')}`) |
| | | 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) => { |
| | |
| | | } |
| | | gridOptions.toolbarConfig.buttons[0].disabled=true |
| | | gridOptions.toolbarConfig.buttons[1].disabled=true |
| | | gridOptions.loading=true |
| | | //判断保存还是修改 |
| | | if(saveType==='save'){ |
| | | saveReportingWorkRequest(requestData) |
| | |
| | | request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success(t('reportingWorks.successfulJobApplication')) |
| | | //报工入库 |
| | | if(storageBtn.value == true){ |
| | | getStorageWork(); |
| | | } |
| | | gridOptions.loading=false |
| | | router.push({path:'/main/reportingWorks/AddReportingWork',query:{processId:titleUploadData.value.processId,random:Math.random()}}) |
| | | }else{ |
| | | const errorObj = JSON.parse(res.msg) |
| | |
| | | +t('reportingWorks.pleaseNumber3')+':'+errorObj.processNum+'<'+ |
| | | +t('reportingWorks.pleaseNumber4')+':'+errorObj.sumNum+'\n' |
| | | +t('reportingWorks.pleaseNumber5') |
| | | |
| | | gridOptions.loading=false |
| | | ElMessage.error(msg) |
| | | } |
| | | }).catch(err =>{ |
| | | ElMessage.error('提交失败,请刷新后重试') |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | | gridOptions.loading=false |
| | | }).finally(()=>{ |
| | | |
| | | gridOptions.toolbarConfig.buttons[0].disabled=false |
| | | gridOptions.toolbarConfig.buttons[1].disabled=false |
| | | gridOptions.loading=false |
| | | }) |
| | | } |
| | | |
| | |
| | | reviewState = 'review' |
| | | } |
| | | request.post(`/reportingWork/updateReportingWork/${reviewState}`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | if (res.code == 200 && res.data===true){ |
| | | ElMessage.success(t('reportingWorks.successfulModificationOfWorkApplication')) |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | random:Math.random()} |
| | | }) |
| | | } else { |
| | | ElMessage.warning(t('reportingWorks.changeFailed')) |
| | | } |
| | | }) |
| | | } |
| | |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | reviewStatus:1, |
| | | random:Math.random() |
| | | } |
| | | }) |
| | |
| | | |
| | | //下拉款选择工序时查询 |
| | | const getWork = () => { |
| | | |
| | | let processId = titleUploadData.value.processId |
| | | if (processId == "" || processId == null) { |
| | | ElMessage.warning(t('reportingWorks.theProcessCardNumberCannotBeEmpty')) |
| | |
| | | titleUploadData.value = res.data.data |
| | | titleUploadData.value.processId = processId |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | titleUploadData.value.laminating = res.data.laminating |
| | | //设备下拉框 |
| | | 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 |
| | | //历史班组 |
| | |
| | | |
| | | //判断早晚班 |
| | | titleUploadData.value.classes=t('reportingWorks.early') |
| | | titleUploadData.value.reportingWorkTime = formatCurrentTime() |
| | | |
| | | //处理编号列 |
| | | //定义存放编号数组 |
| | | const s01Values = []; |
| | | for (let i = 0; i < res.data.Detail.length; i++) { |
| | | const s01Values = []; |
| | | // 遍历 detailList 数组,提取 S01 值到 s01Values 数组 |
| | | if (res.data.Detail[i].other_columns!=null|| res.data.Detail[i].other_columns!=undefined){ |
| | | res.data.Detail.forEach(element => { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值 |
| | | }); |
| | | |
| | | // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.Detail.forEach((detail, index) => { |
| | | detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性 |
| | | }); |
| | | } |
| | | |
| | | } |
| | | titleUploadData.value.reportingWorkTime = res.data.reportingWorkTiem |
| | | |
| | | |
| | | //绑定下方表格 |
| | | detail.value = res.data.Detail |
| | | |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = res.data.Detail.map(item => { |
| | | if (item.reviewed_state === 1) { |
| | | return { ...item, reviewed_state: t('productStock.approved') }; |
| | | } |
| | | else if (item.reviewed_state === 0) { |
| | | return { ...item, reviewed_state: t('reportingWorks.unreviewed') }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | detail.value = modifiedCollection |
| | | xGrid.value.reloadData(detail.value) |
| | | hideButton() |
| | | // nextTick(() => { |
| | | // hiddenCompletedOk() |
| | | // }) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | |
| | | const editClosedEvent = ({ row, column }) => { |
| | | let process = titleUploadData.value.thisProcess |
| | | let laminating = titleUploadData.value.laminating |
| | | if (column.property==='completedQuantity') { |
| | | xGrid.value.getTableData().fullData.forEach((item, index) =>{ |
| | | if(item.order_number===row.order_number && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | if(item.order_number===row.order_number && laminating != ''){ |
| | | item.completedQuantity=row.completedQuantity |
| | | } |
| | | }) |
| | |
| | | const getQuantity = () => { |
| | | titleUploadData.value.thisCompletedQuantity = 0 |
| | | titleUploadData.value.thisWornQuantity = 0 |
| | | let laminating = titleUploadData.value.laminating |
| | | const arr = xGrid.value.getTableData().fullData |
| | | const returnArr = arr.filter((obj, index, self) => |
| | | self.findIndex((t) => t.order_number === obj.order_number) === index |
| | | ) |
| | | |
| | | |
| | | //根据是否合片工序过滤 |
| | | const returnArr = |
| | | laminating != "" |
| | | ? arr.filter((obj, index, self) => |
| | | self.findIndex((t) => t.order_number === obj.order_number) === index |
| | | ) |
| | | : arr; |
| | | let sumBreak = 0 |
| | | let sumQuantity = 0 |
| | | returnArr.forEach((item)=>{ |
| | |
| | | } |
| | | }) |
| | | |
| | | |
| | | //报工入库方法 |
| | | 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 || item.completedQuantity =="0" || item.completedQuantity =="") { |
| | | 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, |
| | | inventoryQuantity:item.completedQuantity |
| | | })); |
| | | 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, |
| | | createTime: titleUploadData.value.reportingWorkTime |
| | | }) |
| | | //调用入库接口 |
| | | 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 = () => { |
| | | // 获取最后一道工序 |
| | | const parts = technologicalProcess.split('->'); |
| | | let last = parts[parts.length - 1]; |
| | | if (last === '') { |
| | | last = null; |
| | | } |
| | | const els = document.querySelectorAll('.inventory_content'); |
| | | |
| | | // 是否显示报工入库相关按钮内容 |
| | | if (btnValue == false || last != titleUploadData.value.thisProcess) { |
| | | els.forEach(el => { |
| | | el.style.display = 'none'; |
| | | }); |
| | | } else { |
| | | els.forEach(el => { |
| | | el.style.display = ''; |
| | | }); |
| | | // 避免重复添加按钮 |
| | | const exists = gridOptions.toolbarConfig.buttons.some(btn => btn.code === 'saveWorkStorage'); |
| | | if (!exists) { |
| | | let buttons = { |
| | | code: 'saveWorkStorage', |
| | | name: t('reportingWorks.saveWorkStorage'), |
| | | status: 'primary', |
| | | icon: 'vxe-icon-save' |
| | | }; |
| | | gridOptions.toolbarConfig.buttons.push(buttons); |
| | | } |
| | | } |
| | | |
| | | // 过滤按钮,隐藏 saveWorkStorage 按钮时机 |
| | | gridOptions.toolbarConfig.buttons = gridOptions.toolbarConfig.buttons.filter(button => { |
| | | if ((btnValue == false || last != titleUploadData.value.thisProcess) && button.code === 'saveWorkStorage') { |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | }; |
| | | |
| | | |
| | | |
| | | const changeGroup = (value)=> { |
| | | //判断历史班组是否有此班组信息 |
| | | const exists = titleSelectJson.value.historyTeams.some(item => item.basic_name === value) |
| | | if(! exists){ |
| | | titleSelectJson.value.historyTeams.push({ |
| | | basic_name: value, |
| | | process: titleUploadData.value.thisProcess, |
| | | basic_type: 'teamsgroups', |
| | | id: 555 |
| | | }) |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | const onHiddenChange = (checked) => { |
| | | hiddenVal.value = checked ? 1 : 0 |
| | | hiddenCompletedOk() |
| | | } |
| | | |
| | | const hiddenCompletedOk = () => { |
| | | const $grid = xGrid.value |
| | | const data = $grid.getTableData().fullData |
| | | const laminating = titleUploadData.value.laminating |
| | | const filteredData = data.filter(row => { |
| | | return row.completedQuantity>0 //过滤可完工数量为0的 |
| | | }) |
| | | if (laminating == ''){ |
| | | if (hiddenVal.value == 1){ |
| | | // 重新加载过滤后的数据 |
| | | $grid.loadData(filteredData) |
| | | }else { |
| | | //原始数据 |
| | | $grid.loadData(detail.value); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="height: 100%;width: 100%"> |
| | | <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px"> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head"> |
| | | <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" :placeholder="$t('reportingWorks.reportingWorkId')" style="width: 200px" /> |
| | | <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" :placeholder="$t('processCard.processId')" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/> |
| | | |
| | |
| | | |
| | | <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> |
| | | </div> |
| | | <div style="background-color: white;margin-bottom: 5px;height: 17%;width: 100%"> |
| | | <div class="head1"> |
| | | <el-row> |
| | | <el-col :span="2"> |
| | | <el-text>{{$t('order.orderId')}}:</el-text> |
| | |
| | | <el-col :span="3"> |
| | | <el-select :disabled="groupChangeProcess" |
| | | v-model="titleUploadData.teamsGroupsName" |
| | | @change="changeGroup" |
| | | clearable |
| | | :placeholder="$t('reportingWorks.selectTeam')"> |
| | | <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> |
| | |
| | | |
| | | </el-row> |
| | | </div> |
| | | <div class="main-div-customer" style="width: 100%;height: 70%"> |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | :row-class-name="changeRowClass" |
| | | max-height="100%" |
| | | height="100%" |
| | | size="small" |
| | | v-bind="gridOptions" |
| | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #toolbar_buttons> |
| | | <el-checkbox |
| | | :model-value="hiddenVal === 1" |
| | | @change="onHiddenChange" |
| | | > |
| | | {{ t('reportingWorks.hiddenVal') }} |
| | | </el-checkbox> |
| | | |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <el-dialog |
| | | @opened="openedBrokenTable" |
| | | :before-close="checkClose" |
| | |
| | | +brokenRow.glass_child+'.'+brokenRow.order_number+'.'+brokenRow.technology_number" |
| | | style="width: 80%;height:75% "> |
| | | <vxe-grid |
| | | |
| | | :key="brokenGridKey" |
| | | height="400px" |
| | | ref="brokenGrid" |
| | | class="mytable-scrollbar" |
| | |
| | | </template> |
| | | <!-- 刺破类型breakageType --> |
| | | <template #breakageType="{ row }"> |
| | | <vxe-select v-model="row.breakageType " |
| | | <vxe-select v-model="row.breakageType" |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageType" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | |
| | | |
| | | <!--次破原因--> |
| | | <template #breakageReason="{ row }"> |
| | | <vxe-select v-model="row.breakageReason " |
| | | <vxe-select v-model="row.breakageReason" |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageReason" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | |
| | | |
| | | </vxe-grid> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .head{ |
| | | width: 100%; |
| | | height: 35px; |
| | | } |
| | | .head1{ |
| | | width: 100%; |
| | | height: 105px; |
| | | background-color: white; |
| | | } |
| | | |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 135px); |
| | | } |
| | | |
| | | .processCard { |
| | | width: 140px; |
| | |
| | | } |
| | | |
| | | ::v-deep(.mytable-scrollbar .col-red) { |
| | | background-color: rgb(66,159,254); |
| | | color: #fff; |
| | | background-color: rgb(66,159,254)!important; |
| | | } |
| | | |
| | | |