Răsfoiți Sursa

修改NC齐套和工艺文件齐套逻辑

695593266@qq.com 6 luni în urmă
părinte
comite
1b0f812c20

+ 183 - 89
src/views/productionPlan/components/checkProductionPreparations.vue

@@ -57,14 +57,14 @@
           齐套检查
         </el-link>
 
-        <el-link
+        <!-- <el-link
           type="primary"
           :underline="false"
           @click="taskAssignment"
           v-if="row.statusStr == '缺料' && type == 'plan' && row.preType == '5'"
         >
           任务派单
-        </el-link>
+        </el-link> -->
       </template>
     </ele-pro-table>
 
@@ -97,6 +97,7 @@
             placeholder="请选择"
             style="width: 100%"
             @change="leaderListChange"
+            filterable
           >
             <el-option
               v-for="item in leaderList"
@@ -113,7 +114,7 @@
             type="textarea"
             :rows="4"
             placeholder="请输入内容"
-            v-model="form.remake"
+            v-model="form.remark"
           >
           </el-input>
         </el-form-item>
@@ -125,33 +126,101 @@
     </el-dialog>
     <ele-modal
       width="65vw"
-      :visible.sync="fileVisible"
-      v-if="visible"
+      :visible.sync="routeVisible"
+      v-if="routeVisible"
       append-to-body
       :maxable="true"
       :title="fileTitle"
     >
       <ele-pro-table
         ref="ncFileTable"
-        :columns="fileTitle == 'NC代码' ? jobColumns2 : jobColumns1"
-        :datasource="fileList"
+        :columns="jobColumns2"
+        :datasource="bomDataList"
         :need-page="false"
         :immediate="true"
+        @refresh="refresh"
       >
+        <template v-slot:code="{ row }">
+          <el-link type="primary" :underline="false" @click="goDetail(row)">
+            {{ row.code }}
+          </el-link>
+        </template>
         <template v-slot:action="{ row, $index }">
-          <el-link
+          <!-- <el-link
             type="primary"
             @click="fileDetails(row, fileTitle == 'NC代码' ? 'nc' : '')"
             >详情</el-link
+          > -->
+
+          <!-- <el-link
+          type="primary"
+          :underline="false"
+          @click="taskAssignment"
+          v-if="row.statusStr == '缺料' && type == 'plan' && row.preType == '5'"
+        >
+          任务派单
+        </el-link> -->
+
+          <el-link
+            type="primary"
+            @click="taskAssignment(row)"
+            :underline="false"
+            v-if="row.preType == 5 && row.ncCodeList.length == 0"
+            >任务派单</el-link
           >
         </template>
 
+        <template v-slot:versions="{ row, $index }">
+          <span v-if="row.versions">V{{ row.versions }}.0</span>
+        </template>
+        <template v-slot:statusStr="{ row }">
+          <span
+            v-if="row.preType == 4 && row.fileParam.length == 0"
+            style="color: red"
+          >
+            缺料
+          </span>
+          <span
+            v-else-if="row.preType == 5 && row.ncCodeList.length == 0"
+            style="color: red"
+          >
+            缺料
+          </span>
+          <span v-else style="color: green">齐套</span>
+        </template>
       </ele-pro-table>
-              <template v-slot:footer v-if="fileTitle == 'NC代码'">
-          <el-button size="small" @click="fileVisible=false">返回</el-button>
-          <el-button type="primary" size="small" @click="save('齐套')">齐套</el-button>
-          <el-button type="primary" size="small" @click="save('缺料')">不齐套</el-button>
+      <template v-slot:footer v-if="fileTitle == 'NC代码'">
+        <el-button size="small" @click="routeVisible = false">返回</el-button>
+        <el-button type="primary" size="small" @click="save('齐套')"
+          >齐套</el-button
+        >
+        <el-button type="primary" size="small" @click="save('缺料')"
+          >不齐套</el-button
+        >
+      </template>
+    </ele-modal>
+
+    <ele-modal
+      width="65vw"
+      :visible.sync="fileVisible"
+      v-if="fileVisible"
+      append-to-body
+      :maxable="true"
+      :title="fileTitle"
+    >
+      <ele-pro-table
+        ref="ncFileTable"
+        :columns="jobColumns1"
+        :datasource="fileList"
+        :need-page="false"
+        :immediate="true"
+      >
+        <template v-slot:code="{ row }">
+          <el-link type="primary" :underline="false" @click="fileDetails(row)">
+            {{ row.code }}
+          </el-link>
         </template>
