oyq28 1 rok pred
rodič
commit
f6e81d614f

+ 10 - 0
imcs-ui/src/api/lineSideLibrary/toolStorge.js

@@ -77,6 +77,10 @@ const apiList = {
     method: 'POST',
     url: `/authority/toolStorge/saveStorge`
   },
+  getDeviceStorge: {
+    method: 'POST',
+    url: `/authority/toolStorge/getDeviceStorge`
+  },
 }
 
 export default {
@@ -206,4 +210,10 @@ export default {
       data
     })
   },
+  getDeviceStorge (data) {
+    return axiosApi({
+      ...apiList.getDeviceStorge,
+      data
+    })
+  },
 }

+ 104 - 48
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/runningOrder/changeToolTask/Index.vue

@@ -5,9 +5,9 @@
 
   		<!-- 货架(单个) -->
   		<template>
-	  		<div class="tableBlock" v-for="item in shelvesTreeList" :key="item.id">
+<!--	  		<div class="tableBlock" v-for="item in shelvesTreeList" :key="item.id"></div>-->
 	  			<!-- 上部分-是个统计数据 -->
-	  			<div class="topDiv">
+<!--	  			<div class="topDiv">
 	  				<span class="topSpan allTongji">
 	  					<span>{{$t("lineSide.common.allCount")}}:</span>
 	  					<countTo :duration="3000" :end-val="parseInt(item.allCount)" :start-val="0"/>
@@ -24,24 +24,48 @@
 	  					<span>{{$t("lineSide.common.freeCount")}}:</span>
 	  					<countTo :duration="3000" :end-val="parseInt(item.freeCount)" :start-val="0"/>
 	  				</span>
-	  			</div>
+            <el-button  class="el-button&#45;&#45;primary generateTask" @click="saveToolTask()">生成任务</el-button>
+	  			</div>-->
 	  			<!-- 中部-货架小格子 -->
-	  			<table class="contentDiv" border="0" cellspacing="0" cellpadding="6">
-            <tr v-for="(objTr, objIndex) in item.children" :key="objIndex">
-              <td v-for="objTd in objTr.children" :key="objTd.toolId"
-                  :class="{ 'blueBg': objTd.toolHandleId, 'redBg': objTd.tdBackground }"
-                  @click="selectCell(objTd)"
-                  @dblclick="editOne(objTd)">
-                {{objTd.no}}
-                <el-image v-if="objTd.lockStatus == '0'" class="locked" :src="resolveLogo(lockImg)" fit="contain"></el-image>
-              </td>
-            </tr>
-	  			</table>
+
 	  			<!-- 下部-货架名称编号 -->
-	  			<div class="footerDiv">{{item.name}}({{item.no}})</div>
-          <span style="font-size: 18px;">还需要换出 <span style="color: red;font-size: 30px;">{{ remainingToolCount }}</span> 把刀</span>
-          <el-button  class="el-button--primary generateTask" @click="saveToolTask()">生成任务</el-button>
-	  		</div>
+
+          <el-form ref="form" :model="tenant"  label-position="right" label-width="130px">
+            <!-- 列表数据 -->
+            <span style="font-size: 18px;">{{ deviceName }}需要放入 <span style="color: red;font-size: 30px;">{{ allCount }}</span> 把刀</span>
+            <span style="font-size: 18px;">,还缺 <span style="color: red;font-size: 30px;">{{ remainingToolCount }}</span> 把刀</span>
+            <el-button  class="el-button--primary generateTask" @click="saveToolTask()">生成任务</el-button>
+            <el-table
+              :key="tableKey"
+              ref="table"
+              v-loading="loading"
+              :data="shelvesTreeList"
+              border
+              fit
+              row-key="id"
+              style="width: 100%;"
+              @selection-change="onSelectChange"
+            >
+              <el-table-column label='' width="50" align="center"></el-table-column>
+              <el-table-column align="center"  type="selection" width="50" :reserve-selection="true" />
+              <el-table-column prop="name" :label='"库位名称"' :show-overflow-tooltip="true"></el-table-column>
+              <el-table-column prop="no" :label='"库位编码"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="handleName" :label='"刀柄名称"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="cuttingToolName" :label='"刀具名称"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="cutterCode" :label='"刀具编码"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="toolLifeSpan" :label='"刀具寿命"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="toolRatedUsageCount" :label='"刀具额定次数"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="toolUsedCount" :label='"刀具使用次数"' :show-overflow-tooltip="true" ></el-table-column>
+              <el-table-column prop="lockStatus" :label='$t("lineSide.table.side.lockStatus")' align="center" width="90px">
+                <template slot-scope="{ row }">
+                  <el-tag :type="row.lockStatus=='0' ? 'success' : 'danger'">
+                    {{ row.lockStatus=='0' ? $t("common.yes") : $t("common.no") }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form>
+
   		</template>
 
 
@@ -82,6 +106,7 @@
 	import areaMgrAPI from "@/api/resourceProductMgr/areaMgr"
 	// 【边线库管理】-API
 	import lineSideMgrApi from "@/api/lineSideLibrary/lineSideMgr"
+	import toolStroge from "@/api/lineSideLibrary/toolStorge"
 
 	import elDragDialog from '@/directive/el-drag-dialog'
 	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
@@ -102,7 +127,23 @@
         type: String,
         default:''
       },
