From 3ab330b8aefb3cd781c9b8730b4ab7ac65e7e9d7 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 07 三月 2025 09:14:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue |  278 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 191 insertions(+), 87 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue
index 4e0033d..8af0dde 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue
@@ -2,10 +2,44 @@
 import {reactive, ref, watch} from "vue";
 import {useI18n} from "vue-i18n";
 import {Platform, Search, SuccessFilled} from "@element-plus/icons-vue";
+import useUserInfoStore from "@/stores/userInfo";
+import request from "@/utils/request";
+import {ElMessage} from "element-plus";
+
+
+const userStore = useUserInfoStore()
+const username = userStore.user.userName
 
 const {t} = useI18n()
 
 const xGrid = ref()
+//鑾峰彇宸ョ▼鍙�
+const props = defineProps({
+  projectNo : String,
+  data: {
+    type: Array,
+    default: () => []
+  }
+});
+// 瀹氫箟鍝嶅簲寮忔暟鎹紝鐢ㄤ簬缁戝畾宸ョ▼鍙疯緭鍏ユ鐨勫��
+const inputValue = ref(props.projectNo);
+
+
+
+// 瀹氫箟娣锋帓绛夌骇
+const optionVal = ref('')
+
+// 瀹氫箟瑁呰浇鐜�
+const percentage1 = ref(80)
+const percentage2 = ref(50)
+
+// 瀹氫箟鍏朵粬琛ㄥ崟鏁版嵁
+const furnaceWidth = ref('') // 鐐夊
+const furnaceLength = ref('') // 鐐夐暱
+const heatingTime = ref('') // 鍔犵儹鏃堕棿
+const spacingLong = ref('') // 闀胯酱闂撮殧
+const spacingWidth = ref('') // 瀹借酱闂撮殧
+
 
 const gridOptions = reactive({
   height: '100%',
@@ -36,14 +70,14 @@
   },
 
   columns: [
-    {field: 'id', width: 70, title: '搴忓彿', filters: [{data: ''}], slots: {default: 'state', filter: 'num2_filter'}},
-    {field: '', width: 100, title: '鐗堝浘鏁�'},
-    {field: '', width: 100, title: '瑁呰浇鐜�'},
-    {field: '', width: 100, title: '娴佺▼鍗℃暟'},
-    {field: '', width: 100, title: '妯℃嫙鐗囨暟'},
+    {field: 'id', width: 70, title: '搴忓彿'},
+    {field: 'layoutsNumber', width: 100, title: '鐗堝浘鏁�'},
+    {field: 'loadingRate', width: 100, title: '瑁呰浇鐜�'},
+    {field: 'processCards', width: 100, title: '娴佺▼鍗℃暟'},
+    {field: 'simulatedPieces', width: 100, title: '妯℃嫙鐗囨暟'},
     {
       field: 'processId',
-      width: 150,
+      width: 350,
       title: t('processCard.processId'),
       filters: [{data: ''}],
       slots: {filter: 'num1_filter'},
@@ -60,12 +94,34 @@
 })
 
 
-// 杩涘害鏉¢鑹插拰鎸夐挳鍔犲噺
-const percentage1 = ref(80)
-const percentage2 = ref(50)
 
-// 娣锋帓绛夌骇
-const optionVal = ref('')
+
+
+// 鐩戝惉鐖剁粍浠朵紶閫掔殑鏁版嵁鍙樺寲
+watch(() => props.data, (newValue) => {
+  if (newValue) {
+    // 澶勭悊鏁版嵁骞舵洿鏂拌〃鏍�
+    const processData = newValue.data[0];
+    console.log('Processed Data:', processData);
+    const processedData = [
+      {
+        id: "1",
+        layoutsNumber: processData.resultSum[0],
+        loadingRate: processData.resultSum[1],
+        processCards: processData.rackinfos.length,
+        simulatedPieces: processData.glass_details.length,
+        processId:processData.rackinfos
+      }
+    ];
+    gridOptions.data = processedData;
+    console.log(gridOptions.data)
+  } else {
+    console.error("鏁版嵁鏍煎紡涓嶆纭垨涓虹┖");
+    gridOptions.data = [];
+  }
+})
+
+
 const options = [
   {
     value: '0',
@@ -85,20 +141,70 @@
   },
 ]
 
-//鑾峰彇宸ョ▼鍙�
-const props = defineProps({
-  projectNo : String
-});
-// 瀹氫箟鍝嶅簲寮忔暟鎹紝鐢ㄤ簬缁戝畾宸ョ▼鍙疯緭鍏ユ鐨勫��
-const inputValue = ref(props.projectNo);
 
-let emit = defineEmits(['fetch-data']);
 
+// let emit = defineEmits(['fetch-data']);
+let emit = defineEmits(['fetch-data', 'sendData'])
+const inputValues = {
+  project_no:inputValue,
+    glass_thickness:"",
+    glass_type:"",
+    chaos_pct: optionVal.value*0.01,//娣锋帓绛夌骇
+    cage_free:percentage2.value*0.01,//鐞嗙墖榫欑┖闂插害
+    tempering_time:heatingTime.value,//閽㈠寲鍔犵儹鏃堕棿
+    heat_mode: 0,//妯″紡閫夋嫨
+    max_load_pct: percentage1.value*0.01,//鏈�澶ц杞界巼
+    max_area: 0,//鏈�澶ч潰绉�
+    max_qty:0,//鏈�澶х墖鏁�
+    load_width:furnaceWidth,
+    load_length: furnaceLength,
+  x_space: spacingWidth,
+  y_space: spacingLong,
+  load_rate: null,
+  };
+
+  // 鍙戦�佹墍鏈夋暟鎹埌鐖剁粍浠�
+  emit('sendData', {
+    ...inputValues
+  });
 const handleSearchClick = () => {
   // 閫氳繃 $emit 瑙﹀彂鑷畾涔変簨浠讹紝灏嗗伐绋嬪彿浼犻�掔粰鐖剁粍浠讹紝鐢辩埗缁勪欢鍘昏皟鐢ㄦ帴鍙h幏鍙栨暟鎹�
   emit('fetch-data', inputValue.value);
+ 
+ 
+};
+const handleSimulationClick = () => {
+  // 瑙﹀彂鐖剁粍浠剁殑 simulate-click 浜嬩欢
+  emit('simulate-click');
+ 
 };
 
+
+
+
+
+const handleSave = () => {
+  
+  if (props.data) {
+ 
+
+    let projectData = ref({
+      projectdetail: props.data,
+      userName : username,
+      inputValues:inputValues
+    })
+   
+    request.post(`/glassOptimize/simulationSave`, projectData.value).then((res) => {
+      if (res.code == 200 && res.data === true) {
+        ElMessage.success(t('basicData.msg.saveSuccess'))
+      
+      } else {
+        ElMessage.warning(res.msg)
+      }
+    })
+
+  }
+}
 
 </script>
 
@@ -106,77 +212,75 @@
   <div style="width: 100%;height: 100%">
     <!--妯℃嫙璁$畻琛ㄥご-->
     <div id="title" style="margin-top: -10px">
-      <span>
-        宸ョ▼缂栧彿
-      <el-input style="width:150px;margin-left: 30px" clearable v-model="inputValue" placeholder="璇疯緭鍏ュ伐绋嬪彿"></el-input>
-      <el-button
-          type="primary"
-          :icon="Search"
-          style="margin-left: 20px"
-          @click="handleSearchClick"
-      >{{ $t('basicData.search') }}
-      </el-button>
+  <span>
+    宸ョ▼缂栧彿
+    <el-input style="width:150px;margin-left: 30px" clearable v-model="inputValue" placeholder="璇疯緭鍏ュ伐绋嬪彿"></el-input>
+    <el-button
+        type="primary"
+        :icon="Search"
+        style="margin-left: 20px"
+        @click="handleSearchClick"
+    >{{ $t('basicData.search') }}
+    </el-button>
+  </span>
+  <span style="float: right ; margin-right: 120px">
+    宸ョ▼娣锋帓绛夌骇
+      <el-select
+          placeholder="閫夋嫨娣锋帓绛夌骇"
+          style="margin-left:10px; width: 200px; "
+          ref="getSelect"
+          v-model="optionVal"
+          clearable
+          class="m-2"
+          @change="getWorkOrder"
+      >
+        <el-option
+            v-for="item in options"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+        />
+      </el-select>
+    <el-button type="primary" style="margin-left: 10px" :icon="Platform"  @click="handleSimulationClick">妯℃嫙璁$畻</el-button>
+    <el-button type="primary" style="margin-left: 20px" :icon="SuccessFilled"  @click="handleSave">淇濆瓨</el-button>
+  </span><br>
+  <div class="demo-progress" style="margin-top: 5px">
+    <div style="display: flex; align-items: center">
+      <span>閽㈠寲鏈�澶ц杞�</span>
+      <!-- 杩涘害鏉¤缃� -->
+      <el-slider
+          style="max-width: 400px; flex: 1; margin-left: 10px"
+          v-model="percentage1"
+          :min="0"
+          :max="100"
+          :step="1"/>
+      <span style="margin-left: 20px ; width: 30px;">{{ percentage1 }}%</span>
+      <span style="float: right ; margin-left: 150px;">
+            瀹借酱闂撮殧 <vxe-input size="small" class="input" clearable v-model="spacingWidth"></vxe-input>
+            鐐夊(mm) <vxe-input size="small" class="input" clearable v-model="furnaceWidth"></vxe-input>
       </span>
-      <span style="float: right ; margin-right: 120px">
-        宸ョ▼娣锋帓绛夌骇
-          <el-select
-              placeholder="閫夋嫨娣锋帓绛夌骇"
-              style="margin-left:10px; width: 200px; "
-              ref="getSelect"
-              v-model="optionVal"
-              clearable
-              class="m-2"
-              @change="getWorkOrder"
-          >
-
-            <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-            />
-          </el-select>
-      <el-button type="primary" style="margin-left: 10px" :icon="Platform">妯℃嫙璁$畻</el-button>
-      <el-button type="primary" style="margin-left: 20px" :icon="SuccessFilled">淇濆瓨</el-button>
-      </span><br>
-      <div class="demo-progress" style="margin-top: 5px">
-        <div style="display: flex; align-items: center">
-          <span>閽㈠寲鏈�澶ц杞�</span>
-          <!--杩涘害鏉¤缃�-->
-          <el-slider
-              style="max-width: 400px; flex: 1; margin-left: 10px"
-              v-model="percentage1"
-              :min="0"
-              :max="100"
-              :step="1"/>
-          <span style="margin-left: 20px ; width: 30px;">{{ percentage1 }}%</span>
-          <span style="float: right ; margin-left: 150px;">
-                宸ョ▼鐜荤拑鐗�&nbsp;&nbsp;<vxe-input size="small" class="input" clearable></vxe-input>
-                瀹借酱闂撮殧 <vxe-input size="small" class="input" clearable></vxe-input>
-                鐐夊(mm) <vxe-input size="small" class="input" clearable></vxe-input>
-              </span>
-        </div>
-      </div>
-      <br>
-      <div class="demo-progress" style="margin-top: -10px">
-        <div style="display: flex; align-items: center">
-          <span>鐞嗙墖绗肩┖闂插害</span>
-          <!--杩涘害鏉¤缃�-->
-          <el-slider
-              style="max-width: 400px; flex: 1; margin-left: 10px"
-              v-model="percentage2"
-              :min="0"
-              :max="100"
-              :step="1"/>
-          <span style="margin-left: 20px ; width: 30px;">{{ percentage2 }}%</span>
-          <span style="float: right ; margin-left: 150px;">
-                  鍔犵儹鏃堕棿(绉�)<vxe-input size="small" class="input" clearable></vxe-input>
-                  闀胯酱闂撮殧 <vxe-input size="small" class="input" clearable></vxe-input>
-                  鐐夐暱(mm) <vxe-input size="small" class="input" clearable></vxe-input>
-          </span>
-        </div>
-      </div>
     </div>
+  </div>
+  <br>
+  <div class="demo-progress" style="margin-top: -10px">
+    <div style="display: flex; align-items: center">
+      <span>鐞嗙墖绗肩┖闂插害</span>
+      <!-- 杩涘害鏉¤缃� -->
+      <el-slider
+          style="max-width: 400px; flex: 1; margin-left: 10px"
+          v-model="percentage2"
+          :min="0"
+          :max="100"
+          :step="1"/>
+      <span style="margin-left: 20px ; width: 30px;">{{ percentage2 }}%</span>
+      <span style="float: right ; margin-left: 150px;">
+              鍔犵儹鏃堕棿(绉�)<vxe-input size="small" class="input" clearable v-model="heatingTime"></vxe-input>
+              闀胯酱闂撮殧 <vxe-input size="small" class="input" clearable v-model="spacingLong"></vxe-input>
+              鐐夐暱(mm) <vxe-input size="small" class="input" clearable v-model="furnaceLength"></vxe-input>
+      </span>
+    </div>
+  </div>
+</div>
 
     <vxe-grid
         size="small"

--
Gitblit v1.8.0