+      </ele-pro-table>
     </ele-modal>
 
     <kitting-complete ref="kittingCompleteRef"></kitting-complete>
@@ -220,38 +289,26 @@
           {
             label: '编码',
             prop: 'code',
+            slot: 'code',
             width: 180,
             align: 'center',
             showOverflowTooltip: true
           },
 
           {
-            prop: 'name',
-            label: '文档名称',
-            align: 'center',
-            slot: 'name',
-            showOverflowTooltip: true,
-            minWidth: 200
-          },
-
-          {
-            prop: 'storagePath',
+            prop: 'version',
             label: '文件名称',
             align: 'center',
-
             showOverflowTooltip: true,
-            minWidth: 200,
-            formatter: (_row, _column, cellValue) => {
-              return cellValue[0]?.name;
-            }
+            minWidth: 200
           },
-
           {
-            prop: 'version',
+            prop: 'name',
             label: '版本',
             align: 'center',
+            slot: 'name',
             showOverflowTooltip: true,
-            minWidth: 100
+            minWidth: 200
           },
 
           {
@@ -260,15 +317,6 @@
             showOverflowTooltip: true,
             align: 'center',
             minWidth: 110
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 100,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
           }
         ],
         // 表格选中数据
@@ -284,6 +332,7 @@
           {
             label: '编码',
             prop: 'code',
+            slot: 'code',
             width: 180,
             align: 'center',
             showOverflowTooltip: true
@@ -298,39 +347,27 @@
           },
           {
             prop: 'versions',
+            slot: 'versions',
             label: '版本',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 100
           },
           {
-            prop: 'remark',
-            label: '文本描述',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 200
-          },
-          {
-            prop: 'ncSize',
-            label: '文件大小',
+            prop: 'workCenterName',
+            label: '工作中心',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 100
           },
+
           {
-            prop: 'createName',
-            label: '创建人',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            showOverflowTooltip: true,
+            prop: 'statusStr',
+            slot: 'statusStr',
             align: 'center',
-            minWidth: 110
+            label: '状态'
           },
+
           {
             columnKey: 'action',
             label: '操作',
@@ -348,7 +385,10 @@
           executeGroupId: '',
           executorName: '',
           executorId: '',
-          remake: ''
+          remark: '',
+          taskId: '',
+          taskName: '',
+          sourceTaskId: ''
         },
         dialogVisible: false,
         rules: {
@@ -356,7 +396,11 @@
             { required: true, message: '请选择技术人员', trigger: 'blur' }
           ]
         },
-        itemData: {}
+        itemData: {},
+        bomDataList: [],
+        productionData: {},
+        routeVisible: false,
+        fileList: []
       };
     },
 
@@ -446,18 +490,18 @@
           });
         });
       },
