From ed6f35069824d71ee6da599a328d865eb0c58550 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 25 四月 2024 09:16:26 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/a1536384743/erp_-override

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue        |    2 
 north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue                 |    2 
 north-glass-erp/target/classes/mapper/pp/ReportingWork.xml                                 |   59 +++++++----
 north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue        |    1 
 north-glass-erp/northglass-erp/src/views/sd/product/Test.vue                               |    2 
 north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml                     |   10 +
 north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue           |    2 
 north-glass-erp/target/erp-0.0.1-SNAPSHOT.jar.original                                     |    0 
 north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue                          |   28 ++++
 north-glass-erp/northglass-erp/src/components/sd/product/BasicTable.vue                    |    0 
 north-glass-erp/northglass-erp/src/views/pp/workOrder/SelectWorkOrder.vue                  |    2 
 north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue                     |    2 
 north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue                      |    2 
 north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicOtherMoneyController.java |    6 
 north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml                         |   10 +
 north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue                 |   66 +++++++++++-
 north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java       |   31 +++++
 north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue              |    2 
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml                             |   59 +++++++----
 19 files changed, 214 insertions(+), 72 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue b/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
index 6120ba2..d2cd57e 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
@@ -2,8 +2,12 @@
 import {computed, onMounted, reactive, ref, watch} from "vue"
 import {filterChanged} from "@/hook"
 import {useI18n} from "vue-i18n"
-import {ElMessage} from "element-plus";
+import {ElMessage, ElMessageBox,} from "element-plus"
+import request from "@/utils/request"
+import {useRouter,useRoute} from "vue-router"
 const { t } = useI18n()
+const router = useRouter()
+const route = useRoute()
 let rowClickIndex = ref(null)
 const xGrid = ref()
 const gridOptions = reactive({
@@ -34,7 +38,7 @@
   },//琛ㄥご鍙傛暟
   columns:[
     // {field: 'buildingNumber',width:120,  title: '妤煎彿',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged},
-    {field: 'alias', title:'鍏朵粬鍔犲伐',editRender: { name: 'input'},minWith:'130'},
+    {field: 'alias', title:'鍏朵粬鍔犲伐',minWith:'130'},
     {field: 'price',  title:'鍗曚环',editRender: { name: 'input'}},
     {field: 'quantity',  title:'鏁伴噺' },
     {field: 'money', slots:{default:'default'},  title:'閲戦'}
@@ -107,11 +111,7 @@
     if ($grid) {
       switch (code) {
         case 'add': {
-          if ($grid.getTableData().tableData.length >=240){
-            ElMessage.error(t('order.msg.tableLengthMax'))
-            return
-          }
-          $grid.insert({})
+          addColumn()
           break
         }
         case 'delete': {
@@ -119,7 +119,7 @@
             ElMessage.warning('璇峰厛鍗曞嚮閫夋嫨琛�')
             return
           }
-          $grid.remove(rowClickIndex.value)
+          deleteColum(rowClickIndex.value.id)
           rowClickIndex.value = null
           break
         }
@@ -169,6 +169,55 @@
   validate
 })
 
+
+const addColumn = () => {
+  ElMessageBox.prompt( '鏂板鍒楀悕:', {
+    confirmButtonText: '鏂板',
+    cancelButtonText: '鍙栨秷',
+    inputPattern:/^.{1,20}$/,
+    inputErrorMessage: '璇疯緭鍏�20涓瓧绗︿互鍐呯殑涓斾笉涓虹┖鐨勫瓧绗�',
+  })
+    .then(({ value }) => {
+      request.post('/basicOtherMoney/save',{alias:value}).then(res=>{
+        if (res.code==='200' && res.data!==false){
+          ElMessage.success('鏂板鎴愬姛')
+          setTimeout(()=>{
+            window.location.reload()
+          },1500)
+
+        }else{
+          ElMessage.error('鏂板澶辫触,涓嶈兘閲嶅娣诲姞鎴栬秴杩�100鏉″垪')
+        }
+      })
+    })
+
+}
+
+const deleteColum = (id) => {
+  ElMessageBox.confirm(
+      '纭鍒犻櫎姝ゅ垪鍚�?',
+      'Warning',
+      {
+        confirmButtonText: '鍒犻櫎',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning',
+      }
+  )
+      .then(() => {
+        request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{
+          if (res.code==='200' && res.data!==false){
+            ElMessage.success('鍒犻櫎鎴愬姛')
+            setTimeout(()=>{
+              window.location.reload()
+            },1500)
+          }else{
+            ElMessage.error('鍒犻櫎澶辫触')
+          }
+        })
+      })
+
+}
+
 </script>
 
 <template>
