From 15f335a0553bbc56c23a1eea9548e53b8fdbcb87 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 11 三月 2024 11:29:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue                    |    1 
 north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue                      |  295 ++++++++++----
 north-glass-erp/target/classes/mapper/pp/FolwCard.xml                                           |   38 +
 north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml                               |  248 +++++++----
 north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java                     |    3 
 north-glass-erp/northglass-erp/src/views/pp/workOrder/WorkOrder.vue                             |    5 
 north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java                           |    2 
 north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java          |    9 
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml                                       |   38 +
 north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue                |   50 +-
 north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue                       |   11 
 north-glass-erp/src/main/java/com/example/erp/controller/pp/ProductionSchedulingController.java |   21 
 north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java       |   18 
 north-glass-erp/src/main/java/com/example/erp/mapper/pp/ProductionSchedulingMapper.java         |   12 
 north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml                           |  248 +++++++----
 north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue                   |   91 +++-
 north-glass-erp/src/main/java/com/example/erp/entity/pp/ProductionScheduling.java               |    2 
 north-glass-erp/src/main/java/com/example/erp/controller/pp/WorkOrderController.java            |    8 
 north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java                   |   51 +-
 19 files changed, 745 insertions(+), 406 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
index f2b006e..6602727 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
@@ -43,13 +43,14 @@
 }
 
 let flag = $ref(true)