-      fileDetails(row, type) {
-        if (type == 'nc') {
-          newFilePageAPI({
-            ids: "'" + row.fileId + "'"
-          }).then((res) => {
-            if (res.length) {
-              window.open(setFileUrl(res[0]));
-            }
-          });
-        } else {
-          window.open(setFileUrl(row));
-        }
+      fileDetails(row) {
+        // if (row.preType == '5') {
+        //   newFilePageAPI({
+        //     ids: "'" + row.fileId + "'"
+        //   }).then((res) => {
+        //     if (res.length) {
+        //       window.open(setFileUrl(res[0]));
+        //     }
+        //   });
+        // } else {
+        window.open(setFileUrl(row));
+        // }
       },
       getTypeLabel(value) {
         const item = this.typeList.find((it) => it.value === value);
@@ -488,12 +532,12 @@
       handleClose() {
         this.dialogVisible = false;
       },
-      save(statusStr){
-        let data=this.preReleaseList.find(item=>item.preType==5)
-        console.log(data)
-        data.statusStr=statusStr
+      save(statusStr) {
+        let data = this.preReleaseList.find((item) => item.preType == 5);
+        console.log(data);
+        data.statusStr = statusStr;
         this.updatePreRelease(data);
-        this.fileVisible=false
+        this.routeVisible = false;
       },
       updatePreRelease(item) {
         if (this.type == 'plan') {
@@ -505,6 +549,7 @@
         this.$emit('update');
       },
       async kittingComplete(item) {
+        this.productionData = item;
         if (item.preType == '6') {
           this.$confirm('是否确认齐套?', '提示', {
             confirmButtonText: '齐套',
@@ -532,28 +577,76 @@
           res.forEach((row) => {
             fileParam.push(row.fileParam.map((item) => item.id));
             ncCodeList.push(row.ncCodeList);
+            row.preType = item.preType;
           });
+          this.bomDataList = res;
           if (item.preType == '4') {
-            fileParam = fileParam.flatMap((subarray) => subarray);
-            if (fileParam.length) {
-              this.fileList = await newFilePageAPI({
-                ids: "'" + fileParam + "'"
-              });
-            }
-
             this.fileTitle = '工艺文件';
           } else {
             this.fileTitle = 'NC代码';
-            this.fileList = ncCodeList.flatMap((subarray) => subarray);
           }
-          this.fileVisible = true;
+          this.routeVisible = true;
         } else {
-          this.itemData.productionPlanId=this.itemData.productionPlanId||this.itemData.id
+          this.itemData.productionPlanId =
+            this.itemData.productionPlanId || this.itemData.id;
           const list = [this.itemData];
           this.$refs.kittingCompleteRef.open(list);
         }
       },
-      taskAssignment() {
+
+      async refresh() {
+        const res = await listBomTaskFile(
+          this.itemData.bomCategoryId,
+          this.itemData.produceRoutingId
+        );
+        let fileParam = [];
+        let ncCodeList = [];
+        res.forEach((row) => {
+          fileParam.push(row.fileParam.map((item) => item.id));
+          ncCodeList.push(row.ncCodeList);
+          row.preType = this.productionData.preType;
+        });
+        this.bomDataList = res;
+        if (this.productionData.preType == '4') {
+          this.fileTitle = '工艺文件';
+        } else {
+          this.fileTitle = 'NC代码';
+        }
+      },
+
+      async goDetail(item) {
+        if (item.preType == '4') {
+          if (item.fileParam.length != 0) {
+            let fileParam = item.fileParam.map((item) => item.fileId).join(',');
+            this.fileList = await newFilePageAPI({
+              ids: "'" + fileParam + "'"
+            });
+          } else {
+            this.fileList = [];
+          }
+
+          this.fileTitle = '工艺文件';
+        } else {
+          if (item.ncCodeList.length != 0) {
+            let ncCodeList = item.ncCodeList
+              .map((item) => item.fileId)
+              .join(',');
+            this.fileList = await newFilePageAPI({
+              ids: "'" + ncCodeList + "'"
+            });
+          } else {
+            this.fileList = [];
+          }
+          this.fileTitle = 'NC代码';
+        }
+
+        this.fileVisible = true;
+      },
+
+      taskAssignment(row) {
+        this.form.taskId = row.id;
+        this.form.taskName = row.name;
+        this.form.sourceTaskId = row.sourceTaskId;
         this.dialogVisible = true;
       },
 
@@ -611,6 +704,7 @@
         })
           .then(() => {
             loading.close();
+            this.$message.success('派单成功');
             this.form = {
               executeGroupName: '',
               executeGroupId: '',

+ 12 - 1
src/views/productionPlan/components/factoryAdd/index.vue

@@ -842,7 +842,8 @@
           { code: 3, name: '装配(ABOM)' }
         ],
         selectIndex: 0, // 选择工艺路线的当前数据下标
-        processingRequired: 0 // 生产类型跟BOM 版本是否必填 1:是 0:否
+        processingRequired: 0, // 生产类型跟BOM 版本是否必填 1:是 0:否
+        isReview: false
         // selectionRowShow: false // 工艺路线输入框展示 状态
       };
     },
@@ -863,6 +864,8 @@
           this.processingRequired = res.value;
         }
       });
+
+      this.getplannedReleaseRequire('planned_release_require');
     },
     methods: {
       // 获取
@@ -895,6 +898,14 @@
         this.$set(row, 'factoriesName', data.name);
       },
 
+      async getplannedReleaseRequire(code) {
+        parameterGetByCode({ code }).then((res) => {
+          if (res) {
+            this.isReview = res.value == '1' ? true : false;
+          }
+        });
+      },
+
       // 打开工艺路线
       openDialog(index) {
         this.selectIndex = index;