Sfoglia il codice sorgente

Merge branch 'master' of http://git.dongkesoft.com:9001/DK-MES-3.0/mes-web

周兴 2 anni fa
parent
commit
7bdb9dc2f0

+ 4 - 1
src/api/pages/pdm/molding-record.js

@@ -22,7 +22,10 @@ export default {
     //根据成型线id查询
     selectByMoldineId:'select_by_moldline_id',
     //查询可替换绑定条码的产品
-    selectProductByBindBarcode: 'select_product_by_bind_barcode'
+    selectProductByBindBarcode: 'select_product_by_bind_barcode',
+    //查询可添加绑定条码的产品
+    selectProductCanBindBarcode: 'select_product_can_bind_barcode'
+
   }
 }
 

+ 124 - 21
src/components/base/edit-tree-table/edit-tree-table.vue

@@ -689,6 +689,10 @@
         type: Boolean,
         default: false,
       },
+      // 查询条件(传入)
+      searchInfo: {
+        type: Object
+      },
     },
     data() {
       const vm = window.vm
@@ -741,13 +745,19 @@
           currentPage: 1
         },
         // 查询条件
-        searchCond: {},
+        searchCond: {
+          _value: {}
+        },
         searchContent: [],
         // 外部传入的查询条件
         otherCondition: {
           type: Object,
           default: null
         },
+        //绑定条码添加标识
+        bindBarCodeAddFlag:false,
+        //绑定条码替换标识
+        bindBarCodeReplaceFlag:false,
       }
     },
     watch: {
@@ -3630,6 +3640,7 @@
           // 绑定条码 不管有值没值都是可以查询数据的
           //查询可替换商品
           this.getDataTable(row)
+          this.bindBarCodeReplaceFlag=true
         }
         // 说明已经有值,直接替换,不用查询数据库 只包括父级
         else  if (this.exchangeField && row[this.exchangeField] && (!row['parentId'] || !row['bomSkuId'])) {
@@ -3664,19 +3675,34 @@
             row = this.focusedRow
           }
           param[this.exchangeField] = row[this.exchangeField]
