Ver Fonte

品管检验

hongxudong há 2 anos atrás
pai
commit
1437507fcd

+ 10 - 0
src/api/pages/mst/material-bom-item.js

@@ -0,0 +1,10 @@
+/**
+ * @desc   : 物料BOM明细
+ * @author : 洪旭东
+ * @date   : 2024-04-01 15:31
+ */
+export default {
+  materialBomItemService:{
+    prefix:'/mdm-server/mst/material_bom_item/',
+  }
+}

+ 10 - 0
src/api/pages/mst/material-bom.js

@@ -0,0 +1,10 @@
+/**
+ * @desc   : 物料BOM
+ * @author : 洪旭东
+ * @date   : 2024-04-01 15:27
+ */
+export default {
+  materialBomService:{
+    prefix:'/mdm-server/mst/material_bom/',
+  }
+}

+ 11 - 0
src/api/pages/pdm/pci-plan.js

@@ -0,0 +1,11 @@
+/**
+ * @desc   : 检验计划
+ * @author : 洪旭东
+ * @date   : 2024-03-26 16:05
+ */
+export default {
+  qciPlanService:{
+    prefix:'/pdm-server/pdm/qci_plan/',
+  },
+
+}

+ 13 - 0
src/api/pages/pdm/pci-standard.js

@@ -0,0 +1,13 @@
+/**
+ * @desc   : 检验标准
+ * @author : 洪旭东
+ * @date   : 2024-03-22 16:39
+ */
+export default {
+  qciStandardService:{
+    prefix:'/pdm-server/pdm/qci_standard/',
+    //通过产品型号的分类查询
+    getByCategory: 'get_by_category',
+  },
+
+}

+ 11 - 0
src/api/pages/pdm/pci-type-step.js

@@ -0,0 +1,11 @@
+/**
+ * @desc   : 检验类型
+ * @author : 洪旭东
+ * @date   : 2024-03-21 11:44
+ */
+export default {
+  qciTypeStepService:{
+    prefix:'/pdm-server/pdm/qci_type_step/',
+  },
+
+}

+ 12 - 0
src/api/pages/pdm/pci-type.js

@@ -0,0 +1,12 @@
+/**
+ * @desc   : 检验类型
+ * @author : 洪旭东
+ * @date   : 2024-03-21 11:44
+ */
+export default {
+  qciTypeService:{
+    prefix:'/pdm-server/pdm/qci_type/',
+  },
+
+}
+

+ 1 - 0
src/config/index.js

