From cd34d70f1c7b09c1649286a4328247f92f91a143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Fri, 17 May 2024 11:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90nev-pc=E3=80=91=E6=8A=A5=E6=A3=80?= =?UTF-8?q?=E5=8D=95-=E6=89=B9=E9=87=8F=E4=B8=8D=E5=90=88=E6=A0=BC?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/PC/src/api/wms-job.js | 10 + fe/PC/src/components/currenForm/index.vue | 4 +- .../quality/InspectRequest.vue | 244 ++++++++++++++---- 3 files changed, 203 insertions(+), 55 deletions(-) diff --git a/fe/PC/src/api/wms-job.js b/fe/PC/src/api/wms-job.js index eafb8d86e..4859de241 100644 --- a/fe/PC/src/api/wms-job.js +++ b/fe/PC/src/api/wms-job.js @@ -245,6 +245,16 @@ export function setDetailNookStatus(params, id, data) { }) } +//质检——批量设置为合格/不合格 +export function setBatchDetailStatus(data) { + return request({ + url: baseURL + 'wms/store/inspect-job/set-many-detail-status', + method: 'post', + params:{id:data.id}, + data + }) +} + // 盘点任务-批量重盘 export function countJobResetByNumber(data) { return request({ diff --git a/fe/PC/src/components/currenForm/index.vue b/fe/PC/src/components/currenForm/index.vue index d9b903d30..d7e86fe1e 100644 --- a/fe/PC/src/components/currenForm/index.vue +++ b/fe/PC/src/components/currenForm/index.vue @@ -855,8 +855,10 @@ export default { resetCurrenForm() { this.$refs.form.resetFields(); }, + clearValidate() { + this.$refs.form.clearValidate(); + }, restrictionRule(item, prop) { - if(prop) { console.log('item',item) console.log('prop', prop) diff --git a/fe/PC/src/views/rawMaterialManage/quality/InspectRequest.vue b/fe/PC/src/views/rawMaterialManage/quality/InspectRequest.vue index eb27d3807..429227232 100644 --- a/fe/PC/src/views/rawMaterialManage/quality/InspectRequest.vue +++ b/fe/PC/src/views/rawMaterialManage/quality/InspectRequest.vue @@ -72,7 +72,7 @@ 查询 重置 + 批量不合格 @@ -199,17 +200,19 @@ prop="details" > @@ -274,7 +277,13 @@ import { InspectSplitPackingk } from "@/api/wms-api" import { postSplitPackingInspect,postInventoryLabelCode_count } from "@/api/wms-core" -import { completeSummaryDetailStatus, setDetailDefaultOkStatus, setDetailOkStatus, setDetailNookStatus } from "@/api/wms-job" +import { + completeSummaryDetailStatus, + setDetailDefaultOkStatus, + setDetailOkStatus, + setDetailNookStatus, + setBatchDetailStatus +} from "@/api/wms-job" import { tableMixins } from "@/mixins/TableMixins" import { LoadingMixins } from "@/mixins/LoadingMixins" import { drawerMixins } from "@/mixins/drawerMixins" @@ -406,40 +415,9 @@ export default { // inspectUserName: null, // receiveUom: null, }, - inspectForm: [ - { type: "input", label: "物品代码", prop: "itemCode", disabled: true, colSpan: 12 }, - { type: "input", label: "物品名称", prop: "itemName", disabled: true, colSpan: 12 }, - { type: "input", label: "箱码", prop: "packingCode", disabled: true, colSpan: 12 }, - { type: "select", label: "外观", prop: "appearance", options: "inspectAppearanceStatus", colSpan: 12 }, - // { type: "input", label: "尺寸", prop: "volume", colSpan: 12 }, - { type: "input", label: "重量", prop: "weight", colSpan: 12 }, - { type: "inputNumber", label: "检验数量", prop: "inspectQty", colSpan: 12 }, - { type: "button", label: "其他", buttonText: "添加", click: (val) => { this.inspectAddTable(val) }, colSpan: 24 }, - ], - inspectHandle: [ - { label: "合格", name: "hege", type:"success" }, - { label: "不合格", name: "buhege", type:"danger" }, - { label: "取消", name: "cancel" }, - ], - inspectRules: { - appearance: { required: true, trigger: "blur", message: "不可为空" }, - // volume: { required: true, trigger: "blur", message: "不可为空" }, - // weight: { required: true, trigger: "blur", message: "不可为空" }, - inspectQty: [ - { required: true, trigger: "blur", message: "不可为空" }, - { - type: "number", - trigger: ["blur"], - validator: (rule, value, callback) => { - if(Number(value) > Number(this.rowReceiveQty) || Number(value) <= 0){ - return callback(new Error(`数量必须大于0且不能大于收货数量${this.rowReceiveQty}`)) - }else{ - callback() - } - } - } - ], - }, + inspectForm: [], + inspectHandle: [], + inspectRules: {}, inspectOptions:{}, inspectDetailsTableColumns:[ { type: "input", label: "名称", prop: "name", width:'100%' }, @@ -608,12 +586,84 @@ export default { name: 'mx', } ], + // 是否是批量检验 + isBatchInspect:false, + selectedDetailZJ:[], }; }, mounted () { this.paging(); }, methods: { + // 节点根据是否批量判断显示 + initDomIfBatch(){ + this.initInspectRules() + this.initInspectHandle() + this.initInspectForm() + }, + // 检验表单数据格式化 + initInspectForm(){ + if(this.isBatchInspect){ + this.inspectForm = [ + { type: "input", label: "物品代码", prop: "itemCode", disabled: true, colSpan: 12 }, + { type: "input", label: "物品名称", prop: "itemName", disabled: true, colSpan: 12 }, + { type: "select", label: "外观", prop: "appearance", options: "inspectAppearanceStatus", colSpan: 12 }, + { type: "input", label: "重量", prop: "weight", colSpan: 12 }, + { type: "button", label: "其他", buttonText: "添加", click: (val) => { this.inspectAddTable(val) }, colSpan: 24 }, + ] + }else{ + this.inspectForm = [ + { type: "input", label: "物品代码", prop: "itemCode", disabled: true, colSpan: 12 }, + { type: "input", label: "物品名称", prop: "itemName", disabled: true, colSpan: 12 }, + { type: "input", label: "箱码", prop: "packingCode", disabled: true, colSpan: 12 }, + { type: "select", label: "外观", prop: "appearance", options: "inspectAppearanceStatus", colSpan: 12 }, + // { type: "input", label: "尺寸", prop: "volume", colSpan: 12 }, + { type: "input", label: "重量", prop: "weight", colSpan: 12 }, + { type: "inputNumber", label: "检验数量", prop: "inspectQty", colSpan: 12 }, + { type: "button", label: "其他", buttonText: "添加", click: (val) => { this.inspectAddTable(val) }, colSpan: 24 }, + ] + } + }, + // 检验表单验证格式化 + initInspectRules(){ + if(this.isBatchInspect){ + this.inspectRules = {} + }else{ + this.inspectRules = { + appearance: { required: true, trigger: "blur", message: "不可为空" }, + inspectQty: [ + { required: true, trigger: "blur", message: "不可为空" }, + { + type: "number", + trigger: ["blur"], + validator: (rule, value, callback) => { + if(Number(value) > Number(this.rowReceiveQty) || Number(value) <= 0){ + return callback(new Error(`数量必须大于0且不能大于收货数量${this.rowReceiveQty}`)) + }else{ + callback() + } + } + } + ], + } + } + }, + // 检验表单按钮格式化 + initInspectHandle(){ + if(this.isBatchInspect){ + this.inspectHandle=[ + { label: "批量不合格", name: "batchBuhege", type:"danger" }, + { label: "取消", name: "batchcancel" }, + ] + }else{ + this.inspectHandle=[ + { label: "合格", name: "hege", type:"success" }, + { label: "不合格", name: "buhege", type:"danger" }, + { label: "取消", name: "cancel" }, + ] + } + + }, // 抽屉内部按钮 currenDrawerButtonClick(val,index, label,item){ if(item.prop == "inspectReport"){ @@ -689,13 +739,16 @@ export default { } }, // 检验详情按钮 - buttonClick(row) { - this.summaryCurrentRow = row + async buttonClick(row) { // 判断状态为完成情况下,不可点击 if (row.summaryInspectStatus == 2) { this.$message.error('已完成质检') return } + let _fleshDeatils = await getDetailed(this.propsData.id, this.URL) + this.tableDataDetails = JSON.parse(JSON.stringify(_fleshDeatils)) + let _fleshSummarys = _fleshDeatils.summaryDetails.filter(item=>{return item.id == row.id}) + this.summaryCurrentRow = _fleshSummarys[0] // 展现 质检详情窗口 this.Loading.appMainLoading = true setTimeout(()=>{ @@ -750,7 +803,7 @@ export default { // inspectUserPhone: null, // stdPackUom: null, } - this.$listAssign(this.inspectNoticeDetailsFormData, row) + this.$listAssign(this.inspectNoticeDetailsFormData, this.summaryCurrentRow) let findRs = this.tableDataDetails.details.filter(item => ( item.itemCode == row.itemCode )) @@ -809,25 +862,41 @@ export default { inspectButtonClick(row, index, label) { this.inspectFormData.details.splice(row.$index, 1) }, - resetInspectForm(row) { + async resetInspectForm(row) { + let _fleshDeatils = await getDetailed(this.propsData.id, this.URL) + let _fleshRow = _fleshDeatils.details.filter(item=>{return item.id == row.id})[0] // this.inspectFormData.inspectQty = null // this.$refs.inspectForm_Ref.resetCurrenForm() let _detailTable = '[]' - if(row.otherPropertyJson && row.otherPropertyJson != '' && row.otherPropertyJson != 'null'){ - _detailTable = JSON.parse(JSON.stringify(row.otherPropertyJson)) + if(_fleshRow.otherPropertyJson && _fleshRow.otherPropertyJson != '' && _fleshRow.otherPropertyJson != 'null'){ + _detailTable = JSON.parse(JSON.stringify(_fleshRow.otherPropertyJson)) } - this.inspectFormData = row + this.inspectFormData = JSON.parse(JSON.stringify(_fleshRow)) this.inspectFormData.details = JSON.parse(_detailTable) // 默认合格时候检查数量默认赋值 - if(row.detailInspectStatus == 1){ - // todo:待测试 + if(_fleshRow.detailInspectStatus == 1){ this.inspectFormData.appearance = '' this.inspectFormData.volume = '' this.inspectFormData.weight = '' this.inspectFormData.otherPropertyJson = '[]' this.inspectFormData.details = [] - this.inspectFormData.inspectQty = row.receiveQty + this.inspectFormData.inspectQty = _fleshRow.receiveQty } + this.$nextTick(()=>{ + this.$refs.inspectForm_Ref.clearValidate() + }) + }, + resetInspectFormBatch(){ + this.inspectFormData = JSON.parse(JSON.stringify(this.selectedDetailZJ[0])) + this.inspectFormData.appearance = '' + this.inspectFormData.volume = '' + this.inspectFormData.weight = '' + this.inspectFormData.otherPropertyJson = '[]' + this.inspectFormData.details = [] + this.inspectFormData.inspectQty = 0 + this.$nextTick(()=>{ + this.$refs.inspectForm_Ref.clearValidate() + }) }, // 质检详情-检验按钮 table中按钮 inspectDetailsButtonClick(row, index, label) { @@ -863,6 +932,8 @@ export default { }) } else if (label == '检验') { + this.isBatchInspect = false + this.initDomIfBatch() this.rowReceiveQty = row.receiveQty getListByItemcode({itemCode: row.itemCode}, 'basedata/item-guide-book').then(res => { if (res.length > 0) { @@ -873,12 +944,12 @@ export default { this.blobName = '' if(document.getElementById("uploadPictureCardGuideBook"))document.getElementById("uploadPictureCardGuideBook").innerHTML = '' } - this.inspectShow = true this.resetInspectForm(row) + this.inspectShow = true }).catch(err => { console.log(err) - this.inspectShow = true this.resetInspectForm(row) + this.inspectShow = true }) this.rowId = row.id } else if (label == '清除检验') { @@ -888,7 +959,7 @@ export default { type: 'warning' }).then(() => { this.inspectNoticeDetailsTableLoading = true - setDetailDefaultOkStatus({detailId: this.inspectFormData.id}, this.masterID).then(res => { + setDetailDefaultOkStatus({detailId: row.id}, this.masterID).then(res => { this.$message.success('成功清除检验!') // 更新数据============================================================ // this.$listAssign(this.inspectNoticeDetailsFormData, res) @@ -926,6 +997,36 @@ export default { }) } }, + // 批量操作表格选择 + handleSelectDetailZJ(val){ + this.selectedDetailZJ = val; + }, + // 批量不合格操作 + batchInspectHandle(){ + this.isBatchInspect = true + this.initDomIfBatch() + if(!this.selectedDetailZJ || this.selectedDetailZJ.length <= 0){ + this.$warningMsg("至少选择一条数据") + return + } + let row = this.selectedDetailZJ[0] + getListByItemcode({itemCode: row.itemCode}, 'basedata/item-guide-book').then(res => { + if (res.length > 0) { + this.guideBookData = res[0] + this.guideBookDatePicture(res[0].pictureBlobName) + } else { + this.guideBookData = [] + this.blobName = '' + if(document.getElementById("uploadPictureCardGuideBook"))document.getElementById("uploadPictureCardGuideBook").innerHTML = '' + } + this.resetInspectFormBatch() + this.inspectShow = true + }).catch(err => { + console.log(err) + this.resetInspectFormBatch() + this.inspectShow = true + }) + }, // 检验详情 底部按钮 formClick(val){ if (val[0] == 0) { @@ -1109,6 +1210,41 @@ export default { } }, + // 批量不合格检验 底部按钮:批量不合格,取消 + inspectFormBtachClick(val){ + let _detailIdList = [] + this.selectedDetailZJ.forEach(item=>{_detailIdList.push(item.id)}) + if (val[0] == 0) { + // 不合格 + val[1].validate((valid) => { + if (valid) { + let otherPropertyJson = JSON.stringify(this.inspectFormData.details) + this.inspectFormData.otherPropertyJson = otherPropertyJson + this.inspectFormData.detailInspectStatus = 3 //不合格状态 + this.inspectFormData.guidList = _detailIdList.join(",") + this.inspectFormData.id = this.propsData.id + this.Loading.appMainLoading = true + setBatchDetailStatus(this.inspectFormData).then(res=>{ + this.Loading.appMainLoading = false + this.inspectShow = false + this.buttonClick(this.summaryCurrentRow) + this.paging() + this.selectedDetailZJ = [] + this.$refs.inspectNoticeDetails_table_ref.clearSelection(); + }).catch(err => { + console.log(err) + this.Loading.appMainLoading = false + }) + } else { + this.$errorMsg('请按照提示继续操作') + return false; + } + }) + } + else if (val[0] == 1) { + this.inspectShow = false + } + }, // 检验 table添加按钮 inspectAddTable(val) { this.editFormData = this.inspectFormData @@ -1170,11 +1306,11 @@ export default { }, //设置指定行、列、具体单元格颜色 cellClassName({row, column, rowIndex, columnIndex}){ - if (row.detailInspectStatus == 1 && columnIndex === 5) { + if (row.detailInspectStatus == 1 && columnIndex === 6) { return 'cell-class-mrhg' //默认合格 - } else if (row.detailInspectStatus == 2 && columnIndex === 5) { + } else if (row.detailInspectStatus == 2 && columnIndex === 6) { return 'cell-class-hg'//合格 - } else if (row.detailInspectStatus == 3 && columnIndex === 5) { + } else if (row.detailInspectStatus == 3 && columnIndex === 6) { return 'cell-class-nohg'//不合格 }else{ return ''