@@ -185,6 +234,7 @@
         <span>{{ countAmount(row) }} </span>
       </template>
     </vxe-grid>
+
   </div>
 
 
diff --git a/north-glass-erp/northglass-erp/src/components/basic/BasicTable.vue b/north-glass-erp/northglass-erp/src/components/sd/product/BasicTable.vue
similarity index 100%
rename from north-glass-erp/northglass-erp/src/components/basic/BasicTable.vue
rename to north-glass-erp/northglass-erp/src/components/sd/product/BasicTable.vue
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 5ef2232..7434174 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
@@ -9,7 +9,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import useUserInfoStore from "@/stores/userInfo";
 import { useI18n } from 'vue-i18n'
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 4848d87..93408a3 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
@@ -9,7 +9,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import useUserInfoStore from "@/stores/userInfo";
 import {changeFilterEvent, filterChanged} from "@/hook"
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue
index dab4cd4..a105db3 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/SelectDetailProcessCard.vue
@@ -9,7 +9,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 
 let productGlassTypeStore = useProductGlassTypeStore()
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 78b5f41..c32560c 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
@@ -9,7 +9,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import { useI18n } from 'vue-i18n'
 //璇█鑾峰彇
diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
index ebf7f45..f5af339 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
@@ -223,6 +223,7 @@
 //瀛愮粍浠舵帴鏀跺弬鏁�
 const xGrid = ref()
 const gridOptions = reactive({
+  loading: true,
   border:  "full",//琛ㄦ牸鍔犺竟妗�
   keepSource: true,//淇濇寔婧愭暟鎹�
   align: 'center',//鏂囧瓧灞呬腑
diff --git a/north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue b/north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue
index f8be814..314feae 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue
@@ -9,7 +9,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import useUserInfoStore from "@/stores/userInfo";
 import { useI18n } from 'vue-i18n'
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 fd22964..f2abf94 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
@@ -8,7 +8,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from 'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import { useI18n } from 'vue-i18n'
 //璇█鑾峰彇
diff --git a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
index 2d80716..2a5597d 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -75,6 +75,8 @@
 
 const gridOptions = reactive({
   loading:false,
+  showHeaderOverflow: false,
+  showFooterOverflow: false,
   border:  "full",//琛ㄦ牸鍔犺竟妗�
   keepSource: true,//淇濇寔婧愭暟鎹�
   align: 'center',//鏂囧瓧灞呬腑
@@ -86,8 +88,8 @@
   printConfig: {},
   importConfig: {},
   exportConfig: {},
-  scrollY:{ enabled: true,gt:15 },//寮�鍚櫄鎷熸粴鍔�
-  scrollX:{ enabled: true,gt:30 },//寮�鍚櫄鎷熸粴鍔�
+  scrollY:{ enabled: true,gt:13 },//寮�鍚櫄鎷熸粴鍔�
+  //scrollX:{ enabled: true,gt:15 },//寮�鍚櫄鎷熸粴鍔�
   showOverflow:true,
   menuConfig: {
     body: {
@@ -208,7 +210,7 @@
           }
         }
       }
-    ]
+    ],
   },
   toolbarConfig: {
     buttons: [
@@ -531,9 +533,27 @@
     otherMoney.value = titleSelectJson.value.orderOtherMoney[0]
     //let columns = []
     otherMoney.value.forEach(item => {
-      let column = {field: `otherColumns.${item.column}`,width:50,  title: item.alias,editRender: { name: 'input'}}
+      let column = {
+        field: `otherColumns.${item.column}`,
+        width:50,  title: item.alias,
+        editRender: {
+          name: 'input',
+        }
+      }
+      gridOptions.editRules[`otherColumns.${item.column}`] = [
+        {
+          validator ({ cellValue }) {
+            const regex = /^(0|[1-9][0-9]{0,4}([.][0-9]{1,2})?)$/
+            if (cellValue && !regex.test(cellValue)) {
+              return new Error(t('basicData.msg.range99999Dec2'))
+            }
+          }
+        }
+      ]
+
       //columns.push(column)
       gridOptions.columns.push(column)
+
     })
 
     //杩涘叆椤甸潰涓嬫媺妗嗚缃粯璁ゅ��
diff --git a/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue b/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
index 1f47ae5..b172d77 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -8,7 +8,7 @@
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from  'vue-router'
 import Sortable from 'sortablejs'
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import {VXETable} from "vxe-table";
 let productGlassTypeStore = useProductGlassTypeStore()
 let router=useRouter()
diff --git a/north-glass-erp/northglass-erp/src/views/sd/product/Test.vue b/north-glass-erp/northglass-erp/src/views/sd/product/Test.vue
index 3c13c5f..626a662 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/product/Test.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/product/Test.vue
@@ -1,5 +1,5 @@
 <script setup>
-import BasicTable from '@/components/basic/BasicTable.vue'
+import BasicTable from '@/components/sd/product/BasicTable.vue'
 import request from "@/utils/request"
 import deepClone from "@/utils/deepClone";
 import {ElMessage} from "element-plus";
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicOtherMoneyController.java b/north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicOtherMoneyController.java
index b82fd64..72fb09b 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicOtherMoneyController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicOtherMoneyController.java
@@ -6,6 +6,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Map;
+
 @RestController
 @RequestMapping("/basicOtherMoney")
 public class BasicOtherMoneyController {
@@ -27,8 +29,8 @@
     }
 
     @PostMapping("save")
-    public Result save(String  alias){
-        return  Result.seccess(basicOtherMoneyService.save(alias));
+    public Result save(@RequestBody Map<String,String> alias){
+        return  Result.seccess(basicOtherMoneyService.save(alias.get("alias")));
     }
 
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java
index 14d50af..982af9d 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java
@@ -1,6 +1,7 @@
 package com.example.erp.service.sd;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.example.erp.entity.sd.BasicOtherMoney;
 import com.example.erp.mapper.sd.BasicOtherMoneyMapper;
 import org.springframework.stereotype.Service;
@@ -25,9 +26,31 @@
         return basicOtherMoneyMapper.deleteById(id);
     }
 
-    public int save(String alias) {
-        BasicOtherMoney basicOtherMoney = new  BasicOtherMoney();
-        basicOtherMoney.setAlias(alias);
-        return basicOtherMoneyMapper.insert(basicOtherMoney);
+    public boolean save(String alias) {
+        //鍒ゆ柇鏄惁宸茬粡瀛樺湪
+        QueryWrapper<BasicOtherMoney> queryWrapperByName = new QueryWrapper<>();
+        queryWrapperByName.eq("alias", alias);
+        int count = Math.toIntExact(basicOtherMoneyMapper.selectCount(queryWrapperByName));
+        if(count>0){
+            return false;
+        }
+
+        //鏌ヨ鏈�澶х殑鍒楀悕
+        QueryWrapper<BasicOtherMoney> queryWrapper = new QueryWrapper<>();
+        queryWrapper.orderByDesc("id");
+        List<BasicOtherMoney> basicOtherMoneyList = basicOtherMoneyMapper.selectList(queryWrapper);
+        //瓒呰繃100鏉′笉鎵ц
+        if(basicOtherMoneyList.size()==100){
+            return false;
+        }
+
+        BasicOtherMoney basicOtherMoney = basicOtherMoneyList.get(0);
+        String getColumn = basicOtherMoney.getColumn()==null?"0":basicOtherMoney.getColumn().replace("M","");
+        int  columnNum = Integer.parseInt(getColumn)+1;
+        BasicOtherMoney newBasicOtherMoney = new  BasicOtherMoney();
+        newBasicOtherMoney.setColumn("M"+String.format("%02d", columnNum));
+        newBasicOtherMoney.setAlias(alias);
+        basicOtherMoneyMapper.insert(newBasicOtherMoney);
+        return true;
     }
 }
diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index 9689a44..8d19a0f 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -310,7 +310,10 @@
     </select>
     <select id="selectGlassProcessNum" resultType="java.lang.Integer">
         select
-              d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0)
+        if((d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)&lt; 0,
+           0,
+           (d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)
+            )
         from flow_card as a
         left join sd.order_process_detail as b
         on
@@ -321,13 +324,22 @@
             and b.process_id = a.process_id
         left join sd.order_process_detail as d
             on d.id=b.id-1
-        left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
-                   from patch_log
-                   group by reporting_work_id,order_sort,technology_number) as c
-        on
-            c.process_id = a.process_id
-            and c.order_sort = a.order_number
-            and c.technology_number = a.technology_number
+        left join (SELECT
+                       sum(rw.rework_num) as 'reworkNumSum',
+                       rw.process_id,rw.order_sort,rw.technology_number,
+                       rwk.this_process
+                   from
+                       rework as rw
+                           LEFT JOIN
+                       reporting_work as rwk
+                       on rw.reporting_work_id =rwk.reporting_work_id
+                   where rwk.this_process=#{thisProcess}
+                     and rw.review_status=1
+                     and rw.process_id = SUBSTR(#{processId} from 1 for 14)
+                   GROUP BY rw.process_id,rw.order_sort,rw.technology_number) as c
+                  on c.process_id = a.process_id
+                      and c.order_sort = a.order_number
+                      and c.technology_number = a.technology_number
 
         where
             a.process_id=SUBSTR(#{processId} from 1 for 14)
@@ -371,10 +383,12 @@
             d.child_width,
             d.child_height,
             e.shape,
-            a.completed_quantity+a.breakage_quantity as 'quantity', -- 鍙姤宸ユ暟
-            a.completed_quantity as 'completedQuantity', -- 瀹屽伐鏁�
-            a.breakage_quantity as 'breakageQuantity', -- 鐮存崯鏁�
-            f.completed_quantity as thisQuantitySum ,-- 鏈伐搴忓畬宸ュ拰
+            if(ifnull(a.completed_quantity+a.breakage_quantity,0)=0,
+                c.quantity-ifnull(a.completed_quantity+a.breakage_quantity,0),
+                ifnull(a.completed_quantity+a.breakage_quantity,0)) as 'quantity', -- 鍙姤宸ユ暟
+            ifnull(a.completed_quantity,0) as 'completedQuantity', -- 瀹屽伐鏁�
+            ifnull(a.breakage_quantity,0) as 'breakageQuantity', -- 鐮存崯鏁�
+            ifnull(f.completed_quantity,0) as thisQuantitySum ,-- 鏈伐搴忓畬宸ュ拰
             if(c.quantity-f.completed_quantity = 0 ,true,false) as saveFlag,
             <if test="nextProcess != null and nextProcess != ''">  -- 闈炴渶鍚庝竴閬撳伐搴�
                 ifnull(g.completed_quantity,0) as nextQuantitySum,  -- 鍚庡伐搴忓凡瀹屾垚
@@ -399,13 +413,16 @@
                 as minQuantity -- 淇敼鏈�灏忔暟
             </if>
             -- e.thisQuantitySum
-        from
-            reporting_work_detail as a
-            left join reporting_work as b
-                on  a.reporting_work_id = b.reporting_work_id
-            left join  flow_card as c
-                on c.process_id = b.process_id
-                and c.technology_number = a.technology_number
+        from reporting_work as b
+
+        right join  flow_card as c
+        on c.process_id = b.process_id
+
+        left join reporting_work_detail as a
+        on  a.reporting_work_id = b.reporting_work_id
+        and c.order_number=a.order_number
+        and c.technology_number = a.technology_number
+
             left join  sd.order_glass_detail as d
                 on d.order_id = c.order_id
                 and c.order_number = d.order_number
@@ -449,7 +466,8 @@
                   and g.order_number = a.order_number
                   and g.technology_number = a.technology_number
         </if>
-        where a.reporting_work_id = #{reportingWorkId}
+        where b.reporting_work_id = #{reportingWorkId}
+        GROUP BY c.order_number
     </select>
 <select id="selectReportingWorkMp" resultMap="reportingWorkMap">
         select rw.reporting_work_id,
@@ -562,7 +580,6 @@
         select process
         from sd.order_process_detail
         where process_id = #{processId}
-          and order_number = 1
           and technology_number = 1
         order by id desc
         LIMIT 1
diff --git a/north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml
index fbe2e09..57fe496 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml
@@ -5,8 +5,14 @@
 <mapper namespace="com.example.erp.mapper.sd.OrderOtherMoneyMapper">
     <select id="findById">
         select
-            a.*,
-            b.alias
+            a.order_id,
+            a.`column`,
+            a.quantity,
+            a.price,
+            a.money,
+            a.create_time,
+            b.alias,
+            b.id
         from order_other_money as a
         left join  basic_other_money as b
         on a.`column` = b.`column`
diff --git a/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml b/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
index 9689a44..8d19a0f 100644
--- a/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
@@ -310,7 +310,10 @@
     </select>
     <select id="selectGlassProcessNum" resultType="java.lang.Integer">
         select
-              d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0)
+        if((d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)&lt; 0,
+           0,
+           (d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)
+            )
         from flow_card as a
         left join sd.order_process_detail as b
         on
@@ -321,13 +324,22 @@
             and b.process_id = a.process_id
         left join sd.order_process_detail as d
             on d.id=b.id-1
-        left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
-                   from patch_log
-                   group by reporting_work_id,order_sort,technology_number) as c
-        on
-            c.process_id = a.process_id
-            and c.order_sort = a.order_number
-            and c.technology_number = a.technology_number
+        left join (SELECT
+                       sum(rw.rework_num) as 'reworkNumSum',
+                       rw.process_id,rw.order_sort,rw.technology_number,
+                       rwk.this_process
+                   from
+                       rework as rw
+                           LEFT JOIN
+                       reporting_work as rwk
+                       on rw.reporting_work_id =rwk.reporting_work_id
+                   where rwk.this_process=#{thisProcess}
+                     and rw.review_status=1
+                     and rw.process_id = SUBSTR(#{processId} from 1 for 14)
+                   GROUP BY rw.process_id,rw.order_sort,rw.technology_number) as c
+                  on c.process_id = a.process_id
+                      and c.order_sort = a.order_number
+                      and c.technology_number = a.technology_number
 
         where
             a.process_id=SUBSTR(#{processId} from 1 for 14)
@@ -371,10 +383,12 @@
             d.child_width,
             d.child_height,
             e.shape,
-            a.completed_quantity+a.breakage_quantity as 'quantity', -- 鍙姤宸ユ暟
-            a.completed_quantity as 'completedQuantity', -- 瀹屽伐鏁�
-            a.breakage_quantity as 'breakageQuantity', -- 鐮存崯鏁�
-            f.completed_quantity as thisQuantitySum ,-- 鏈伐搴忓畬宸ュ拰
+            if(ifnull(a.completed_quantity+a.breakage_quantity,0)=0,
+                c.quantity-ifnull(a.completed_quantity+a.breakage_quantity,0),
+                ifnull(a.completed_quantity+a.breakage_quantity,0)) as 'quantity', -- 鍙姤宸ユ暟
+            ifnull(a.completed_quantity,0) as 'completedQuantity', -- 瀹屽伐鏁�
+            ifnull(a.breakage_quantity,0) as 'breakageQuantity', -- 鐮存崯鏁�
+            ifnull(f.completed_quantity,0) as thisQuantitySum ,-- 鏈伐搴忓畬宸ュ拰
             if(c.quantity-f.completed_quantity = 0 ,true,false) as saveFlag,
             <if test="nextProcess != null and nextProcess != ''">  -- 闈炴渶鍚庝竴閬撳伐搴�
                 ifnull(g.completed_quantity,0) as nextQuantitySum,  -- 鍚庡伐搴忓凡瀹屾垚
@@ -399,13 +413,16 @@
                 as minQuantity -- 淇敼鏈�灏忔暟
             </if>
             -- e.thisQuantitySum
-        from
-            reporting_work_detail as a
-            left join reporting_work as b
-                on  a.reporting_work_id = b.reporting_work_id
-            left join  flow_card as c
-                on c.process_id = b.process_id
-                and c.technology_number = a.technology_number
+        from reporting_work as b
+
+        right join  flow_card as c
+        on c.process_id = b.process_id
+
+        left join reporting_work_detail as a
+        on  a.reporting_work_id = b.reporting_work_id
+        and c.order_number=a.order_number
+        and c.technology_number = a.technology_number
+
             left join  sd.order_glass_detail as d
                 on d.order_id = c.order_id
                 and c.order_number = d.order_number
@@ -449,7 +466,8 @@
                   and g.order_number = a.order_number
                   and g.technology_number = a.technology_number
         </if>
-        where a.reporting_work_id = #{reportingWorkId}
+        where b.reporting_work_id = #{reportingWorkId}
+        GROUP BY c.order_number
     </select>
 <select id="selectReportingWorkMp" resultMap="reportingWorkMap">
         select rw.reporting_work_id,
@@ -562,7 +580,6 @@
         select process
         from sd.order_process_detail
         where process_id = #{processId}
-          and order_number = 1
           and technology_number = 1
         order by id desc
         LIMIT 1
diff --git a/north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml b/north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml
index fbe2e09..57fe496 100644
--- a/north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml
+++ b/north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml
@@ -5,8 +5,14 @@
 <mapper namespace="com.example.erp.mapper.sd.OrderOtherMoneyMapper">
     <select id="findById">
         select
-            a.*,
-            b.alias
+            a.order_id,
+            a.`column`,
+            a.quantity,
+            a.price,
+            a.money,
+            a.create_time,
+            b.alias,
+            b.id
         from order_other_money as a
         left join  basic_other_money as b
         on a.`column` = b.`column`
diff --git a/north-glass-erp/target/erp-0.0.1-SNAPSHOT.jar.original b/north-glass-erp/target/erp-0.0.1-SNAPSHOT.jar.original
index 0245c05..2f998ae 100644
--- a/north-glass-erp/target/erp-0.0.1-SNAPSHOT.jar.original
+++ b/north-glass-erp/target/erp-0.0.1-SNAPSHOT.jar.original
Binary files differ

--
Gitblit v1.8.0