@@ -580,6 +580,7 @@ export default {
     nodeType: '生产-工序类别',
     techType: '生产-工艺类别',
     moldlineTag: '生产-成型标签',
+    fitErrorReason: '品检-装配错误原因',
   },
 
   /**

+ 2 - 0
src/locale/lang/zh-CN.js

@@ -1312,6 +1312,7 @@ export const messages = {
   W_180: '未选择产品型号或模具条码',
   W_181: '操作失败,原因:{param}',
   W_182: '暂无触屏工控机功能权限,请联系管理员',
+  W_183: '无匹配到相关检验标准',
   E_001: '系统出现异常,请联系管理员。',
   Q_001: '当前页面的数据有过更改,请确认需要保存吗?',
   Q_002: '确定要进行{param}操作吗?',
@@ -1512,6 +1513,7 @@ export const others = {
   limitQty: '限制数量',
   finalQty: '尾板数量',
   modelCarLimit:'载具型号启用"限制装板产品数量"后生效',
+  chooseStandard: '选择检验标准',
 }
 
 /**

+ 372 - 38
src/view/pdm/qci/index.vue

@@ -1,4 +1,4 @@
-<template>
+ <template>
   <div class="full">
     <loading :loading="loading"></loading>
     <div class="top-bar">
@@ -18,11 +18,14 @@
     </div>
 
     <div style="padding: 10px; height: calc(100% - 50px)">
-      <Col span="8" class="full" style="padding: 5px" v-show="!leftHide">
+      <Col span="8" class="full" style="padding: 5px" v-show="!leftHide && !workSopHide">
         <Card class="full">
           <div style="display: flex">
-            <Input style="width: 50%" size="large"/>
-            <Button type="primary" size="large" style="margin-left: 10px">刷新</Button>
+<!--            <Input style="width: 50%" size="large"/>-->
+            <Select v-model="qciTypeId" style="width: 50%" size="large" @on-change="getPlan">
+              <Option v-for="item in qciTypeList" :value="item.typeId" :key="item.typeId">{{ item.typeName }}</Option>
+            </Select>
+            <Button type="primary" size="large" style="margin-left: 10px" @click="getPlan">刷新</Button>
           </div>
 
           <vxe-table :data="planItemList" style="margin-top: 10px" id="itemId" :height="planItemHeight">
@@ -53,6 +56,11 @@
 
         </Card>
       </Col>
+
+      <Col span="8" class="full" style="padding: 5px" v-show="!leftHide && workSopHide">
+        <iframe v-if="workSop" :src="$config.imgUrl + workSop.sopPath" style="width: 100%; height: 100%"/>
+      </Col>
+
       <Col :span="leftHide?24:16" class="full" style="padding: 5px">
         <Card class="full">
           <Form ref="formInline" v-model="formData" style="width: 100%" inline>
@@ -112,14 +120,25 @@
                 </Poptip>
               </Col>
               <Col span="3" class="standard-item">
-                <Select>
+                <Select transfer v-model="item.inspValue" v-if="item.itemKind === '品检项类-定性'" @on-change="changeInspValue(item)">
                   <Option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</Option>
                 </Select>
+                <Poptip transfer trigger="click" style="width: 100%" v-if="item.itemKind === '品检项类-定量' && item.inspNum">
+                  <Input size="large" v-model="item.inspValue" readonly/>
+                  <div slot="content">
+                    检验值
+                    <div v-for="(it, index) in item.inspNum" :key="'inspNum' + it" style="margin-bottom: 5px">
+                      <span style="width: 20%">第{{index+1}}次</span>
+                      <Input type="number" size="large" v-model="item.inspValues[index]" style="width: 80%; margin-left: 10px" @on-blur="setInspValues(item, index)"/>
+                    </div>
+                  </div>
+                </Poptip>
               </Col>
               <Col span="3" class="standard-item">
-                <Select>
-                  <Option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</Option>
-                </Select>
+                <i-switch :value="item.determineResult === '检验结果-合格'" @on-change="(val) => changeDetermineResult(val, item)" />
+<!--                <Select transfer v-model="item.determineResult">-->
+<!--                  <Option v-for="item in fitErrorReasonList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
+<!--                </Select>-->
               </Col>
               <Col span="4">
                 <Input size="large" v-model="item.remarks" disabled/>
@@ -127,8 +146,15 @@
             </Row>
           </div>
 
-          <div style="width: 100%; position: absolute; bottom: 60px;">
+          <div style="width: 100%; position: absolute; bottom: 60px;font-size: 16px !important;line-height: 32px"
+               v-if="fitFlag">
             <Row style="margin-top: 10px">
+              <Col span="6">
+                物料编码
+              </Col>
+              <Col span="6">
+                物料名称
+              </Col>
               <Col span="3">
                 装配正确
               </Col>
@@ -136,35 +162,41 @@
                 装配错误
               </Col>
               <Col span="3">
-                漏装
-              </Col>
-              <Col span="6">
-                物料名称
+                装配错误原因
               </Col>
             </Row>
 
             <Row v-for="item of skuList" :key="item.itemId" style="margin-top: 10px">
-              <Col span="3">
-                <Radio></Radio>
+              <Col span="6">
+                {{item.modelCode}}
+              </Col>
+              <Col span="6">
+                {{item.modelName}}
               </Col>
               <Col span="3">
-                <Radio></Radio>
+                <Radio :value="item.flgResult" @on-change="$set(item, 'flgResult',true)"></Radio>
               </Col>
               <Col span="3">
-                <Radio></Radio>
+                <Radio :value="item.flgResult==false" @on-change="$set(item, 'flgResult',false)"></Radio>
               </Col>
-              <Col span="6">
-                {{item.erpSkuCode}}
+              <Col span="3" v-show="item.flgResult==false">
+                <Select transfer v-model="item.fitErrorId">
+                  <Option v-for="item in fitErrorReasonList" :value="item.dataId" :key="item.value">{{ item.dataValue }}</Option>
+                </Select>
               </Col>
             </Row>
           </div>
 
           <div class="footer-btn">
-            <Col span="5">
-              <Button type="primary" long @click="hideLeft">收起左侧</Button>
+            <Col span="4">
+              <Button type="primary" long @click="hideLeft">{{leftHide?'展开':'收起'}}左侧</Button>
+            </Col>
+            <Col span="1"/>
+            <Col span="4">
+              <Button type="primary" long @click="workSopHide = !workSopHide" :disabled="!workSop || leftHide">{{workSopHide?'隐藏':'显示'}}作业指导书</Button>
             </Col>
             <Col span="1"/>
-            <Col span="18">
+            <Col span="14">
               <Button type="primary" long>保存</Button>
             </Col>
           </div>
@@ -172,6 +204,23 @@
       </Col>
     </div>
 
+    <DkModal
+      :loading="loading"
+      v-model="standardModal"
+      :saveFlag="false"
+      :title="$t('chooseStandard')"
+      width="900px"
+      class-name="check-add-touch-modal"
+      @modalOk="chooseStandard"
+    >
+      <div style="margin: 10px 10px;">
+        <Tag style="margin-top: 5px" v-for="(item, index) of standardList" :key="item.stdId"
+             :class="'standard-tag' + (item.checked? '-choose':'')"
+             @click.native="clickStandardTag(index)">{{ item.stdName }}
+        </Tag>
+      </div>
+    </DkModal>
+
 
     <!--  键盘  -->
 <!--    <div :style="{bottom:keyboardFlag?'0px':'-350px'}" class="key-board-div">-->
@@ -186,7 +235,7 @@
 import { request } from '@/api/base'
 
 export default {
-    name: "pci",
+    name: "qci",
   // components: {SimpleKeyboard},
   data(){
         return {
@@ -198,23 +247,44 @@ export default {
           //键盘
           keyboardFlag: false,
           planItemList: [],
+          standardList: [],
           standardItemList: [],
           skuList: [],
+          qciTypeId: null,
+          qciTypeList: [],
           productCode: '23120408',
           formData: {},
           options: [
             {
-              value: '合格',
+              value: 0,
               label: '合格'
             },
             {
-              value: '不合格',
+              value: 1,
+              label: '不合格'
+            },
+          ],
+          fitErrorReasonList: [
+            {
+              value: '检验结果-合格',
+              label: '合格'
+            },
+            {
+              value: '检验结果-不合格',
               label: '不合格'
             },
           ],
           leftHide: false,
+          workSopHide: false,
+          standardModal: false,
+          workSop: null,
         }
     },
+  computed: {
+      fitFlag () {
+        return this.qciTypeList && this.qciTypeList.length && this.qciTypeId && this.qciTypeList.filter(f => f.typeId === this.qciTypeId)[0].flgFit
+    }
+  },
     methods: {
       /**
        * @desc   : 键盘点击
@@ -256,17 +326,107 @@ export default {
           document.documentElement.webkitRequestFullScreen();
         }
       },
+      getPlan(){
+        this.planItemList = []
+        request(this.$service.qciPlanService.prefix + this.$service.qciPlanService.selectByCond, {
+          planDateStart: new Date().format('yyyy-MM-dd'),
+          planDateEnd: new Date().format('yyyy-MM-dd'),
+          ftyId: this.$store.state.user.ftyId,
+          flgValidList: [true],
+          qciType: this.qciTypeId
+        }).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            if (res.data.total === 1) {
+              this.qciTypeId = res.data.list[0].qciType
+              this.getPlanItem(res.data.list[0].planId)
+            }
+          } else {
+            this.$Message.warning(res.message)
+          }
+        })
+      },
       /**
        * @desc   : 计划明细
        * @author : 洪旭东
        * @date   : 2024-03-29 10:28
        */