-function intoCreateProduct(){
-  if(flag){
+
+function intoCreateProduct() {
+  if (flag) {
     router.push(`/main/processCard/SplittingDetails?orderId=${orderId}`)
-  }else {
+  } else {
     router.push('/main/processCard/SplittingDetails?orderId=${orderId}')
   }
-  flag=!flag
+  flag = !flag
 }
 
 //瀹氫箟鏃堕棿
@@ -91,6 +92,8 @@
 
 let orderId = route.query.orderId
 let productionId = route.query.productionId
+
+
 //绗竴娆″姞杞芥暟鎹�
 
 request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => {
@@ -116,7 +119,6 @@
 }
 
 
-
 /*鍚庣杩斿洖缁撴灉澶氬眰宓屽灞曠ず*/
 const hasDecimal = (value) => {
   const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
@@ -125,7 +127,7 @@
 
 
 //绛涢�夋柟娉�
-const filterChanged = ({ option, row, column }) => {
+const filterChanged = ({option, row, column}) => {
   if (option.data) {
     return row[column.field].toString().toLowerCase().indexOf(option.data) > -1
   }
@@ -153,7 +155,7 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    //remote: true
+                    //remote: true
   },
   customConfig: {
     storage: true
@@ -165,14 +167,43 @@
   },//琛ㄥご鍙傛暟
   columns: [
     {type: 'checkbox', fixed: "left", title: '閫夋嫨'},
-    {field: 'orderNumber', title: '璁㈠簭', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'shape', title: '褰㈢姸', showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'width', title: '瀹�', sortable: true, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged,width:'60px'},
-    {field: 'height', title: '楂�', sortable: true, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged,width:'60px'},
-    {field: 'baiscQuantity', title: '寰呭垎鏁伴噺', showOverflow: "ellipsis",width:'60px'},
-    {field: 'computeGrossArea', title: '寰呭垎闈㈢Н',width:'60px'},
-    {field: 'totalThickness', title: '鎬诲帤搴�',width:'80px'},
-    {field: 'thickness', title: '鐜荤拑鍘氬害',width:'60px'},
+    {
+      field: 'orderNumber',
+      title: '璁㈠簭',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'shape',
+      title: '褰㈢姸',
+      showOverflow: "ellipsis",
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'width',
+      title: '瀹�',
+      sortable: true,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged,
+      width: '60px'
+    },
+    {
+      field: 'height',
+      title: '楂�',
+      sortable: true,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged,
+      width: '60px'
+    },
+    {field: 'baiscQuantity', title: '寰呭垎鏁伴噺', showOverflow: "ellipsis", width: '60px'},
+    {field: 'computeGrossArea', title: '寰呭垎闈㈢Н', width: '60px'},
+    {field: 'totalThickness', title: '鎬诲帤搴�', width: '80px'},
+    {field: 'thickness', title: '鐜荤拑鍘氬害', width: '60px'},
     {field: 'weight', title: '閲嶉噺'}
   ],//琛ㄥご鎸夐挳
 
@@ -189,7 +220,7 @@
   data: [],//table body瀹為檯鏁版嵁
   //鑴氶儴姹傚拰
   footerMethod({columns, data}) {//椤佃剼鍑芥暟
-    let footList = ['baiscQuantity', 'computeGrossArea', 'totalThickness','thickness', 'weight']
+    let footList = ['', '', '', '', '']
     return [
       columns.map((column, columnIndex) => {
         if (columnIndex === 0) {
@@ -204,7 +235,6 @@
   }
 
 })
-
 
 //宸︿晶瀛愮粍浠舵帴鏀跺弬鏁�
 const xGridLeft = ref()
@@ -226,7 +256,7 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    //remote: true
+                    //remote: true
   },
   customConfig: {
     storage: true
@@ -238,17 +268,30 @@
   },//琛ㄥご鍙傛暟
   columns: [
     {type: 'checkbox', fixed: "left", title: '閫夋嫨'},
-    {field: 'processId', title: '娴佺▼鍗″彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 130,filterMethod:filterChanged},
+    {
+      field: 'processId',
+      title: '娴佺▼鍗″彿',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      width: 130,
+      filterMethod: filterChanged
+    },
     {
       field: 'orderNumber',
       title: '璁㈠簭',
       showOverflow: "ellipsis",
       filters: [{data: ''}],
       slots: {filter: 'num1_filter'}
-      ,filterMethod:filterChanged
+      , filterMethod: filterChanged
     },
-    {field: 'landingSequence', title: '灏忕墖椤哄簭', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'shape', title: '褰㈢姸', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
+    {
+      field: 'landingSequence',
+      title: '灏忕墖椤哄簭',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {field: 'shape', title: '褰㈢姸', filters: [{data: ''}], slots: {filter: 'num1_filter'}, filterMethod: filterChanged},
     {field: 'width', title: '瀹�', showOverflow: "ellipsis"},
     {field: 'height', title: '楂�'},
     {field: 'quantity', title: '鎬绘暟閲�'},
@@ -268,7 +311,7 @@
   data: [],//table body瀹為檯鏁版嵁
   //鑴氶儴姹傚拰
   footerMethod({columns, data}) {//椤佃剼鍑芥暟
-    let footList = ['鎬绘暟閲�', '鎬婚潰绉�', '鍒嗙鏁�']
+    let footList = ['']
     return [
       columns.map((column, columnIndex) => {
         if (columnIndex === 0) {
@@ -287,6 +330,7 @@
 const createProcessCard = () => {
   const $grid = xGrid.value
   const checkedList = $grid.getCheckboxRecords()
+
   if (checkedList.length === 0) {
     ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁")
     return
@@ -303,14 +347,17 @@
   checkedList.forEach((item) => {
     item.processId = processId
     item.landingSequence = index
-    item.quantity=item.baiscQuantity
+    item.quantity = item.baiscQuantity
   })
-  checkedList.forEach((item)=>{
+  checkedList.forEach((item) => {
     delete item._X_ROW_KEY
   })
-
   $gridLeft.insertAt(checkedList)
   $grid.remove(checkedList)
+  if ($gridLeft || $grid) {
+    $gridLeft.clearCheckboxRow()
+    $grid.clearCheckboxRow()
+  }
 }
 
 let checkedNum = ref('')
@@ -356,6 +403,9 @@
         } else {
           //鍙宠竟琛ㄦ牸娌℃湁姝ゆ潯鏁版嵁鍒欏線鍙宠竟琛ㄦ牸鎻掑叆鏁版嵁
           item.baiscQuantity = checkedNum.value
+          if (item.quantity === 0) {
+            $gridLeft.remove(item)
+          }
           $grid.insert(item)
         }
       })
@@ -374,8 +424,11 @@
 
         $gridLeft.remove(item)
       })
-    }
 
+
+    }
+    $gridLeft.clearCheckboxRow()
+    $grid.clearCheckboxRow()
   } catch (e) {
     ElMessage.warning(e.message)
   }
@@ -392,7 +445,7 @@
     //鑾峰彇宸﹁竟琛ㄦ牸checkbox閫変腑鐨勬暟鎹�
     const checkedListLeft = $gridLeft.getCheckboxRecords()
     //鍒ゆ柇鍙宠竟琛ㄦ牸鏄惁鏈夐�変腑鐨勬暟鎹�
-    if (checkedList.length === 0) {
+    if (checkedList.length * 1 === 0) {
       ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁")
       return
     }
@@ -409,41 +462,100 @@
     if (/^[1-9]\d*$/.test(checkedNum.value)) {
       checkedList.forEach((item) => {
         //鍒ゆ柇鍙敤鏁伴噺鏄惁澶т簬绛変簬杈撳叆鐨勬暟閲�,涓嶆弧瓒冲垯鎶涘嚭寮傚父
-        if (item.baiscQuantity < checkedNum.value) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧");
+        if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧");
         item.baiscQuantity = item.baiscQuantity - checkedNum.value
+        //瀹氫箟key鍊间繚鎸�
+        let key = item._X_ROW_KEY
         //宸﹁竟琛ㄦ牸鏁版嵁
         let leftData = $gridLeft.getTableData().fullData
         //宸﹁竟琛ㄦ牸鏁版嵁涓煡鎵惧綋鍓嶆暟鎹笅鏍�
         let filterIndex = leftData.findIndex(item1 => item1.orderNumber === item.orderNumber)
-        //濡傛灉鍙宠竟琛ㄦ牸鏁版嵁涓瓨鍦ㄥ綋鍓嶆暟鎹垯鏁伴噺鐩稿姞
-        if (filterIndex >= 0) {
-          leftData[filterIndex].quantity = leftData[filterIndex].quantity * 1 + checkedNum.value * 1
+        //鍒ゆ柇鍙充晶鍕鹃�夊�间笌宸︿晶鏄惁鐩稿悓
+        if (checkedListLeft[0].orderNumber === item.orderNumber) {
 
-          if (item.baiscQuantity === 0) {
-            $grid.remove(checkedList)
+          //濡傛灉鍙宠竟琛ㄦ牸鏁版嵁涓瓨鍦ㄥ綋鍓嶆暟鎹垯鏁伴噺鐩稿姞
+          if (filterIndex >= 0) {
+            leftData[filterIndex].quantity = leftData[filterIndex].quantity * 1 + checkedNum.value * 1
+
+            if (item.baiscQuantity === 0) {
+              $grid.remove(checkedList)
+            }
+            //delete item._X_ROW_KEY
+          } else {
+            item.quantity = checkedNum.value
+            item.processId = checkedListLeft[0].processId
+            item.landingSequence = checkedListLeft[0].landingSequence
+            delete item._X_ROW_KEY
+            $gridLeft.insert(item)
+            item._X_ROW_KEY = key
           }
         } else {
+
+          // if (){
+          //
+          // }
+          //濡傛灉鍕鹃�変袱涓�间笉鍚屽垯鎻掑叆鍚屾祦绋嬪崱
           item.quantity = checkedNum.value
           item.processId = checkedListLeft[0].processId
           item.landingSequence = checkedListLeft[0].landingSequence
-          delete item._X_ROW_KEY
-          $gridLeft.insert(item)
+          if (item.baiscQuantity === 0) {
+            $grid.remove(checkedList)
+
+          }
+          for (let i = 0; i < leftData.length; i++) {
+            if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId === item.processId) {
+              leftData[i].quantity = leftData[i].quantity * 1 + checkedNum.value * 1
+              break
+            } else if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId !== item.processId) {
+
+              delete item._X_ROW_KEY
+              $gridLeft.insert(item)
+              item._X_ROW_KEY = key
+              break
+            }
+            else if (leftData[i].orderNumber !== item.orderNumber && leftData[i].processId !== item.processId) {
+
+              delete item._X_ROW_KEY
+              $gridLeft.insert(item)
+              item._X_ROW_KEY = key
+              break
+            }
+          }
+          // leftData.forEach((items) => {
+          //   console.log(items.processId, item.processId,"鈥斺�斺�斺�斺�斺��",items.orderNumber, item.orderNumber)
+          //   if (items.orderNumber === item.orderNumber && items.processId===item.processId) {
+          //     console.log("娴嬭瘯333")
+          //
+          //   }
+          //   else{
+          //
+          //   }
+          //
+          // })
+
         }
 
       })
-    } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘湁鏃犺緭鍏ユ暟瀛�
+    } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘棤杈撳叆鏁板瓧
       checkedList.forEach((item) => {
         item.processId = checkedListLeft[0].processId
         item.landingSequence = checkedListLeft[0].landingSequence
+        item.quantity = checkedListLeft[0].baiscQuantity
         delete item._X_ROW_KEY
       })
       $gridLeft.insertAt(checkedList)
       $grid.remove(checkedList)
     }
+    if ($gridLeft || $grid) {
+      $gridLeft.clearCheckboxRow()
+      $grid.clearCheckboxRow()
+    }
+
   } catch (e) {
     ElMessage.warning(e.message)
   }
 }
+
 
 //淇濆瓨娴佺▼鍗℃暟鎹�
 const gridEvents = {
@@ -457,25 +569,28 @@
           if ($table) {
             const selectRecords = $table.getCheckboxRecords()
             const selectRight = $tableRight.getCheckboxRecords()
-            if (selectRecords.length === 0){
+            if (selectRecords.length === 0) {
               ElMessage.warning("璇峰厛閫夋嫨淇濆瓨鐨勬暟鎹�")
               return
             }
-            if (selectRight.length > 0){
+            if (selectRight.length > 0) {
               ElMessage.warning("璇峰厛灏嗗彸渚ф暟鎹叏閮ㄥ缓绔嬫祦绋嬪崱鍚庝繚瀛�")
               return;
             }
             let flowCardData = ref({
               flowCard: selectRecords,
-              userName:username,
-              productionId:productionId
+              userName: username,
+              productionId: productionId
             })
 
             request.post("/processCard/addFlowCard", flowCardData.value).then((res) => {
               if (res.code == 200) {
                 ElMessage.success("淇濆瓨鎴愬姛")
                 //router.push('/main/processCard/SplittingDetails?orderId=${orderId}')
-                  router.push({path: '/main/processCard/AddProcessCard', query: {orderId: orderId,productionId:productionId,random:Math.random()}})
+                router.push({
+                  path: '/main/processCard/AddProcessCard',
+                  query: {orderId: orderId, productionId: productionId, random: Math.random()}
+                })
 
                 //location.reload();
               } else {
@@ -502,26 +617,26 @@
       <div class="header" style="height: 5%;width: 100%">
 
         <el-button
-            style="float: left"
-            @click="intoCreateProduct"
             id="searchButton1"
-            type="primary"
             :icon="ArrowLeftBold"
-            round>
+            round
+            style="float: left"
+            type="primary"
+            @click="intoCreateProduct">
           {{ flag ? '杩斿洖' : '杩斿洖' }}
         </el-button>
         <!--      <el-button  type="primary">淇濆瓨鍒嗘灦</el-button>-->
-<!--              <el-button type="primary" :hidden="true">鍒嗘灦姹囨��</el-button>-->
+        <!--              <el-button type="primary" :hidden="true">鍒嗘灦姹囨��</el-button>-->
         <div style="width: 100px;">
 
         </div>
       </div>
       <el-container style="height: 100%;width: 100%">
-        <el-aside style="width: 44%;height: 100%" >
+        <el-aside style="width: 44%;height: 100%">
           <vxe-grid
-              max-height="100%"
-              class="mytable-scrollbar"
               ref="xGridLeft"
+              class="mytable-scrollbar"
+              max-height="100%"
               v-bind="gridLeftOptions"
               v-on="gridEvents"
           >
@@ -540,15 +655,15 @@
             </template>
             <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
             <template #button_slot="{ row }">
-              <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">鎵撳嵃</el-button>
-              <el-button @click="getTableRow(row,'setType')" link type="primary" size="small">鎺掔増</el-button>
-              <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>
+              <el-button link size="small" type="primary" @click="getTableRow(row,'edit')">鎵撳嵃</el-button>
+              <el-button link size="small" type="primary" @click="getTableRow(row,'setType')">鎺掔増</el-button>
+              <el-button link size="small" type="primary" @click="getTableRow(row,'delete')">鍒犻櫎</el-button>
             </template>
             <template #num1_filter="{ column, $panel }">
               <div>
                 <div v-for="(option, index) in column.filters" :key="index">
-                  <input type="text"
-                         v-model="option.data"
+                  <input v-model="option.data"
+                         type="text"
                          @input="changeFilterEvent($event, option, $panel)"/>
                 </div>
               </div>
@@ -560,55 +675,55 @@
         </el-aside>
 
         <div width="12%">
-          <el-main  style="">
-            <span>閫変腑鏁伴噺:<el-input type="number" v-model="checkedNum"></el-input></span><br>
+          <el-main style="">
+            <span>閫変腑鏁伴噺:<el-input v-model="checkedNum" clearable type="number"></el-input></span><br>
             <el-button type="primary" @click="addRight"> 鈫�</el-button>
             <br>
             <br>
             <el-button type="primary" @click="addLeft"> 鈫�</el-button>
             <br>
             <br>
-            <el-button @click="createProcessCard" type="primary">寤虹珛娴佺▼鍗�</el-button>
+            <el-button type="primary" @click="createProcessCard">寤虹珛娴佺▼鍗�</el-button>
           </el-main>
         </div>
 
 
-<!--        鍙充晶-->
+        <!--        鍙充晶-->
         <div style="height: 100%;width: 100%">
 
-        <el-aside style="width: 100%;height: 100%">
-          <vxe-grid
+          <el-aside style="width: 100%;height: 100%">
+            <vxe-grid
 
-              max-height="100%"
-              class="mytable-scrollbar"
-              ref="xGrid"
-              v-bind="gridOptions"
-          >
-            <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
-            <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
-            <template #content="{ row }">
-              <ul class="expand-wrapper">
-                <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
-                  <span style="font-weight: bold">{{ item.title + ':  ' }}</span>
-                  <span v-if="hasDecimal(item.field)">{{
-                      row[item.field.split('.')[0]][item.field.split('.')[1]]
-                    }}</span>
-                  <span v-else>{{ row[item.field] }}</span>
-                </li>
-              </ul>
-            </template>
+                ref="xGrid"
+                class="mytable-scrollbar"
+                max-height="100%"
+                v-bind="gridOptions"
+            >
+              <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+              <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
+              <template #content="{ row }">
+                <ul class="expand-wrapper">
+                  <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
+                    <span style="font-weight: bold">{{ item.title + ':  ' }}</span>
+                    <span v-if="hasDecimal(item.field)">{{
+                        row[item.field.split('.')[0]][item.field.split('.')[1]]
+                      }}</span>
+                    <span v-else>{{ row[item.field] }}</span>
+                  </li>
+                </ul>
+              </template>
 
-            <template #num1_filter="{ column, $panel }">
-              <div>
-                <div v-for="(option, index) in column.filters" :key="index">
-                  <input type="text"
-                         v-model="option.data"
-                         @input="changeFilterEvent($event, option, $panel)"/>
+              <template #num1_filter="{ column, $panel }">
+                <div>
+                  <div v-for="(option, index) in column.filters" :key="index">
+                    <input v-model="option.data"
+                           type="text"
+                           @input="changeFilterEvent($event, option, $panel)"/>
+                  </div>
                 </div>
-              </div>
-            </template>
-          </vxe-grid>
-        </el-aside>
+              </template>
+            </vxe-grid>
+          </el-aside>
         </div>
       </el-container>
     </div>
@@ -620,7 +735,7 @@
   height: 100%;
 }
 
-.header{
+.header {
   width: 100%;
   height: 35px;
   margin-top: -20px;
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
index bdc6117..eb198e6 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
@@ -12,6 +12,7 @@
 import BasicTable from '@/components/basic/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import useUserInfoStore from "@/stores/userInfo";
+import {changeFilterEvent,filterChanged} from "@/hook"
 
 let router = useRouter()
 const userStore = useUserInfoStore()
@@ -33,20 +34,7 @@
 
 //宸ュ簭
 const value = ref('')
-const options = [
-  {
-    value: '鍒囧壊',
-    label: '鍒囧壊',
-  },
-  {
-    value: '纾ㄨ竟',
-    label: '纾ㄨ竟',
-  },
-  {
-    value: '閽㈠寲',
-    label: '閽㈠寲',
-  },
-]
+
 
 //鎺掍骇鐘舵��
 const stateValue = ref('1')
@@ -69,6 +57,11 @@
 const form = reactive({
   date1: '',
   orderId: ''
+})
+
+//瀹氫箟鎺ユ敹鍔犺浇琛ㄥご涓嬫媺鏁版嵁
+const titleSelectJson = ref({
+  processType: [],
 })
 
 
@@ -137,8 +130,10 @@
   if (res.code == 200) {
     pageTotal.value = res.data.total
     produceList = produceList.value.concat(deepClone(res.data.data))
+    titleSelectJson.value.processType=res.data.process
     xGrid.value.reloadData(produceList)
     gridOptions.loading = false
+    console.log(res.data)
     //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
     gridOptions.toolbarConfig.buttons[0].disabled = true
     gridOptions.toolbarConfig.buttons[1].disabled = true
@@ -177,7 +172,8 @@
         ElMessage.warning(res.msg)
       }
     })
-  } else if (inputVal != null && selectState == 1) {
+  } else
+    if (inputVal != null && selectState == 1) {
 
     //鏍规嵁宸ュ簭鏌ヨ鏈帓浜ф暟鎹�
     request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => {
@@ -253,7 +249,7 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    remote: true
+    // remote: true
   },
   customConfig: {
     storage: true
@@ -280,13 +276,13 @@
       title: '璁″垝缁撴潫鏃堕棿'
     },
     // {field: '鎺掍骇缂栧彿', title: '鎺掍骇缂栧彿',  width: 120 },
-    {field: 'order_id', title: '閿�鍞崟鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 100},
-    {field: 'customer_name', title: '瀹㈡埛鍚嶇О', width: 110, filters: [{data: ''}], slots: {filter: 'num1_filter'}},
-    {field: 'project', title: '椤圭洰鍚嶇О', width: 100, filters: [{data: ''}], slots: {filter: 'num1_filter'}},
-    {field: 'order_number', title: '搴忓彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 70},
+    {field: 'order_id', title: '閿�鍞崟鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 100,filterMethod:filterChanged},
+    {field: 'customer_name', title: '瀹㈡埛鍚嶇О', width: 110, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
+    {field: 'project', title: '椤圭洰鍚嶇О', width: 100, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
+    {field: 'order_number', title: '搴忓彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 70,filterMethod:filterChanged},
 
-    {field: 'width', title: '瀹�', width: 60},
-    {field: 'height', title: '楂�', width: 60},
+    {field: 'width', title: '瀹�', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged},
+    {field: 'height', title: '楂�', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged},
     {field: 'quantity', title: '璁㈠崟鏁伴噺', width: 70},
     {field: 'area', title: '璁㈠崟闈㈢Н', width: 90},
     {
@@ -487,12 +483,12 @@
         &nbsp;&nbsp;
         <el-input v-model="form.orderId" placeholder="閿�鍞崟鍙�" clearable style="width: 110px"></el-input>
         &nbsp;
-        <el-select v-model="value" class="m-2" placeholder="宸ュ簭" clearable style="width: 90px;">
+        <el-select v-model="value" clearable placeholder="璇烽�夋嫨宸ュ簭" style="width: 120px">
           <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
+              v-for="item in titleSelectJson['processType']"
+              :key="item.id"
+              :label="item.basic_name"
+              :value="item.basic_name"
           />
         </el-select>
         &nbsp;
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue
index e480707..91df402 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue
@@ -14,32 +14,55 @@
 
 let productGlassTypeStore = useProductGlassTypeStore()
 let router = useRouter()
+let props = defineProps({
+  rowIndex:{}
+})
 const getTableRow = (row, type) => {
+  let startTime = form.date1[0]
+  let endTime = form.date1[1]
   switch (type) {
     case 'edit' : {
-      router.push({path: '/main/processCard/PrintFlowCard', query: {id: row.id}})
+      // console.log(row)
+      // router.push({path: '/main/processCard/PrintFlowCard', query: {id: row.id}})
       break
     }
     case 'setType': {
-      request.post(`/processCard/updateLayoutStatus/${row.processId}`).then((res) => {
-        if (res.code == 200) {
-          ElMessage.success("鎺掔増鎴愬姛")
-          location.reload();
-        } else {
+      let state=row.layoutStatus
 
-          ElMessage.warning(res.msg)
-        }
-      })
+      if (state=='鍙帓鐗�'){
+        request.post(`/processCard/updateLayoutStatus/${row.processId}/2`).then((res) => {
+          if (res.code == 200) {
+            ElMessage.success("鎺掔増鎴愬姛")
+            router.push({path: '/main/processCard/SelectProcessCard', query: {random:Math.random()}})
+          } else {
+
+            ElMessage.warning(res.msg)
+          }
+        })
+      }
+      else if(state=='涓嶅彲鎺掔増'){
+        request.post(`/processCard/updateLayoutStatus/${row.processId}/1`).then((res) => {
+          if (res.code == 200) {
+            ElMessage.success("淇敼鎴愬姛")
+            router.push({path: '/main/processCard/SelectProcessCard', query: {random:Math.random()}})
+          } else {
+
+            ElMessage.warning(res.msg)
+          }
+        })
+      }
+
       break
     }
     case 'delete': {
       request.post(`/processCard/deleteFlowCard/${row.orderId}/${row.processId}`).then((res) => {
         if (res.code == 200) {
           ElMessage.success("鍒犻櫎鎴愬姛")
-          location.reload();
+          router.push({path: '/main/processCard/SelectProcessCard', query: {random:Math.random()}})
         } else {
+
           ElMessage.warning(res.msg)
-          router.push("/login")
+
         }
       })
       break
@@ -98,7 +121,7 @@
 //瀹氫箟鏁版嵁杩斿洖缁撴灉
 let produceList = ref([])
 //瀹氫箟褰撳墠椤垫暟
-let pageNum = $ref(1)
+let pageNum=ref(1)
 let pageState = null
 
 //鑾峰彇涓冨ぉ鍓嶅埌褰撳墠鏃堕棿
@@ -140,6 +163,21 @@
   }
 })
 
+//椤佃剼缈婚〉鏌ヨ
+const selectPageList = ()=>{
+  let startTime = form.date1[0]
+  let endTime = form.date1[1]
+  request.post(`/processCard/flowCard/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}`,filterData.value).then((res) => {
+    if(res.code==200){
+
+      produceList = deepClone(res.data.data)
+      xGrid.value.reloadData(produceList)
+    }else{
+      ElMessage.warning(res.msg)
+    }
+  })
+}
+
 //鐐瑰嚮鏌ヨ
 const getWorkOrder = () => {
 
@@ -161,7 +199,7 @@
 const handlePageChange = ({ currentPage, pageSize }) => {
   pageNum.value=currentPage
   total.pageTotal    = pageSize
-  selectOrderList()
+  selectPageList()
 }
 
 /*浣跨敤绛涢�夛紝鍚庣鑾峰彇鏁版嵁*/
@@ -185,14 +223,15 @@
     filterData.value[column.property] = value
   }
 
-//鑾峰彇閫変腑鏃堕棿鍜屾槸鍚﹁浆鍗曠姸鎬�
+//鑾峰彇閫変腑鏃堕棿
   let startTime = form.date1[0]
   let endTime = form.date1[1]
 
-  request.post(`/processCard/flowCard/${startTime}/${endTime}`, filterData.value).then((res) => {
+  request.post(`/processCard/flowCard/1/${total.pageSize}/${startTime}/${endTime}`, filterData.value).then((res) => {
     if(res.code==200){
       pageTotal.value=res.data.total
-
+      total.pageTotal=parseInt(res.data.total)
+      pageNum.value=1
       produceList = deepClone(res.data.data)
       xGrid.value.loadData(produceList)
       gridOptions.loading=false
@@ -240,17 +279,18 @@
   },//琛ㄥご鍙傛暟
   columns:[
     {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
-    {title: '鎿嶄綔', width: 140, slots: { default: 'button_slot' },fixed:"left"},
+    {title: '鎿嶄綔', width: 160, slots: { default: 'button_slot' },fixed:"left"},
     { type: 'seq',fixed:"left", title: '鑷簭', width: 50 },
-    {field: 'orderId', title: '閿�鍞崟鍙�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, },
+    {field: 'orderId', title: '閿�鍞崟鍙�',filters:[{ data: '' }],slots: { filter: 'num1_filter' },width: 80 },
     {field: 'processId', width: 130, title: '娴佺▼鍗″彿' ,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'orderDetail.productId', title: '浜у搧缂栧彿' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'orderDetail.productName', title: '浜у搧鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, },
+    {field: 'orderDetail.productId', title: '浜у搧缂栧彿' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },},
+    {field: 'orderDetail.productName', title: '浜у搧鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 180},
     {field: 'order.project', title: '椤圭洰鍚嶇О' ,showOverflow:"ellipsis"},
-    {field: 'binningQuantity', title: '鏁伴噺', },
+    {field: 'quantity', title: '鏁伴噺', },
     {field: 'orderDetail.computeGrossArea', title: '闈㈢Н', },
     {field: 'founder', title: '鍒嗘灦鍛�', },
-    {field: 'orderDetail.processingNote', title: '鍔犲伐瑕佹眰', }
+    {field: 'orderDetail.processingNote', title: '鍔犲伐瑕佹眰', },
+    {field: 'layoutStatus', title: '鎺掔増鐘舵��', }
   ],//琛ㄥご鎸夐挳
 
   toolbarConfig: {
@@ -332,9 +372,12 @@
       </template>
 
       <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
-      <template #button_slot="{ row }">
+
+      <template #button_slot="{ row }" >
         <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">鎵撳嵃</el-button>
-        <el-button @click="getTableRow(row,'setType')" link type="primary" size="small">鎺掔増</el-button>
+        <el-button v-if="row.layoutStatus=='鍙帓鐗�'" @click="getTableRow(row,'setType')" link type="primary" size="small">鎺掔増</el-button>
+        <el-button v-else-if="row.layoutStatus=='涓嶅彲鎺掔増'" @click="getTableRow(row,'setType')" link type="primary" size="small">鍙帓鐗�</el-button>
+        <el-button v-else-if="row.layoutStatus=='宸叉帓鐗�'" disabled @click="getTableRow(row,'setType')" link type="primary" size="small">鎺掔増</el-button>
         <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>
       </template>
 
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue
index 212ba64..1e48c74 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue
@@ -71,6 +71,7 @@
 request.post(`/processCard/detailsSelect/${id}`, filterData.value).then((res) => {
 
   if (res.code == 200) {
+    console.log(res.data)
     pageTotal.value = res.data.total
     produceList = produceList.value.concat(deepClone(res.data.data))
     xGrid.value.reloadData(produceList)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue b/north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue
index 27e5b49..c80a393 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue
@@ -14,6 +14,8 @@
 
 let productGlassTypeStore = useProductGlassTypeStore()
 let router = useRouter()
+let isButtonDisabled=false
+
 const getTableRow = (row, type) => {
   switch (type) {
     case 'edit' : {
@@ -106,7 +108,7 @@
 
 //鑾峰彇涓冨ぉ鍓嶅埌褰撳墠鏃堕棿
 function getNowTime() {
-  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)
+  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 3)
       .toISOString()
       .replace('T', ' ')
       .slice(0, 10) //榛樿寮�濮嬫椂闂�7澶╁墠
@@ -139,14 +141,14 @@
 })
 
 //鐐瑰嚮鏌ヨ
-const getWorkOrder = () => {
+const getWorkOrder = (isButtonDisabled) => {
 
   let startTime = form.date1[0]
   let endTime = form.date1[1]
   let selectState = optionVal.value
   request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${selectState}`, filterData.value).then((res) => {
     if (res.code == 200) {
-
+      //isButtonDisabled=false
       pageTotal.value = res.data.total
       xGrid.value.loadData(res.data.data)
       gridOptions.loading = false
@@ -314,7 +316,8 @@
         </el-select>
         &nbsp;&nbsp;
         <el-button
-            @click="getWorkOrder"
+            @click="getWorkOrder(isButtonDisabled)"
+            :disabled="isButtonDisabled"
             id="select"
             type="primary" :icon="Search">鏌ヨ
         </el-button>
diff --git a/north-glass-erp/northglass-erp/src/views/pp/workOrder/WorkOrder.vue b/north-glass-erp/northglass-erp/src/views/pp/workOrder/WorkOrder.vue
index 4f80061..0a082a3 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/workOrder/WorkOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/workOrder/WorkOrder.vue
@@ -4,9 +4,10 @@
 import request from "@/utils/request";
 import deepClone from "@/utils/deepClone";
 import {ElMessage} from "element-plus";
-import {useRouter} from "vue-router";
+import {useRoute, useRouter} from "vue-router";
 import  GlassType from '@/components/basic/product/GlassType.vue'
 const router = useRouter()
+const route = useRoute()
 let indexFlag=$ref(1)
 function changeRouter(index){
   indexFlag=index
@@ -22,7 +23,7 @@
       </el-breadcrumb>
     </div>
     <div id="main-body">
-      <router-view  />
+      <router-view  :key="route.fullPath" />
     </div>
   </div>
 </template>
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java
index cd4b6dd..3247c6f 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java
@@ -69,18 +69,19 @@
         if(flowCardService.deleteFlowCardSv(orderId,processId)){
             return Result.seccess();
         }else {
-            throw new ServiceException(Constants.Code_500,"鍒犻櫎澶辫触");
+            throw new ServiceException(Constants.Code_500,"鍒犻櫎澶辫触,璇锋鏌ユ槸鍚﹀凡鎶ュ伐");
 
         }
     }
 
     //淇敼鎺掔増鐘舵��
     @ApiOperation("淇敼鎺掔増鐘舵�佹帴鍙�")
-    @PostMapping("/updateLayoutStatus/{processId}")
+    @PostMapping("/updateLayoutStatus/{processId}/{state}")
     public Result updateLayoutStatus(
-            @PathVariable String processId
+            @PathVariable String processId,
+            @PathVariable Integer state
     ){
-        if(flowCardService.updateLayoutStatusSv(processId)){
+        if(flowCardService.updateLayoutStatusSv(processId,state)){
             return Result.seccess();
         }else {
             throw new ServiceException(Constants.Code_500,"淇敼澶辫触");
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProductionSchedulingController.java b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProductionSchedulingController.java
index 787be26..2e8bd1d 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProductionSchedulingController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ProductionSchedulingController.java
@@ -5,6 +5,8 @@
 import com.example.erp.entity.pp.ProductionScheduling;
 import com.example.erp.exception.ServiceException;
 import com.example.erp.service.pp.ProductionSchedulingService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -12,12 +14,14 @@
 import java.util.Map;
 
 @RestController
+@Api(value="鎺掍骇controller",tags={"鎺掍骇鐩稿叧鎿嶄綔鎺ュ彛"})
 @RequestMapping("/productionScheduling")
 public class ProductionSchedulingController {
     @Autowired
     ProductionSchedulingService productionSchedulingService;
 
     //鏌ヨ绗竴娆℃帓鐗堟暟鎹�
+    @ApiOperation("鍔犺浇鏃舵煡璇㈡帓鐗堟暟鎹帴鍙�")
     @PostMapping  ("/selectLastScheduling/{selectTime1}/{selectTime2}")
     public Result selectLastScheduling(
             @PathVariable String selectTime1,
@@ -27,19 +31,21 @@
 
     }
     //鐐瑰嚮鏌ヨ鎺掔増鏁版嵁
+    @ApiOperation("鐐瑰嚮鏌ヨ鎺掔増鏁版嵁鎺ュ彛")
     @PostMapping  ("/selectScheduling/{selectTime1}/{selectTime2}/{orderId}/{processes}/{state}")
-    public Result SelectScheduling(
+    public Result selectScheduling(
             @PathVariable String selectTime1,
             @PathVariable String selectTime2,
             @PathVariable String orderId,
             @PathVariable String processes,
             @PathVariable Integer state,
             @RequestBody ProductionScheduling productionScheduling){
-        return Result.seccess(productionSchedulingService.SelectSchedulingSv(selectTime1,selectTime2,orderId,processes,state,productionScheduling));
+        return Result.seccess(productionSchedulingService.selectSchedulingSv(selectTime1,selectTime2,orderId,processes,state,productionScheduling));
 
     }
 
     //鐐瑰嚮鏌ヨ鎺掔増鏁版嵁锛堝甫璁㈠崟鍙锋煡璇級
+    @ApiOperation("鏍规嵁鏉′欢鏌ヨ鎺掔増鏁版嵁鎺ュ彛")
     @PostMapping  ("/selectSchedulingNot/{selectTime1}/{selectTime2}/{orderId}/{processes}/{state}")
     public Result selectSchedulingNot(
             @PathVariable String selectTime1,
@@ -53,10 +59,11 @@
     }
 
     //娣诲姞鎺掍骇鏁版嵁
+    @ApiOperation("娣诲姞鎺掍骇鏁版嵁鎺ュ彛")
     @PostMapping("/addScheduling")
-    public Result AddScheduling( @RequestBody Map<String,Object>  object){
+    public Result addScheduling( @RequestBody Map<String,Object>  object){
 
-        if(productionSchedulingService.AddSchedulingSv(object)){
+        if(productionSchedulingService.addSchedulingSv(object)){
             return Result.seccess();
         }else {
             throw new ServiceException(Constants.Code_500,"淇濆瓨澶辫触");
@@ -65,6 +72,7 @@
     }
 
     //鍒犻櫎鎺掍骇鏁版嵁
+    @ApiOperation("鍒犻櫎鎺掍骇鏁版嵁鎺ュ彛")
     @PostMapping("/deleteScheduling")
     public Result deleteScheduling( @RequestBody Map<String,Object>  object) throws Exception{
 
@@ -76,10 +84,11 @@
         }
     }
 
+    @ApiOperation("鎺掔増瀹℃牳鎺ュ彛")
     @PostMapping("/examineScheduling")
-    public Result ExamineScheduling( @RequestBody Map<String,Object>  object){
+    public Result examineScheduling( @RequestBody Map<String,Object>  object){
 
-        if(productionSchedulingService.ExamineSchedulingSv(object)){
+        if(productionSchedulingService.examineSchedulingSv(object)){
             return Result.seccess();
         }else {
             throw new ServiceException(Constants.Code_500,"瀹℃牳澶辫触");
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/pp/WorkOrderController.java b/north-glass-erp/src/main/java/com/example/erp/controller/pp/WorkOrderController.java
index f3c2a1b..ccef244 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/pp/WorkOrderController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/pp/WorkOrderController.java
@@ -6,6 +6,8 @@
 import com.example.erp.entity.sd.OrderDetail;
 import com.example.erp.exception.ServiceException;
 import com.example.erp.service.pp.WorkOrderService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -13,12 +15,14 @@
 import java.util.Map;
 
 @RestController
+@Api(value="宸ュ崟绠$悊controller",tags={"宸ュ崟绠$悊鎿嶄綔鎺ュ彛"})
 @RequestMapping("/workOrder")
 public class WorkOrderController {
     @Autowired
     WorkOrderService workOrderService;
 
     //鏌ヨ宸ュ崟
+    @ApiOperation("鏌ヨ宸ュ崟鎺ュ彛")
     @PostMapping  ("/orderGlassDetail/{selectTime1}/{selectTime2}/{state}")
     public Result dateWork(
             @PathVariable Date selectTime1,
@@ -29,8 +33,8 @@
     }
 
     //杞敓浜ц鍗曟煡璇�
+    @ApiOperation("杞敓浜ц鍗曟煡璇㈡帴鍙�")
     @PostMapping  ("/addWork/{orderId}")
-
     public Result addWork(
             @PathVariable String orderId,
             @RequestBody OrderDetail orderDetail){
@@ -40,6 +44,7 @@
 
 
     //娣诲姞宸ュ崟
+    @ApiOperation("娣诲姞宸ュ崟鎺ュ彛")
     @PostMapping("/addOrderWork")
     public Result addOrderWork( @RequestBody Map<String,Object>  object){
 
@@ -52,6 +57,7 @@
     }
 
     //鍒犻櫎宸ュ崟
+    @ApiOperation("鍒犻櫎宸ュ崟鎺ュ彛")
     @PostMapping("/deleteOrderWork/{orderId}/{productName}")
     public Result deleteOrderWork(
             @PathVariable String orderId,
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java b/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
index ae44e31..fdcfa82 100644
--- a/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
@@ -31,7 +31,7 @@
     //宸蹭紭鍖栨暟閲�
     private Integer optimizeQuantity;
     //鎺掔増鐘舵��
-    private Integer layoutStatus;
+    private String layoutStatus;
     //琛ョ墖鏁伴噺
     private Integer numberPatches;
     //搴撳瓨鏁伴噺
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/pp/ProductionScheduling.java b/north-glass-erp/src/main/java/com/example/erp/entity/pp/ProductionScheduling.java
index d9485b2..f5f9809 100644
--- a/north-glass-erp/src/main/java/com/example/erp/entity/pp/ProductionScheduling.java
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/pp/ProductionScheduling.java
@@ -16,6 +16,8 @@
     private String orderId;
     //璁㈠崟搴忓彿
     private String orderNumber;
+    //灏忕墖椤哄簭
+    private String technologyNumber;
     //鎺掍骇宸ュ簭
     private String processes;
     //鎺掍骇鏁伴噺
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
index e6fe65c..8f10826 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -31,7 +31,7 @@
     List<Map<String, String>> selectNoCardMp(String orderId, String productionId, FlowCard flowCard);
 
     //淇敼鎺掔増鐘舵��
-    Boolean updateLayoutStatusMp(String processId);
+    Boolean updateLayoutStatusMp(String processId,Integer state);
 
     Integer selectLayoutStatus(String processId);
 
@@ -59,4 +59,5 @@
     Integer selectLayer(String productionId, Integer orderNumber);
 
 
+    Integer selectFlowCardCount(String orderId);
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ProductionSchedulingMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ProductionSchedulingMapper.java
index 7d79bbf..343aa44 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ProductionSchedulingMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ProductionSchedulingMapper.java
@@ -1,7 +1,9 @@
 package com.example.erp.mapper.pp;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.erp.entity.pp.BasicDataProduce;
 import com.example.erp.entity.pp.ProductionScheduling;
+import com.example.erp.entity.sd.BasicData;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.sql.Date;
@@ -13,9 +15,9 @@
 public interface ProductionSchedulingMapper extends BaseMapper<ProductionScheduling> {
 
 
-    List<Map<String,String>> SelectOkSchedulingMp(String selectTime1, String selectTime2,String orderId,String processes, ProductionScheduling productionScheduling);
+    List<Map<String,String>> selectOkSchedulingMp(String selectTime1, String selectTime2,String orderId,String processes, ProductionScheduling productionScheduling);
 
-    List<Map<String,String>> SelectNoSchedulingMp(String selectTime1, String selectTime2,String orderId,String processes, ProductionScheduling  productionScheduling);
+    List<Map<String,String>> selectNoSchedulingMp(String selectTime1, String selectTime2,String orderId,String processes, ProductionScheduling  productionScheduling);
 
     List<Map<String,String>> selectLastSchedulingMp(String selectTime1, String selectTime2, ProductionScheduling productionScheduling);
 
@@ -25,7 +27,11 @@
 
     Boolean insertSelective(String schedulingId, String orderId, String orderNumber, String processes, Integer schedulingQuantity, LocalDate scheduledStartTime, LocalDate planEndTime, String notes);
 
-    Boolean ExamineSchedulingMp(String schedulingId, String userName);
+    Boolean examineSchedulingMp(String schedulingId, String userName);
 
     Boolean deleteSchedulingMp(String schedulingId);
+
+    List<Map<String,String>> selectProcess();
+
+    Integer selectNumberMp(String orderId, String orderNumber, String processes);
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
index 4329b82..0634f98 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -40,11 +40,11 @@
     }
 
     //娴佺▼鍗$鐞嗘煡璇�
-    public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize,Date selectTime1, Date selectTime2, FlowCard flowCard) {
-        Integer offset = (pageNum-1)*pageSize;
+    public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, FlowCard flowCard) {
+        Integer offset = (pageNum - 1) * pageSize;
         Map<String, Object> map = new HashMap<>();
-        map.put("data", flowCardMapper.selectFlowCard(offset, pageSize,selectTime1, selectTime2, flowCard));
-        map.put("total",flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
+        map.put("data", flowCardMapper.selectFlowCard(offset, pageSize, selectTime1, selectTime2, flowCard));
+        map.put("total", flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
         return map;
     }
 
@@ -65,14 +65,23 @@
     //鍒犻櫎娴佺▼鍗�
     public Boolean deleteFlowCardSv(String orderId, String processId) {
         if (!orderId.isEmpty() && !processId.isEmpty()) {
+            //鍒ゆ柇璇ユ祦绋嬪崱鏄惁鎶ュ伐
             Integer count = flowCardMapper.reportingWorkCount(processId);
             if (count == 0) {
-                //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
-                flowCardMapper.updateProcessingCard(orderId, 1);
+
                 //淇敼鍒嗘灦鐘舵��
                 flowCardMapper.updateDeleteState(orderId, processId);
                 //鍒犻櫎鍒嗘灦鏄庣粏
                 flowCardMapper.deleteFlowCardMp(orderId, processId);
+                //鍒ゆ柇璇ヨ鍗曟祦绋嬪崱鏄惁鍏ㄩ儴鍒犻櫎
+                Integer flowNumber = flowCardMapper.selectFlowCardCount(orderId);
+                if (flowNumber == 0) {
+                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负0,鍏ㄩ儴鍒犻櫎
+                    flowCardMapper.updateProcessingCard(orderId, 0);
+                } else {
+                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鍒犻櫎閮ㄥ垎
+                    flowCardMapper.updateProcessingCard(orderId, 1);
+                }
                 return true;
             } else {
                 return false;
@@ -92,15 +101,13 @@
 
 
     //淇敼鎺掔増鐘舵��
-    public Boolean updateLayoutStatusSv(String processId) {
+    public Boolean updateLayoutStatusSv(String processId, Integer state) {
 
         if (!processId.isEmpty()) {
-            Integer Status = flowCardMapper.selectLayoutStatus(processId);
-            if (Status == 1) {
-                flowCardMapper.updateLayoutStatusMp(processId);
-            } else {
-                return false;
-            }
+//            Integer Status = flowCardMapper.selectLayoutStatus(processId);
+
+            flowCardMapper.updateLayoutStatusMp(processId, state);
+
 
             return true;
         } else {
@@ -126,7 +133,7 @@
                 //鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
                 Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
                 //娣诲姞娴佺▼鍗℃暟鎹�
-                flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName,layer);
+                flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
                 //淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
                 flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
                 //鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
@@ -142,12 +149,12 @@
                 List<OrderGlassDetail> orderGlassDetailList =
                         orderGlassDetailMapper.selectList(
                                 new QueryWrapper<OrderGlassDetail>()
-                                .eq("order_id", flowCard.getProcessId().substring(0,10))
-                                .eq("order_number", flowCard.getOrderNumber())
+                                        .eq("order_id", flowCard.getProcessId().substring(0, 10))
+                                        .eq("order_number", flowCard.getOrderNumber())
                         );
                 List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetailList);
                 orderProcessDetailList.forEach(
-                        orderGlassDetail ->orderGlassDetail.setProcessId(flowCard.getProcessId()));
+                        orderGlassDetail -> orderGlassDetail.setProcessId(flowCard.getProcessId()));
 
 
                 //璧嬪�艰鍗曞伐鑹鸿〃
@@ -160,13 +167,13 @@
         }
     }
 
-    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, FlowCard flowCard) {
+    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, FlowCard flowCard) {
         Map<String, Object> map = new HashMap<>();
-        if (state==2){//宸叉帓浜�
-            map.put("data", flowCardMapper.selectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, flowCard));
+        if (state == 2) {//宸叉帓浜�
+            map.put("data", flowCardMapper.selectOkSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
 
-        }else if (state==1){//鏈帓浜�
-            map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, flowCard));
+        } else if (state == 1) {//鏈帓浜�
+            map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
 
         }
 
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
index c055460..28f7922 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
@@ -23,8 +23,8 @@
     @Autowired
     ProductionSchedulingMapper productionSchedulingMapper;
 
-    //甯︽椂闂存煡璇�
-    public Map<String, Object> SelectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
+    //鏈帓浜ф煡璇�
+    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
         Map<String, Object> map = new HashMap<>();
         if(orderId.equals("null")){
             orderId="";
@@ -35,10 +35,10 @@
         }
 
         if (state==2){//宸叉帓浜�
-            map.put("data", productionSchedulingMapper.SelectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
+            map.put("data", productionSchedulingMapper.selectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
 
         }else if (state==1){//鏈帓浜�
-            map.put("data", productionSchedulingMapper.SelectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
+            map.put("data", productionSchedulingMapper.selectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
 
         }
 
@@ -50,6 +50,7 @@
     public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,ProductionScheduling productionScheduling ) {
         Map<String, Object> map = new HashMap<>();
         map.put("data", productionSchedulingMapper.selectLastSchedulingMp(selectTime1, selectTime2, productionScheduling));
+        map.put("process", productionSchedulingMapper.selectProcess());
         return map;
     }
 
@@ -60,7 +61,7 @@
         return map;
     }
 
-    public Boolean AddSchedulingSv(Map<String, Object> object) {
+    public Boolean addSchedulingSv(Map<String, Object> object) {
         String userName = "";
         if (object.get("userName") != null) {
             userName = object.get("userName").toString();
@@ -82,6 +83,9 @@
         List<ProductionScheduling> schedulinglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("scheduling")), ProductionScheduling.class);
         if (!schedulinglist.isEmpty()) {
             for (ProductionScheduling productionScheduling : schedulinglist) {
+                //鏌ヨ宸叉帓浜у伐搴忔暟閲�
+              Integer num =  productionSchedulingMapper.selectNumberMp(productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes);
+
                productionSchedulingMapper.insertSelective(schedulingId,productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
                // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
             }
@@ -109,7 +113,7 @@
         }
     }
 
-    public boolean ExamineSchedulingSv(Map<String, Object> object) {
+    public boolean examineSchedulingSv(Map<String, Object> object) {
         String userName = "";
         if (object.get("userName") != null) {
             userName = object.get("userName").toString();
@@ -118,7 +122,7 @@
 
         if (!schedulinglist.isEmpty()) {
             for (ProductionScheduling productionScheduling : schedulinglist) {
-                productionSchedulingMapper.ExamineSchedulingMp(productionScheduling.getSchedulingId(),userName);
+                productionSchedulingMapper.examineSchedulingMp(productionScheduling.getSchedulingId(),userName);
                 // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
             }
             return true;
diff --git a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
index b840f47..5e28ebb 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -9,6 +9,7 @@
         <result column="quantity" property="quantity"/>
         <result column="founder" property="founder"/>
         <result column="create_time" property="createTime"/>
+        <result column="layout_status" property="layoutStatus"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result column="project" property="project"/>
@@ -56,18 +57,19 @@
         c.product_id,
         c.product_name,
         b.project,
-        a.quantity,
-        c.compute_gross_area,
+        sum(a.quantity) as quantity,
+        sum(c.compute_gross_area) as compute_gross_area,
         a.founder,
-        c.processing_note
+        c.processing_note,
+        if(a.layout_status=0,"涓嶅彲鎺掔増",if(a.layout_status=1,"鍙帓鐗�","宸叉帓鐗�")) as layout_status
         from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
         left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
         where a.create_time between #{selectTime1} and #{selectTime2}
                     <if test="flowCard.orderId != null and flowCard.orderId != ''">
                         and a.order_id regexp #{flowCard.orderId}
                     </if>
-                    <if test="flowCard.productionId != null and flowCard.productionId != ''">
-                        and a.process_Id regexp #{flowCard.productionId}
+                    <if test="flowCard.processId != null and flowCard.processId != ''">
+                        and a.process_Id regexp #{flowCard.processId}
                     </if>
                     <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
                         and c.product_id regexp #{flowCard.orderDetail.productId}
@@ -111,7 +113,7 @@
             and b.project regexp #{flowCard.order.project}
         </if>
 
-
+        ORDER BY a.id desc
         limit #{offset},#{pageSize};
     </select>
 
@@ -158,6 +160,7 @@
             and o.salesman regexp #{flowCard.order.salesman}
         </if>
         group by o.order_id
+        order by o.id desc
 
         ;
     </select>
@@ -171,11 +174,13 @@
         SUM( od.quantity) as quantity,
         SUM(od.compute_gross_area) as compute_gross_area,
         od.perimeter
-        from  sd.order_detail as od left join sd.order_glass_detail as ogd
-        on od.order_id=ogd.order_id and od.order_number=ogd.order_number
+        from  sd.order_detail as od left join
+        (select order_id,order_number,production_id,splitting_status from sd.order_glass_detail
+        GROUP BY order_id,order_number
+        ) as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         where od.order_id = #{orderId} and ogd.splitting_status=0
-        <if test="flowCard.orderDetail.orderId != null and flowCard.orderDetail.orderId != ''">
-            and od.order_id regexp #{flowCard.orderDetail.orderId}
+        <if test="flowCard.orderId != null and flowCard.orderId != ''">
+            and od.order_id regexp #{flowCard.orderId}
         </if>
         <if test="flowCard.orderGlassDetail.productionId != null and flowCard.orderGlassDetail.productionId != ''">
             and ogd.production_id regexp #{flowCard.orderGlassDetail.productionId}
@@ -187,6 +192,7 @@
             and od.product_name regexp #{flowCard.orderDetail.productName}
         </if>
         group by od.order_id, ogd.production_id
+        order by od.id desc
     </select>
 
     <!--    鏇存柊鍒嗘灦鐘舵��-->
@@ -228,15 +234,15 @@
         left join sd.order_glass_detail as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         left join sd.product as p on od.product_name=p.product_name
         where od.order_id=#{orderId} and ogd.production_id=#{productionId} and ogd.splitting_status=0
-        GROUP BY od.order_number;
-
+        GROUP BY od.order_number
+        order by od.id desc
 
     </select>
 
     <!--淇敼鎺掔増鐘舵��-->
     <update id="updateLayoutStatusMp">
         update flow_card as fc
-        set fc.layout_status=2
+        set fc.layout_status=#{state}
         where fc.process_id = #{processId}
     </update>
 
@@ -322,7 +328,7 @@
         from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
                                    left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
         where od.order_id=#{orderId} and ps.processes=#{processes} and ps.scheduling_id IS NOT NULL
-
+        order by ps.id desc
     </select>
 <!--    鏌ヨ鏈帓鐗堟暟鎹�-->
     <select id="selectNoSchedulingMp">
@@ -349,4 +355,8 @@
         where ogd.production_id = #{productionId}
           and ogd.order_number=#{orderNumber}
     </select>
+<!--  鏌ヨ璇ヨ鍗曟祦绋嬪崱鏉℃暟  -->
+    <select id="selectFlowCardCount">
+        select COUNT(*) from flow_card where order_id=#{orderId}
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
index 50467cc..e099760 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
@@ -42,123 +42,185 @@
     </resultMap>
 
 
-<!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
-    <select id="SelectOkSchedulingMp">
-        select date(ps.scheduled_start_time) as scheduled_start_time,
-               date(ps.plan_end_time) as plan_end_time,
-               od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        ps.scheduling_quantity,
-#         (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-#         round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
-        ps.reviewer,
-        od.product_name,od.shape,ps.scheduling_id
+    <!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
+    <select id="selectOkSchedulingMp">
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")           as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
         from sd.order_detail as od
-            left join sd.order as o on od.order_id=o.order_id
-            left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where  ps.scheduling_id IS NOT NULL
-           and od.create_time between #{selectTime1} and #{selectTime2}
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where ps.scheduling_id IS NOT NULL
+          and od.create_time between #{selectTime1} and #{selectTime2}
           and position(#{processes} in ps.processes)
           and position(#{orderId} in ps.order_id)
-
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
 
-    <!--    鏌ヨ宸叉帓浜у甫璁㈠崟缂栧彿鐨勬暟鎹�-->
+    <!--    鏌ヨ宸叉帓浜х殑鏁版嵁-->
     <select id="selectSchedulingNotMp">
-        select date(ps.scheduled_start_time) as scheduled_start_time,
-        date(ps.plan_end_time) as plan_end_time,
-        od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        ps.scheduling_quantity,
-#         (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-#         round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
-        ps.reviewer,
-        od.product_name,od.shape,ps.scheduling_id
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000, 2)
+                                                                      as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")
+                                                                      as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
         from sd.order_detail as od
-        left join sd.order as o on od.order_id=o.order_id
-        left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where  (ps.scheduling_id IS NOT NULL )
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (ps.scheduling_id IS NOT NULL)
           and position(#{processes} in ps.processes)
           and position(#{orderId} in ps.order_id)
-
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
-<!--    鏌ヨ鏈帓浜ф暟鎹�-->
-    <select id="SelectNoSchedulingMp" >
-        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-        round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        od.product_name,od.shape
-        from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
-        left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where   od.quantity-IFNULL(ps.scheduling_quantity,0)>0 and od.create_time between #{selectTime1} and #{selectTime2}
+    <!--    鏌ヨ鏈帓浜ф暟鎹�-->
+    <select id="selectNoSchedulingMp">
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+          and od.create_time between #{selectTime1} and #{selectTime2}
 
           and position(#{orderId} in ps.order_id)
-    group by od.order_id,od.order_number
+          and position(#{processes} in ps.processes)
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
-<!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
+    <!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
     <select id="selectLastSchedulingMp">
-        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-               round(od.width*od.height*od.quantity/1000000,2) as area,
-               (od.quantity-IFNULL(sum(ps.scheduling_quantity),0)) as pendingProductionQuantity,
-               round(od.width*od.height*(od.quantity-IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as pendingProductionArea,
-               IFNULL(sum(ps.scheduling_quantity),0) as productionScheduledQuantity,
-               round(od.width*od.height*(IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as productionScheduledArea,
-               od.product_name,od.shape
-        from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
-                                   left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where od.create_time between #{selectTime1} and #{selectTime2} and od.quantity-IFNULL(ps.scheduling_quantity,0)>0
-        group by od.order_id,od.order_number
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(sum(ps.scheduling_quantity), 0)                 as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where od.create_time between #{selectTime1} and #{selectTime2}
+          and (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
 
     <select id="selectMaxId">
-        select
-            COUNT(ps.scheduling_id)
-        from
-            `production_scheduling` as ps
-        where
-            date(ps.create_time) = curdate()
+        select COUNT(ps.scheduling_id)
+        from `production_scheduling` as ps
+        where date(ps.create_time) = curdate()
     </select>
 
     <insert id="insertSelective">
-        insert into production_scheduling(
-               scheduling_id,
-               order_id,
-               order_number,
-               processes,
-               scheduling_quantity,
-               scheduled_start_time,
-               plan_end_time,
-               notes,
-               create_time
-               )
-        VALUES(
-               #{schedulingId},
-               #{orderId},
-               #{orderNumber},
-               #{processes},
-               #{schedulingQuantity},
-               #{scheduledStartTime},
-               #{planEndTime},
-               #{notes},
-               now()
-              )
+        insert into production_scheduling(scheduling_id,
+                                          order_id,
+                                          order_number,
+                                          processes,
+                                          scheduling_quantity,
+                                          scheduled_start_time,
+                                          plan_end_time,
+                                          notes,
+                                          create_time)
+        VALUES (#{schedulingId},
+                #{orderId},
+                #{orderNumber},
+                #{processes},
+                #{schedulingQuantity},
+                #{scheduledStartTime},
+                #{planEndTime},
+                #{notes},
+                now())
     </insert>
 
-    <update id="ExamineSchedulingMp">
-        update production_scheduling set review_status=1,reviewer=#{userName} where
-        scheduling_id=#{schedulingId}
+    <update id="examineSchedulingMp">
+        update production_scheduling
+        set review_status=1,
+            reviewer=#{userName}
+        where scheduling_id = #{schedulingId}
     </update>
 
     <delete id="deleteSchedulingMp">
-        delete from production_scheduling where scheduling_id=#{schedulingId}
+        delete
+        from production_scheduling
+        where scheduling_id = #{schedulingId}
     </delete>
+
+    <select id="selectProcess">
+        SELECT *
+        FROM sd.basic_data as bd
+        where bd.basic_category = 'process'
+          and bd.basic_type = 'product'
+    </select>
+
+    <select id="selectNumberMp">
+
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/target/classes/mapper/pp/FolwCard.xml b/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
index b840f47..5e28ebb 100644
--- a/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
@@ -9,6 +9,7 @@
         <result column="quantity" property="quantity"/>
         <result column="founder" property="founder"/>
         <result column="create_time" property="createTime"/>
+        <result column="layout_status" property="layoutStatus"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result column="project" property="project"/>
@@ -56,18 +57,19 @@
         c.product_id,
         c.product_name,
         b.project,
-        a.quantity,
-        c.compute_gross_area,
+        sum(a.quantity) as quantity,
+        sum(c.compute_gross_area) as compute_gross_area,
         a.founder,
-        c.processing_note
+        c.processing_note,
+        if(a.layout_status=0,"涓嶅彲鎺掔増",if(a.layout_status=1,"鍙帓鐗�","宸叉帓鐗�")) as layout_status
         from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
         left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
         where a.create_time between #{selectTime1} and #{selectTime2}
                     <if test="flowCard.orderId != null and flowCard.orderId != ''">
                         and a.order_id regexp #{flowCard.orderId}
                     </if>
-                    <if test="flowCard.productionId != null and flowCard.productionId != ''">
-                        and a.process_Id regexp #{flowCard.productionId}
+                    <if test="flowCard.processId != null and flowCard.processId != ''">
+                        and a.process_Id regexp #{flowCard.processId}
                     </if>
                     <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
                         and c.product_id regexp #{flowCard.orderDetail.productId}
@@ -111,7 +113,7 @@
             and b.project regexp #{flowCard.order.project}
         </if>
 
-
+        ORDER BY a.id desc
         limit #{offset},#{pageSize};
     </select>
 
@@ -158,6 +160,7 @@
             and o.salesman regexp #{flowCard.order.salesman}
         </if>
         group by o.order_id
+        order by o.id desc
 
         ;
     </select>
@@ -171,11 +174,13 @@
         SUM( od.quantity) as quantity,
         SUM(od.compute_gross_area) as compute_gross_area,
         od.perimeter
-        from  sd.order_detail as od left join sd.order_glass_detail as ogd
-        on od.order_id=ogd.order_id and od.order_number=ogd.order_number
+        from  sd.order_detail as od left join
+        (select order_id,order_number,production_id,splitting_status from sd.order_glass_detail
+        GROUP BY order_id,order_number
+        ) as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         where od.order_id = #{orderId} and ogd.splitting_status=0
-        <if test="flowCard.orderDetail.orderId != null and flowCard.orderDetail.orderId != ''">
-            and od.order_id regexp #{flowCard.orderDetail.orderId}
+        <if test="flowCard.orderId != null and flowCard.orderId != ''">
+            and od.order_id regexp #{flowCard.orderId}
         </if>
         <if test="flowCard.orderGlassDetail.productionId != null and flowCard.orderGlassDetail.productionId != ''">
             and ogd.production_id regexp #{flowCard.orderGlassDetail.productionId}
@@ -187,6 +192,7 @@
             and od.product_name regexp #{flowCard.orderDetail.productName}
         </if>
         group by od.order_id, ogd.production_id
+        order by od.id desc
     </select>
 
     <!--    鏇存柊鍒嗘灦鐘舵��-->
@@ -228,15 +234,15 @@
         left join sd.order_glass_detail as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         left join sd.product as p on od.product_name=p.product_name
         where od.order_id=#{orderId} and ogd.production_id=#{productionId} and ogd.splitting_status=0
-        GROUP BY od.order_number;
-
+        GROUP BY od.order_number
+        order by od.id desc
 
     </select>
 
     <!--淇敼鎺掔増鐘舵��-->
     <update id="updateLayoutStatusMp">
         update flow_card as fc
-        set fc.layout_status=2
+        set fc.layout_status=#{state}
         where fc.process_id = #{processId}
     </update>
 
@@ -322,7 +328,7 @@
         from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
                                    left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
         where od.order_id=#{orderId} and ps.processes=#{processes} and ps.scheduling_id IS NOT NULL
-
+        order by ps.id desc
     </select>
 <!--    鏌ヨ鏈帓鐗堟暟鎹�-->
     <select id="selectNoSchedulingMp">
@@ -349,4 +355,8 @@
         where ogd.production_id = #{productionId}
           and ogd.order_number=#{orderNumber}
     </select>
+<!--  鏌ヨ璇ヨ鍗曟祦绋嬪崱鏉℃暟  -->
+    <select id="selectFlowCardCount">
+        select COUNT(*) from flow_card where order_id=#{orderId}
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml b/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
index 50467cc..e099760 100644
--- a/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
+++ b/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
@@ -42,123 +42,185 @@
     </resultMap>
 
 
-<!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
-    <select id="SelectOkSchedulingMp">
-        select date(ps.scheduled_start_time) as scheduled_start_time,
-               date(ps.plan_end_time) as plan_end_time,
-               od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        ps.scheduling_quantity,
-#         (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-#         round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
-        ps.reviewer,
-        od.product_name,od.shape,ps.scheduling_id
+    <!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
+    <select id="selectOkSchedulingMp">
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")           as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
         from sd.order_detail as od
-            left join sd.order as o on od.order_id=o.order_id
-            left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where  ps.scheduling_id IS NOT NULL
-           and od.create_time between #{selectTime1} and #{selectTime2}
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where ps.scheduling_id IS NOT NULL
+          and od.create_time between #{selectTime1} and #{selectTime2}
           and position(#{processes} in ps.processes)
           and position(#{orderId} in ps.order_id)
-
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
 
-    <!--    鏌ヨ宸叉帓浜у甫璁㈠崟缂栧彿鐨勬暟鎹�-->
+    <!--    鏌ヨ宸叉帓浜х殑鏁版嵁-->
     <select id="selectSchedulingNotMp">
-        select date(ps.scheduled_start_time) as scheduled_start_time,
-        date(ps.plan_end_time) as plan_end_time,
-        od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        ps.scheduling_quantity,
-#         (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-#         round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
-        ps.reviewer,
-        od.product_name,od.shape,ps.scheduling_id
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000, 2)
+                                                                      as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")
+                                                                      as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
         from sd.order_detail as od
-        left join sd.order as o on od.order_id=o.order_id
-        left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where  (ps.scheduling_id IS NOT NULL )
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (ps.scheduling_id IS NOT NULL)
           and position(#{processes} in ps.processes)
           and position(#{orderId} in ps.order_id)
-
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
-<!--    鏌ヨ鏈帓浜ф暟鎹�-->
-    <select id="SelectNoSchedulingMp" >
-        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-        round(od.width*od.height*od.quantity/1000000,2) as area,
-        (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-        round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-        IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-        round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
-        od.product_name,od.shape
-        from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
-        left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where   od.quantity-IFNULL(ps.scheduling_quantity,0)>0 and od.create_time between #{selectTime1} and #{selectTime2}
+    <!--    鏌ヨ鏈帓浜ф暟鎹�-->
+    <select id="selectNoSchedulingMp">
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+          and od.create_time between #{selectTime1} and #{selectTime2}
 
           and position(#{orderId} in ps.order_id)
-    group by od.order_id,od.order_number
+          and position(#{processes} in ps.processes)
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
-<!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
+    <!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
     <select id="selectLastSchedulingMp">
-        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
-               round(od.width*od.height*od.quantity/1000000,2) as area,
-               (od.quantity-IFNULL(sum(ps.scheduling_quantity),0)) as pendingProductionQuantity,
-               round(od.width*od.height*(od.quantity-IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as pendingProductionArea,
-               IFNULL(sum(ps.scheduling_quantity),0) as productionScheduledQuantity,
-               round(od.width*od.height*(IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as productionScheduledArea,
-               od.product_name,od.shape
-        from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
-                                   left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
-        where od.create_time between #{selectTime1} and #{selectTime2} and od.quantity-IFNULL(ps.scheduling_quantity,0)>0
-        group by od.order_id,od.order_number
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(sum(ps.scheduling_quantity), 0)                 as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where od.create_time between #{selectTime1} and #{selectTime2}
+          and (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
     </select>
 
     <select id="selectMaxId">
-        select
-            COUNT(ps.scheduling_id)
-        from
-            `production_scheduling` as ps
-        where
-            date(ps.create_time) = curdate()
+        select COUNT(ps.scheduling_id)
+        from `production_scheduling` as ps
+        where date(ps.create_time) = curdate()
     </select>
 
     <insert id="insertSelective">
-        insert into production_scheduling(
-               scheduling_id,
-               order_id,
-               order_number,
-               processes,
-               scheduling_quantity,
-               scheduled_start_time,
-               plan_end_time,
-               notes,
-               create_time
-               )
-        VALUES(
-               #{schedulingId},
-               #{orderId},
-               #{orderNumber},
-               #{processes},
-               #{schedulingQuantity},
-               #{scheduledStartTime},
-               #{planEndTime},
-               #{notes},
-               now()
-              )
+        insert into production_scheduling(scheduling_id,
+                                          order_id,
+                                          order_number,
+                                          processes,
+                                          scheduling_quantity,
+                                          scheduled_start_time,
+                                          plan_end_time,
+                                          notes,
+                                          create_time)
+        VALUES (#{schedulingId},
+                #{orderId},
+                #{orderNumber},
+                #{processes},
+                #{schedulingQuantity},
+                #{scheduledStartTime},
+                #{planEndTime},
+                #{notes},
+                now())
     </insert>
 
-    <update id="ExamineSchedulingMp">
-        update production_scheduling set review_status=1,reviewer=#{userName} where
-        scheduling_id=#{schedulingId}
+    <update id="examineSchedulingMp">
+        update production_scheduling
+        set review_status=1,
+            reviewer=#{userName}
+        where scheduling_id = #{schedulingId}
     </update>
 
     <delete id="deleteSchedulingMp">
-        delete from production_scheduling where scheduling_id=#{schedulingId}
+        delete
+        from production_scheduling
+        where scheduling_id = #{schedulingId}
     </delete>
+
+    <select id="selectProcess">
+        SELECT *
+        FROM sd.basic_data as bd
+        where bd.basic_category = 'process'
+          and bd.basic_type = 'product'
+    </select>
+
+    <select id="selectNumberMp">
+
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0