-          if (this.bindBarCodeFlag && row['moldlineId']) {
-            param.pdtGlueKind = row['pdtGlueKind']
-            //todo 查出所有数据 zdl 2023年4月25日09:01:27
-            // param.moldlineId = row['moldlineId']
-            //todo 暂时注掉 2023年4月25日08:46:09  zdl
-            // param.moldlineItemNoList =  this.children.map(it=>it.moldlineItemNo).unique()
-          }
+          if (this.bindBarCodeFlag ) {
+            //添加子集
+            if(row.hasChild==1){
+              //成型线Id
+              param.moldlineId = row.bomItems[0]['moldlineId']
+              //产品id集合
+              param.modelIdList = row.bomItems.map(it=>it.mouldId).unique()
+              this.bindBarCodeAddFlag=true
+            }
+            //替换子集
+            else{
+              param.pdtGlueKind = row['pdtGlueKind']
+              //todo 查出所有数据 zdl 2023年4月25日09:01:27
+              // param.moldlineId = row['moldlineId']
+              //todo 暂时注掉 2023年4月25日08:46:09  zdl
+              // param.moldlineItemNoList =  this.children.map(it=>it.moldlineItemNo).unique()
+              //赋值查询类型
+              this.columns[0].dataType= this.$config.tableSelectType.product
+            }
+            //设置弹窗字段
+            this.setLoadChildInit()
+           }
           // 拼接外部传入的其他参数otherCondition
           if (this.otherCondition) {
             param = Object.assign(param, this.otherCondition)
           }
           if (this.searchCond) {
-            param = Object.assign(param, this.searchCond._value)
+              param = Object.assign(param, this.searchCond._value)
           }
           this.excute(this.service, this.service[this.methodsNameExchange], param).then(res => {
             if (res.code === this.$config.SUCCESS_CODE) {
@@ -3688,7 +3714,7 @@
                 arr = [...res.data]
               }
               this.exchangeData = arr
-              //过滤掉当前数据  不是绑定条码需要
+              //过滤掉当前数据  不是绑定条码需要(这里保留的是原来的逻辑)
               if(!this.bindBarCodeFlag){
                 this.exchangeData = this.exchangeData.filter(it => it[this.controlId] !== row[this.controlId])
               }
@@ -3713,8 +3739,7 @@
           return true
         }
         return false
-      }
-      ,
+      },
       /**
        * @desc   : 选择数据之后
        * @author : 周兴
@@ -3728,14 +3753,22 @@
         }
         let row = this.$refs['table-exchange'].batchRows[0]
         //如果是绑定条码
-        if(this.bindBarCodeFlag){
+        if (this.bindBarCodeFlag) {
           //判断页面中是否已有选择数据
           //没有重复数据
-          if (this.children.filter(it => it.pdtModelId == row.pdtModelId && it.moldlineId ==row.moldingBatch
-            && it.moldingDate ==row.moldingDate &&
+          if (this.children.filter(it => it.pdtModelId == row.pdtModelId && it.moldingBatch == row.moldingBatch
+            && it.moldingDate == row.moldingDate &&
             it.moldlineId == row.moldlineId && it.moldlineItemNo == row.moldlineItemNo).length == 0) {
-            //替换明细
-            this.checkDetailByBindBarCode(row)
+            //添加绑定条码
+            if (this.bindBarCodeAddFlag) {
+              this.addDetailByBindBarCode(row)
+              this.bindBarCodeAddFlag = false
+            }
+            //替换绑定条码
+            else {
+              this.checkDetailByBindBarCode(row)
+              this.bindBarCodeReplaceFlag = false
+            }
             this.showModal = false
           }
           //有重复数据
@@ -3743,7 +3776,7 @@
             this.$Message.error(this.$t('W_141'))
             return
           }
-        }else{
+        } else {
           // 判断替品是否有标价
           if (!row.priceStandard && row.priceStandard != 0) {
             this.$Message.error(this.$t('W_069', { 'param': this.$t('priceStandard') }))
@@ -3798,7 +3831,14 @@
           }
         }
         this.$emit('check-detail-by-bind-bar-code',this.focusedRow,row)
-
+      },
+      /**
+       *   @desc   : 添加明细--当前绑定条码用
+       *   @date   : 2023/4/27 14:37
+       *   @author : 寇珊珊
+       */
+      addDetailByBindBarCode(row){
+        this.$emit('add-detail-by-bind-bar-code',row)
       },
       /**
        * @desc   : 计算父级数据
@@ -3962,7 +4002,7 @@
               // {field: 'skuSpecs', type: 'disabled', minWidth: '40', title: this.$t('skuSpecs')},
             )
           }
-          //绑定条码- 产品
+          //绑定条码- 替换产品
           else if(col.treeNode && col.dataType === this.$config.tableSelectType.product){
             //设置后台接口服务
             this.methodsName = 'selectProductByBindBarcode'
@@ -3973,7 +4013,7 @@
               {itemCode: 'moldingBatch'},
               //成型日期
               {itemCode: 'moldingDate',
-                valueFormat: {code: 'moldingDate', default: [new Date().toDateStr(), new Date().toDateStr()]},
+                valueFormat: {code: 'moldingDate'},
                 valueKind: 'DATE_RANGE',},
               //分组名称
               {itemCode: 'groupName'},
@@ -4025,6 +4065,69 @@
               { field: 'moldlineItemKindName', title: this.$t('mouldKindName'), type: 'disabled', width: 'auto' },
             )
           }
+          //绑定条码- 添加产品
+          else if(col.treeNode && col.dataType === this.$config.tableSelectType.addProduct){
+            //设置后台接口服务
+            this.methodsName = 'selectProductCanBindBarcode'
+            this.methodsNameExchange = 'selectProductCanBindBarcode'
+            this.service = this.$service.moldingRecordItemService
+            this.searchContent = [
+              //成型批次
+              {itemCode: 'moldingBatch'},
+              //成型日期
+              {itemCode: 'moldingDate',
+                valueFormat: {code: 'moldingDate'},
+                valueKind: 'DATE_RANGE',},
+              //分组名称
+              {itemCode: 'groupName'},
+              //成型线编码
+              {itemCode: 'uniqueCode',
+                itemName:'moldlineCode'
+              },
+            ]
+            //替换的列
+            this.columnsUpdate.push(
+              { field: 'moldlineItemNo',title: this.$t('bondingNo') }, // 粘接序号
+              { field: 'moldlineItemCode',title: this.$t('repPdtModelName') },//可变更产品名称
+              { field: 'repPdtModelName'},//可变更产品名称
+              { field: 'uniqueCode',title: this.$t('moldlineCode')},//成型线编码
+              { field: 'moldlineName' },//成型线名称
+              { field: 'manageUserName' },//成型班长
+              { field: 'moldingUserName' },//成型工号
+              { field: 'modelCode',title: this.$t('productCode') },//产品编码
+              { field: 'modelName',title: this.$t('productName') },//产品名称
+              { field: 'mouldCode',title: this.$t('moldingModelCode') },//模具编号
+              { field: 'moldlineItemKindName',title: this.$t('mouldKindName') },//模具状态
+              { field: 'moldingBatch' },//成型批次
+              { field: 'flgMolding' },//成型标识
+              { field: 'unmoldedReasonName' },//未成型原因
+              { field: 'logoName' },//产品商标
+              { field: 'colourName' },//釉色
+              { field: 'flgScrap' },//损坯标识
+              { field: 'scrapReasonName' },//损坯原因
+            )
+            //弹窗的列
+            this.columnsDetail.push(
+              // 成型批次
+              { field: 'moldingBatch', type: 'disabled', width: 'auto' },
+              // 成型日期
+              { field: 'moldingDate', type: 'disabled', width: 'auto' },
+              // 分组序号
+              { field: 'groupNo', title: this.$t('groupNo'), treeNode: true, type: 'disabled', width: 'auto' },
+              // 分组名称
+              { field: 'groupName', title: this.$t('groupName'), type: 'disabled', width: 'auto' },
+              // 成型线编码
+              { field: 'uniqueCode', title: this.$t('moldlineCode'), type: 'disabled', width: 'auto' },
+              // 成型线名称
+              { field: 'moldlineName', type: 'disabled', width: 'auto' },
+              // 产品编码
+              { field: 'modelCode', title: this.$t('productCode'), type: 'disabled', width: 'auto' },
+              // 产品名称
+              { field: 'modelName', title: this.$t('productName'), type: 'disabled', width: 'auto' },
+              // 模具状态
+              { field: 'moldlineItemKindName', title: this.$t('mouldKindName'), type: 'disabled', width: 'auto' },
+            )
+          }
         })
       },
       /**

+ 2 - 2
src/components/business/print/template.vue

@@ -1542,7 +1542,7 @@ export default {
           let scanCodeInfo = {
             active: false,
             width: 80,
-            height: 64,
+            height: 80,
             path: '',
             name: '$scanCode',
             top: e.offsetY - 32 <= 0 ? 0 : e.offsetY - 32,
@@ -1554,7 +1554,7 @@ export default {
           let barCodeInfo = {
             active: false,
             width: 80,
-            height: 64,
+            height: 20,
             path: '',
             name: '$barCode',
             top: e.offsetY - 32 <= 0 ? 0 : e.offsetY - 32,

+ 1 - 0
src/config/index.js

@@ -961,6 +961,7 @@ export default {
     defect: 'defect',
     processNode: 'processNode',
     blameUser: 'blameUser',
+    addProduct: 'addProduct',
   },
   /**
    * @desc   : 选择类型

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

@@ -1079,6 +1079,9 @@ export const messages = {
   W_140: '当前数据暂无成型线粘贴方式,无法进行绑定条码',
   W_139: '请选择新型号',
   W_141: '页面中已存在该条数据,请重新选择',
+  W_142: '请选择父级进行添加',
+  W_143: '当前可添加数据已达上限,请重新选择',
+  W_144: '当前保存数据中有未添加的明细,请添加后重新操作',
   E_001: '系统出现异常,请联系管理员。',
   Q_001: '当前页面的数据有过更改,请确认需要保存吗?',
   Q_002: '确定要进行{param}操作吗?',

+ 1 - 1
src/view/pdm/molding-record/bind-barcode-group.vue

@@ -421,7 +421,7 @@
               uniqueCode: bomItems[0].productId ? null : it.productUniqueCode,
               remarks: it.productRemarks,
               flgPdtGlue: true,
-              modelId:bomItems[0].bomItems[0].repPdtModelId,
+              modelId:bomItems[0].repPdtModelId,
             })
           }
         }

+ 78 - 4
src/view/pdm/molding-record/bind-barcode-grouping.vue

@@ -7,7 +7,6 @@
                   :current="editIndex"
                   v-if="editKeys && editKeys.length > 1"
                   @pageChange="editPageChange"></DkPageButton>
-
     <DkCollapse ref="collapse" @on-change="changeCollapse">
       <DkPanel prop="essentialInformation">
         <!--  下拉区域  -->
@@ -34,6 +33,10 @@
 
       <DkPanel prop="moldingRecordRelation">
         <div slot="content" :style="'height: ' + tableHeight + 'px'">
+          <!--添加行按钮-->
+          <DkButton slot="content" type="success" @click="openAddDetailModal" size="small" :disabled="addRowFlag"
+                    style="float: left;position: absolute; top: 95px;left: 140px;">{{ $v('saveDetail') }}
+          </DkButton>
           <!--型记录信息-->
           <EditTreeTable ref="moldingRecord" :data="moldingRecordList" showFooter
                          major-field="id"
@@ -45,7 +48,9 @@
                          exchangeField="pdtModelId"
                          controlId="pdtModelId"
                          :bindBarCodeFlag="true"
+                         @current-change="getDetailAdd"
                          @check-detail-by-bind-bar-code="checkDetail"
+                         @add-detail-by-bind-bar-code="addDetail"
           ></EditTreeTable>
         </div>
       </DkPanel>
@@ -143,7 +148,8 @@
             }
           }
         },
-
+        addRowFlag: true,//保存至明细可用标识
+        row: {},//记录当前选择行数据
       }
     },
     methods: {
@@ -328,6 +334,63 @@
         this.$refs.moldingRecord.reloadData(this.moldingRecordList)
       },
       /**
+       *   @desc   : 获取添加子集
+       *   @date   : 2023/4/27 10:11
+       *   @author : 寇珊珊
+       */
+      getDetailAdd(e) {
+        //只存父级
+        if (e && e.row && e.row.hasChild == 1) {
+          this.row = e.row
+          this.addRowFlag = false
+        } else {
+          this.addRowFlag = true
+        }
+      },
+      /**
+       *   @desc   : 添加子集
+       *   @date   : 2023/4/27 10:03
+       *   @author : 寇珊珊
+       */
+      openAddDetailModal() {
+        //父级成型线下产品个数不存在,或者父级下成型线下产品个数和父级明细个数不相等
+        if (this.row) {
+          if (!this.row.modelCount || (this.row.modelCount && this.row.modelCount != this.row.bomItems.length)) {
+            //赋值查询类型
+            this.moldingRecordTreeColumns[0].dataType = this.$config.tableSelectType.addProduct
+            //设置组件弹窗字段
+            this.$refs.moldingRecord.setLoadChildInit()
+            this.$refs.moldingRecord.focusedRow = this.row
+            //加载数据
+            this.$refs.moldingRecord.getDataTable(this.row)
+          } else {
+            this.$Message.error(this.$t('W_143'))
+          }
+        } else {
+          this.$Message.error(this.$t('W_142'))
+        }
+      },
+      /**
+       *   @desc   : 将选择后的数据添加至明细
+       *   @date   : 2023/4/27 14:41
+       *   @author : 寇珊珊
+       */
+      addDetail(row) {
+        this.addRowFlag = false
+        for (let it of this.moldingRecordList) {
+          if (this.row.id == it.id) {
+            row.parentId = it.id
+            row.moldingItemId = row.itemId
+            this.$set(row, 'readOnly', ['productUniqueCode'])
+            it.bomItems.push(row)
+          }
+          it.modelCount = row.modelCount
+        }
+        // 处理子级数据
+        this.$refs.moldingRecord.loadChildrenInit(this.moldingRecordList, ['productUniqueCode'])
+        this.$refs.moldingRecord.reloadData(this.moldingRecordList)
+      },
+      /**
        *   @desc   : 通过id查询
        *   @date   : 2023/2/28 11:25
        *   @author : 寇珊珊
@@ -421,7 +484,7 @@
               uniqueCode: bomItems[0].productId ? null : it.productUniqueCode,
               remarks: it.productRemarks,
               flgPdtGlue: true,
-              modelId:bomItems[0].bomItems[0].repPdtModelId,
+              modelId: bomItems[0].repPdtModelId,
             })
           }
         }
@@ -462,11 +525,22 @@
           this.$Message.error(this.$t('W_110'))
           return false
         }
+        //todo  判断每组数据是否达到可保存数量
+        //如果本次都不需要绑定条码
+        if(this.productUniqueCodeCount != this.moldingRecordList.length){
+          //过滤掉总单中本次不需要进行绑定条码的数据
+          for(let i of  this.moldingRecordList.filter(it=>!it.readOnlyUniqueCode)){
+            if(!i.modelCount ||i.modelCount && i.modelCount!= i.bomItems.length){
+              this.$Message.error(this.$t('W_144'))
+              return false
+            }
+          }
+        }
         return true
       },
     },
     created() {
-      this.resizeTableFlag = true;  // 计算表格高度
+      this.resizeTableFlag = true  // 计算表格高度
     },
     activated() {
       this.detail(this.$route.params.id)