-      getPlanItem() {
+      getPlanItem(id) {
         request(this.$service.qciPlanItemService.prefix + this.$service.qciPlanItemService.selectByCond, {
-          planId: 7
+          planId: id
+        }).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            let currentQci = this.qciTypeList.filter(f => f.typeId === this.qciTypeId)
+            if (currentQci.length) {
+              let planCalculation = currentQci[0].planCalculation
+              if (planCalculation === 1) {
+                // 百分比
+                for (let it of res.data.list) {
+                  it.planQty = parseInt((it.poutQty * currentQci[0].percentage / 100).toFixed(0))
+                }
+                this.planItemList = res.data.list
+              } else if (planCalculation === 2) {
+                // 阶梯
+                request(this.$service.qciTypeStepService.prefix + this.$service.qciTypeStepService.selectByCond, {
+                  typeId: currentQci[0].typeId
+                }).then(res2=>{
+                  if (res2.code === this.$config.SUCCESS_CODE) {
+                    for (let it of res.data.list) {
+                      let typeStep = res2.data.list.filter(f => f.stepBegin <= it.poutQty && f.stepEnd >= it.poutQty)
+                      if (typeStep.length) {
+                        it.planQty = typeStep[0].planQty
+                      }
+                    }
+                    this.planItemList = res.data.list
+                  } else {
+                    this.$Message.warning(res2.message)
+                  }
+                })
+              }
+            } else {
+              this.planItemList = res.data.list
+            }
+          } else {
+            this.$Message.warning(res.message)
+          }
+        })
+      },
+      /**
+       * @desc   : 检验标准
+       * @author : 洪旭东
+       * @date   : 2024-04-01 09:22
+       */
+      getStandard(pdtModelId) {
+        this.standardItemList = []
+        request(this.$service.qciStandardService.prefix + this.$service.qciStandardService.selectByCond, {
+          ftyId: this.$store.state.user.ftyId,
+          pdtModelId: pdtModelId
         }).then(res => {
           if (res.code === this.$config.SUCCESS_CODE) {
-            this.planItemList = res.data.list
+            this.standardList = res.data.list
+            //先通过型号查,如果型号没有按照分类查
+            if (res.data.total === 1) {
+              this.getStandardItem(res.data.list[0].stdId)
+            } else if (res.data.total === 0) {
+              request(this.$service.qciStandardService.prefix + this.$service.qciStandardService.getByCategory, {
+                ftyId: this.$store.state.user.ftyId,
+                pdtModelId: pdtModelId
+              }).then(res2=>{
+                if (res2.code === this.$config.SUCCESS_CODE) {
+                  this.standardList = res2.data
+                  if (res2.data.length === 1) {
+                    this.getStandardItem(res2.data[0].stdId)
+                  } else if (res2.data.length === 0) {
+                    this.$Message.warning(this.$t('W_183'))
+                  } else {
+                    this.standardModal = true
+                  }
+                } else {
+                  this.$Message.warning(res2.message)
+                }
+              })
+            } else {
+              this.standardModal = true
+            }
           } else {
             this.$Message.warning(res.message)
           }
@@ -277,14 +437,21 @@ export default {
        * @author : 洪旭东
        * @date   : 2024-03-29 10:28
        */
-      getStandardItem() {
+      getStandardItem(stdId) {
         request(this.$service.qciStandardItemService.prefix + this.$service.qciStandardItemService.selectByCond, {
-          stdId: 2
+          stdId: stdId
         }).then(res => {
           if (res.code === this.$config.SUCCESS_CODE) {
             // res.data.list = res.data.list.concat(res.data.list)
             // res.data.list = res.data.list.concat(res.data.list)
-
+            for (let it of res.data.list) {
+              if (it.itemKind === '品检项类-定量' && it.inspNum) {
+                it.inspValues = []
+                for (let i = 0; i < it.inspNum; i++) {
+                  it.inspValues.push(0)
+                }
+              }
+            }
             this.standardItemList = res.data.list
           } else {
             this.$Message.warning(res.message)
@@ -296,15 +463,20 @@ export default {
        * @author : 洪旭东
        * @date   : 2024-03-29 13:59
        */
-      getModelProduct () {
-        request(this.$service.modelProductService.prefix + '/' + 379).then(res=>{
+      getModelProduct (modelId) {
+        request(this.$service.modelProductService.prefix + modelId).then(res=>{
           if (res.code === this.$config.SUCCESS_CODE) {
-            this.skuList = res.data.erpList
+            this.getMaterialBom(res.data.defErpSkuId)
           } else {
             this.$Message.warning(res.message)
           }
         })
       },
+      /**
+       * @desc   : 通过产品编码查询
+       * @author : 洪旭东
+       * @date   : 2024-04-01 08:46
+       */
       getProductByCode () {
         let params = {
           barCode: this.productCode,
@@ -312,24 +484,169 @@ export default {
         request(this.$service.collectService.prefix + this.$service.collectService.getProductByCode, params).then(res=>{
           if (res.code === this.$config.SUCCESS_CODE) {
             this.formData = res.data
+            this.getStandard(res.data.modelId)
+            this.getModelProduct(res.data.modelId)
+            this.getWorkSop(res.data.modelId)
           } else {
             this.$Message.warning(res.message)
           }
         })
       },
       /**
+       * @desc   : 查询作业指导书
+       * @author : 洪旭东
+       * @date   : 2024-04-01 16:21
+       */
+      getWorkSop(modelId) {
+        request(this.$service.workSopService.prefix + this.$service.workSopService.getByModel, {
+          ftyId: this.$store.state.user.ftyId,
+          modelId: modelId,
+        }).then(res=>{
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.workSop = res.data
+          } else {
+            this.$Message.warning(res.message)
+          }
+        })
+      },
+      /**
+       * @desc   : 查询物料BOM
+       * @author : 洪旭东
+       * @date   : 2024-04-01 15:24
+       */
+      getMaterialBom(defErpSkuId) {
+        if (defErpSkuId) {
+          let today = new Date().format('yyyy-MM-dd')
+          request(this.$service.materialBomService.prefix + this.$service.materialBomService.selectByCond, {
+            validityDateStart: today,
+            validityDateEnd: today,
+            matModelId: defErpSkuId
+          }).then(res=>{
+            if (res.code === this.$config.SUCCESS_CODE) {
+              if (res.data.total === 1) {
+                request(this.$service.materialBomItemService.prefix + this.$service.materialBomItemService.selectByCond, {
+                  bomId: res.data.list[0].bomId
+                }).then(res2=>{
+                  if (res2.code === this.$config.SUCCESS_CODE) {
+                    this.skuList = res2.data.list
+                  } else {
+                    this.$Message.warning(res2.message)
+                  }
+                })
+              }
+            } else {
+              this.$Message.warning(res.message)
+            }
+          })
+
+          request(this.$service.commonService.prefix + this.$service.commonService.getDictionaryData, {
+            ftyId: this.$store.state.user.ftyId,
+            dictCode: this.$config.dictType.fitErrorReason
+          }).then(res=>{
+            if (res.code === this.$config.SUCCESS_CODE) {
+              this.fitErrorReasonList = res.data
+            } else {
+              this.$Message.warning(res.message)
+            }
+          })
+
+        }
+      },
+      /**
+       * @desc   : 查询检验标准
+       * @author : 洪旭东
+       * @date   : 2024-04-01 08:46
+       */
+      getQciType () {
+        this.excute(this.$service.qciTypeService, this.$service.qciTypeService.selectByCond, {
+          flgValidList: [true],
+          ftyId: this.$store.state.user.ftyId,
+        }).then(res=>{
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.qciTypeList = res.data.list
+          } else {
+            this.$Message.warning(res.message)
+          }
+        })
+      },
+      /**
+       * @desc   : 点击标准tag
+       * @author : 洪旭东
+       * @date   : 2024-04-01 10:55
+       */
+      clickStandardTag (index) {
+        this.$set(this.standardList[index], 'checked', true)
+        for (let it of this.standardList.filter(f => f.stdId !== this.standardList[index].stdId)) {
+          this.$set(it, 'checked', false)
+        }
+      },
+      /**
+       * @desc   : 选择检验标准
+       * @author : 洪旭东
+       * @date   : 2024-04-01 10:54
+       */
+      chooseStandard () {
+        let stds = this.standardList.filter(f => f.checked)
+        if (stds && stds.length) {
+          this.getStandardItem(stds[0].stdId)
+        }
+        this.standardModal = false
+      },
+      /**
        * @desc   : 收起左侧
        * @author : 洪旭东
        * @date   : 2024-03-29 13:37
        */
       hideLeft() {
         this.leftHide = !this.leftHide
-      }
+      },
+      /**
+       * @desc   : 检验值失焦事件
+       * @author : 洪旭东
+       * @date   : 2024-04-01 11:39
+       */
+      setInspValues (item, index) {
+        this.$nextTick(()=>{
+          this.$set(item.inspValues, index, parseFloat(parseFloat(item.inspValues[index]).toFixed(6)))
+          console.log(item)
+          //找出数组中最小值
+          if (item.inspValueKind === '品检取值-最小') {
+            item.inspValue = item.inspValues.map(f => parseFloat(f)).min()
+          } else if (item.inspValueKind === '品检取值-最大') {
+            item.inspValue = item.inspValues.map(f => parseFloat(f)).max()
+          } else if (item.inspValueKind === '品检取值-平均') {
+            console.log('item.inspValues.map(f => parseFloat(f)).reduce((acc, cur) => (cur + acc), 0)', item.inspValues.map(f => parseFloat(f)).reduce((acc, cur) => (cur + acc), 0))
+            item.inspValue = item.inspValues.map(f => parseFloat(f)).reduce((acc, cur) => (cur + acc), 0) / item.inspValues.length
+          }
+          console.log('item.inspValue = ', item.inspValue)
+          if ((item.refValueMax == null || item.inspValue < item.refValueMax) && (item.refValueMin == null || item.inspValue > item.refValueMin)) {
+            this.$set(item, 'determineResult', '检验结果-合格')
+          } else {
+            this.$set(item, 'determineResult', '检验结果-不合格')
+          }
+          // item.inspValue = item.inspValues.toString()
+        })
+      },
+      /**
+       * @desc   : 修改是否合格
+       * @author : 洪旭东
+       * @date   : 2024-04-01 14:40
+       */
+      changeDetermineResult (val, item) {
+        this.$set(item, 'determineResult', val?'检验结果-合格':'检验结果-不合格')
+      },
+      /**
+       * @desc   : 选择检验结果
+       * @author : 洪旭东
+       * @date   : 2024-04-01 14:45
+       */
+      changeInspValue (item) {
+        this.$set(item, 'determineResult', item.inspValue==0?'检验结果-合格':'检验结果-不合格')
+      },
     },
     created(){
-      this.getPlanItem()
-      this.getStandardItem()
-      this.getModelProduct()
+      this.getPlan()
+      this.getQciType()
       this.getProductByCode()
       this.planItemHeight = document.documentElement.clientHeight - 160
       this.standardItemHeight = document.documentElement.clientHeight - 370
@@ -366,6 +683,23 @@ export default {
   padding: 0 10px;
 }
 
+.standard-tag {
+  font-size: 14px !important;
+  height: 40px !important;
+  line-height: 40px !important;
+}
+
+.standard-tag-choose {
+  font-size: 14px !important;
+  height: 40px !important;
+  line-height: 40px !important;
+  background-color: #2D8CF0 !important;
+}
+
+.standard-tag-choose /deep/ .ivu-tag-text{
+  color: white !important;
+}
+
 /deep/ .ivu-poptip-rel{
   font-size: 18px;
 }