-      toolCategory:[]
+      toolCategory:[],
+      dialogVisible: {
+        type: Boolean,
+        default: false
+      },
+      title: {
+        type: String,
+        default: ''
+      },
+      deviceName: {
+        type: String,
+        default: ''
+      },
+      planId: {
+        type: String,
+        default: ''
+      },
 	  },
 	  data () {
 	    return {
@@ -136,6 +177,7 @@
 	      dicts: {
           NATION: {}
         },
+        tenant: this.initTenant(),
 	      enums: {
 	        TenantTypeEnum: {},
 	        TenantStatusEnum: {}
@@ -163,16 +205,35 @@
 	    nationList() {
         return convertEnum(this.dicts.NATION)
       },
-      remainingToolCount() {
-        const count = this.toolCategory.length - this.cellSelections.length;
-        console.log('remainingToolCount:', count);
-        return count;
+      remainingToolCount: {
+        get() {
+          const count = this.toolCategory.length - this.selection.length;
+          console.log('remainingToolCount:', count);
+          if(count < 0){
+            return 0
+          }
+          return count;
+        },
+        set(value) {
+          console.log('setting remainingToolCount:', value);
+        },
+      },
+      allCount(){
+        return this.toolCategory.length
       },
 	  },
 	  mounted () {
 
 	  },
 	  methods: {
+      initTenant () {
+        return {
+          id: '',
+          handleCode:'',
+          toolCode:'',
+          oldHandleId: ''
+        }
+      },
 	  	// 加载背景颜色
 	  	setBackground(color){
 	  		return "background: "+ color +";"
@@ -184,7 +245,10 @@
 	    viewClose () {
 	      this.tenantViewVisible = false
 	    },
-	    editClose () {
+      close () {
+        this.$emit('close')
+      },
+      editClose () {
 	      this.dialog.isVisible = false
 	    },
 	    editSuccess () {
@@ -203,6 +267,7 @@
 	      this.queryParams = initQueryParams({})
 	      this.$refs.table.clearSort()
 	      this.$refs.table.clearFilter()
+        this.$refs.table.clearSelection(); // 清除所有选中项
 	      this.search()
 	    },
 	    add () {
@@ -334,29 +399,12 @@
 	    // 获取列表数据
 	    getTabList(){
         console.log("deviceId:"+this.deviceId)
-	    	lineSideMgrApi.iconListV2({}).then(res => {
+        toolStroge.getDeviceStorge({"deviceId":this.deviceId}).then(res => {
 	    		res = res.data
 	    		console.log("方块列表:", res)
-	    		if(res.isSuccess){
-            let filteredData;
-            if(this.deviceId){
-               filteredData = res.data.shelvesTreeList.filter(item => item.deviceId === this.deviceId  && item.toolType === "1");
-            }else{
-               filteredData = res.data.shelvesTreeList.filter(item => item.toolType === "4");
-            }
-
-            console.log("filteredData:",filteredData)
-            // 设备的货架数据
-    				this.shelvesTreeList = filteredData
-    				// 统计数据
-    				this.topTongjiData = {
-    					"freestockCount": res.data.freestockCount,
-							"instockCount": res.data.instockCount,
-							"lockstockCount": res.data.lockstockCount,
-							"shelvesCount": res.data.shelvesCount,
-							"storgeCount": res.data.storgeCount
-    				}
-	    		}
+          if(res.isSuccess){
+            this.shelvesTreeList = res.data;
+          }
 	    	})
 	    },
       saveToolTask(){
@@ -365,9 +413,15 @@
           id: this.deviceId,
           planId: this.detailPlanId,
           list: this.toolCategory,
-          storgeId: this.cellSelections
+          storgeId: this.selection
         }
-        if(this.cellSelections.length <= 0){
+        if(this.selection.length != this.toolCategory.length){
+          this.$message.error('放刀数量不等于缺刀数量');
+          this.confirmDisabled = false
+          return;
+        }
+
+        if(this.selection.length <= 0){
           this.$message({
             message: '请至少选择一个',
             type: 'error'
@@ -378,6 +432,7 @@
         orderMgrApi.saveDetailToolTask(requestParam).then(response => {
           const res = response.data
           if(res.isSuccess){
+            this.reset ();
             this.$emit('close');
           }
         }).finally(() => this.loading = false)
@@ -649,8 +704,9 @@
     color: white;
   }
   .generateTask{
-    margin-left: 18% !important;
+    margin-left: 2% !important;
     margin-top: 2%;
+    margin-bottom: 1%;
   }
 
 </style>

+ 1 - 0
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/runningOrder/components/checkCuttingTools/index.vue

@@ -131,6 +131,7 @@
 
       checkDetailCuttingToolsClose(){
           this.checkDetailCuttingToolsVisible = false
+          this.$refs.childForRef.reset();
       },
       save(){
         orderMgrApi.saveToolTask(this.tableData).then(response => {