From 120df3e19856f9d3e27aec50d399cff72b331079 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 14 二月 2025 08:42:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/entity/pp/OptimizeUse.java                     |    2 
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi2.vue            |    7 +
 north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue                            |    6 
 north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java |    7 +
 north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue                   |   39 +++++--
 north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue                       |    8 +
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java       |   67 +++++++++++++
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi1.vue            |    7 +
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml                           |   50 ++++++++++
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java         |   21 ++++
 north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java                   |   26 +++++
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml                                    |    6 
 12 files changed, 219 insertions(+), 27 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue b/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
index b6f3e1a..fe55717 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
@@ -36,6 +36,7 @@
 })
 const getData = () => {
   request.get(`/order/printOrderProductDetail/${props.orderId}/${selectedValues.value}`).then(res => {
+    console.log( res.data)
     data.value= res.data
     productIdData.value=data.value.orderProductDetail
     data.value.orderProductDetail.forEach(item => {
@@ -188,6 +189,11 @@
                 <td>{{items.orderNumber}}</td>
                 <td>{{items.buildingNumber}}</td>
                 <td colspan="3" style="font-size: 20px;font-weight: bold;" v-if="items.otherColumns?.S02">{{items.otherColumns?.S02}}</td>
+                <td colspan="3" style="font-size: 20px;font-weight: bold;" v-else-if="items.differentSize=1">
+                  <template v-for="(orderGlassDetail, index1) in items.orderGlassDetails" >
+                  ({{orderGlassDetail.childWidth}}x{{orderGlassDetail.childHeight}})
+                  </template>
+                </td>
                 <td colspan="3" style="font-size: 20px;font-weight: bold;" v-else>{{items.width}}x{{items.height}}</td>
                 <td style="font-size: 20px;font-weight: bold;">{{items.quantity}}</td>
                 <td style="font-size: 20px;font-weight: bold;">{{items.grossArea.toFixed(2)}}</td>
@@ -322,7 +328,7 @@
   height: 30px;
 }
 .contactNumber{
-  width: 150px;
+  width: 125px;
   height:20px;
   border: none;
   box-shadow: none;
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 5e32056..a16a169 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
@@ -606,18 +606,6 @@
 
         } else {
 
-
-          // item.baiscQuantity = item.baiscQuantity * 1 + leftData[leftfilterIndex].quantity * 1
-          // item.computeGrossArea=(item.width*item.height*item.baiscQuantity/1000000).toFixed(2)
-          //item.computeGrossArea=(item.width*item.height*item.baiscQuantity/1000000).toFixed(2)
-          // for (let i = 0; i <checkedList.length ; i++) {
-          //
-          //   if (checkedList[i].orderNumber === item.orderNumber){
-          //     console.log(item.baiscQuantity  +"---"+ checkedList[i].quantity )
-          //     item.baiscQuantity = item.baiscQuantity * 1 + checkedList[i].quantity * 1
-          //   }
-          // }
-
           delete item._X_ROW_KEY
           $grid.insert(item)
 
@@ -649,12 +637,34 @@
       } else {
         // 濡傛灉璇� processId 宸茬粡浣跨敤杩囷紝缁х画浣跨敤宸插垎閰嶇殑缂栧彿
         newProcessId = `${baseProcessId}${(totalUniqueCount + 1).toString().padStart(3, '0')}`;
-        
+
       }
       // 鏇存柊 item.processId
       item.processId = newProcessId;
     });
+    // 鑾峰彇鍓╀綑鏁版嵁,鐢ㄤ簬瀵硅惤鏋堕『搴忛噸鏂拌祴鍊�
+    let remainingData = $gridLeft.getTableData().fullData;
+    // 鎸� processId 鍒嗙粍
+    let groupedData = remainingData.reduce((acc, curr) => {
+      if (!acc[curr.processId]) {
+        acc[curr.processId] = [];
+      }
+      acc[curr.processId].push(curr);
+      return acc;
+    }, {});
 
+    // 鎸� processId 鎺掑簭锛堝�掑簭锛�
+    let sortedProcessIds = Object.keys(groupedData).sort((a, b) => b - a);
+
+    // 鏇存柊姣忎釜鍒嗙粍鐨� landingSequence
+    sortedProcessIds.forEach((processId, index) => {
+      let group = groupedData[processId];
+
+      // 瀵规瘡涓� processId 鍒嗙粍鍐呯殑鏁版嵁锛屼笉鏀瑰彉椤哄簭锛岀洿鎺ヨ祴鐩稿悓鐨� landingSequence
+      group.forEach((item) => {
+        item.landingSequence = sortedProcessIds.length - index; // 鎸夊�掑簭璁剧疆 landingSequence
+      });
+    });
     //娓呴櫎涓よ竟澶嶉�夋
     $gridLeft.clearCheckboxRow()
     $grid.clearCheckboxRow()
@@ -662,10 +672,13 @@
   } catch (e) {
     ElMessage.warning(e.message)
   }
+  //姣忔鐐瑰嚮鎯呭喌杈撳叆妗�
   if (checkedNum.value){
     checkedNum.value =''
   }
 }
+
+
 //鍚戝乏杈硅〃鏍兼坊鍔犳暟鎹�
 const addLeft = () => {
   try {
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi1.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi1.vue
index b22a3d8..b903266 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi1.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi1.vue
@@ -153,7 +153,8 @@
         <span>{{ item.processingNote }}</span>
       </div>
     </div>
-    <div style="width: 20px" v-if="id%2===0"></div>
+    <div style="width: 19px" v-if="id%2===0"></div>
+      <div class="element-to-break-after" style="width: 1px" v-if="id%2===1"></div>
     </template>
   </div>
 
@@ -231,7 +232,9 @@
   font-size: 8pt;
 }
 
-
+.element-to-break-after {
+  page-break-after: always;
+}
 
 
 
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi2.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi2.vue
index 7d7a670..fa995a8 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi2.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabelSemi2.vue
@@ -183,7 +183,8 @@
         <span>{{item.processing_note}}</span>
       </div>
     </div>
-      <div style="width: 20px" v-if="id%2===0"></div>
+      <div style="width: 19px" v-if="id%2===0"></div>
+      <div class="element-to-break-after" style="width: 1px" v-if="id%2===1"></div>
     </template>
   </div>
 
@@ -280,7 +281,9 @@
 }
 
 
-
+.element-to-break-after {
+  page-break-after: always;
+}
 
 
 
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 1afb7f0..3db0642 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
@@ -1004,7 +1004,9 @@
   request.post(`/order/saveOrderTitle`,order).then((res) => {
     if(res.code==200){
       ElMessage.success(t('basicData.msg.saveSuccess'))
-      router.push({path:'/main/order/selectOrder'})
+      router.push({path:'/main/order/createOrder',query:{
+          orderId:titleUploadData.value.orderId,
+          random:Math.random()}})
     }else {
       ElMessage.error(res.msg)
     }
@@ -1668,7 +1670,7 @@
 
       </vxe-grid>
     </div>
-    <el-dialog v-model="dialogTableVisible" :title="$t('order.processingNote')" style="width: 60%;height:75% ">
+    <el-dialog v-model="dialogTableVisible" :draggable="true" :title="$t('order.processingNote')" style="width: 60%;height:75% ">
       <el-input
           v-model="titleUploadData.processingNote"
           type="textarea"
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java b/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
index 982dad1..43665b7 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -182,6 +182,13 @@
     }
 
 
+    @ApiOperation("mes鍒囧壊鎶ュ伐")
+    @PostMapping  ("/mesMaterialOutbound")
+    public Result mesMaterialOutbound(@RequestBody Map<String,Object> reportingWork)  {
+        return  Result.seccess(materialInventoryService.mesMaterialOutbound(reportingWork));
+    }
+
+
 
 
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/pp/OptimizeUse.java b/north-glass-erp/src/main/java/com/example/erp/entity/pp/OptimizeUse.java
index 2ff87f1..a988ba5 100644
--- a/north-glass-erp/src/main/java/com/example/erp/entity/pp/OptimizeUse.java
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/pp/OptimizeUse.java
@@ -12,7 +12,7 @@
 public class OptimizeUse {
     @TableId(type = IdType.AUTO)
     private Integer id;
-    private Integer projectNo;
+    private String projectNo;
     private String rawStockCode;
     private String stockCode;
     private Integer type;
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
index 0f77b7a..da6c154 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -116,6 +116,9 @@
 
     Boolean updateMaterialInventoryAvailableInventoryOut(@Param("inventoryId") Long inventoryId,
                                                 @Param("quantity") Integer quantity);
+
+    Boolean updateMaterialInventoryAvailableInventoryOutMes(@Param("inventoryId") Long inventoryId,
+                                                         @Param("quantity") Integer quantity);
     Boolean updateMaterialInventoryAvailableInventoryInt(@Param("inventoryId") Long inventoryId,
                                                 @Param("quantity") Integer quantity);
 
@@ -231,4 +234,22 @@
 
     List<MaterialLog> exportMaterialLogReport(List<LocalDate> dates, String type);
 
+    List<MaterialOutbound> getSelectMaterialOutboundProjectNo(@Param("projectNo") String projectNo);
+
+    OptimizeUse getSelectOptimizeUses(@Param("projectNo") String projectNo,@Param("width") Double width,@Param("height") Double height);
+
+    List<MaterialOutboundDetail> getSelectMaterialOutboundOptimizeUses(@Param("materialOutboundId") String materialOutboundId,@Param("useId") Integer useId);
+
+    Boolean updateMaterialOutboundOptimizeUses(@Param("useId") Integer useId,@Param("quantity") Integer quantity);
+
+    Boolean insertMaterialOutboundDetailOptimizeUses(@Param("materialOutboundId") String materialOutboundId,@Param("number") Integer number,
+                                               @Param("inventoryId") Long inventoryId,@Param("materialCode") Long materialCode,@Param("inventoryArea") String inventory_area,
+                                               @Param("useId") Integer useId,@Param("outboundQuantity") Integer outboundQuantity,
+                                               @Param("singlePieceArea") Double singlePieceArea,@Param("dateOfManufacture") LocalDate dateOfManufacture);
+
+    Boolean insertMaterialOutboundOptimizeUses(@Param("materialOutboundId") String materialOutboundId,@Param("projectNo") String projectNo,
+                                                     @Param("name") String name);
+
+    Boolean updateOptimizeUsesMes(@Param("useId") Integer useId,@Param("quantity") Integer quantity);
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
index b661695..3f94c04 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -1,18 +1,22 @@
 package com.example.erp.service.mm;
 
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.example.erp.common.Constants;
 import com.example.erp.dto.mm.FinishedOperateLogDTO;
 import com.example.erp.entity.mm.*;
-import com.example.erp.entity.pp.FlowCard;
-import com.example.erp.entity.pp.OptimizeUse;
+import com.example.erp.entity.pp.*;
 import com.example.erp.entity.sd.Delivery;
 import com.example.erp.entity.sd.DeliveryDetail;
 import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.sd.OrderProcessDetail;
 import com.example.erp.entity.userInfo.Log;
 import com.example.erp.entity.userInfo.SysError;
+import com.example.erp.exception.ServiceException;
 import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
 import com.example.erp.mapper.mm.MaterialInventoryMapper;
 import com.example.erp.mapper.mm.MaterialLogMapper;
@@ -23,6 +27,8 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -939,6 +945,63 @@
 
 
 
+    @Transactional(rollbackFor = Exception.class)
+    public boolean mesMaterialOutbound(Map<String, Object> reportingWorkMap) {
+        boolean saveState=true;
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        try {
+            //鎺ユ敹瑙f瀽涓婚檮琛ㄤ俊鎭�
+            JSONObject reportingWorkJson = new JSONObject(reportingWorkMap);
+            String projectNo=reportingWorkJson.get("projectNo").toString();
+            Double width= Double.valueOf(reportingWorkJson.get("width").toString());
+            Double height= Double.valueOf(reportingWorkJson.get("height").toString());
+            Integer quantity= Integer.valueOf(reportingWorkJson.get("quantity").toString());
+
+            List<MaterialOutbound> materialOutboundList=materialInventoryMapper.getSelectMaterialOutboundProjectNo(projectNo);
+            OptimizeUse optimizeUses=materialInventoryMapper.getSelectOptimizeUses(projectNo,width,height);
+
+
+            MaterialInventory materialInventory=materialInventoryMapper.getMaterialInventoryById(Long.valueOf(optimizeUses.getRawStockCode()));
+            if(materialOutboundList.size()==1){
+                List<MaterialOutboundDetail> materialOutboundDetailList=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),optimizeUses.getId());
+                List<MaterialOutboundDetail> materialOutboundDetailList1=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),null);
+                if(materialOutboundDetailList.size()==1){
+                    materialInventoryMapper.updateMaterialOutboundOptimizeUses(optimizeUses.getId(),quantity);
+                }else{
+                    materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),
+                            materialOutboundDetailList1.size()+1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(),
+                            optimizeUses.getId(),quantity,materialInventory.getSinglePieceArea(),materialInventory.getDateOfManufacture());
+                }
+            }else if(materialOutboundList.isEmpty()){
+                String oddNumber = orderNumberSetting("鍑哄簱");
+                materialInventoryMapper.insertMaterialOutboundOptimizeUses(oddNumber,projectNo,reportingWorkJson.get("userName").toString());
+                materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(oddNumber, 1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(),
+                        optimizeUses.getId(),quantity,materialInventory.getSinglePieceArea(),materialInventory.getDateOfManufacture());
+            }else{
+                return false;
+            }
+            materialInventoryMapper.updateMaterialInventoryAvailableInventoryOutMes(Long.valueOf(optimizeUses.getRawStockCode()),quantity);
+            materialInventoryMapper.updateOptimizeUsesMes(optimizeUses.getId(),quantity);
+
+            //淇濆瓨鏃ュ織
+            Log log = new Log();
+            log.setContent(reportingWorkMap.toString());
+            log.setFunction("mesMaterialOutbound鎶ュ伐鏂板");
+            log.setOperatorId((String) reportingWorkJson.get("userId"));
+            log.setOperator((String) reportingWorkJson.get("userName"));
+            logService.saveLog(log);
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+            //灏嗗紓甯镐紶鍏ユ暟鎹簱
+            SysError sysError = new SysError();
+            sysError.setError(e+Arrays.toString(e.getStackTrace()));
+            sysError.setFunc("mesMaterialOutbound鎶ュ伐鏂板");
+            sysErrorService.insert(sysError);
+            saveState = false;
+
+        }
+        return saveState;
+    }
 
 
 
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
index f4a2065..b28f9c7 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -614,6 +614,19 @@
             orderProductDetailMap.put("productId",map.get("productId"));
             orderProductDetailMap.put("productName",map.get("productName"));
             List<OrderDetail> orderDetails = orderDetailMapper.getOrderProductByProductId(map.get("productId"),orderId);
+            orderDetails.forEach(orderDetail->{
+
+                List<OrderGlassDetail> orderGlassDetails =
+                        orderGlassDetailMapper.selectList(
+                                new QueryWrapper<OrderGlassDetail>().
+                                        eq("order_id",orderId).
+                                        eq("order_number",orderDetail.getOrderNumber())
+                        );
+                Integer differentSize = orderGlassDetailMapper.getDifferentSizeNumber(orderId,orderDetail.getOrderNumber());
+                orderDetail.setDifferentSize(differentSize);
+                orderDetail.setOrderGlassDetails(orderGlassDetails);
+            });
+
             orderProductDetailMap.put("productDetail",orderDetails);
             orderProductDetail.add(orderProductDetailMap);
         });
@@ -632,13 +645,24 @@
         }else{
             orderProductDistinct = orderDetailMapper.getOrderProductDistinctById(orderId);
         }
-
         List<Map<String,Object>> orderProductDetail = new ArrayList<>();
         orderProductDistinct.forEach(map->{
             Map<String,Object> orderProductDetailMap = new HashMap<>();
             orderProductDetailMap.put("productId",map.get("productId"));
             orderProductDetailMap.put("productName",map.get("productName"));
             List<OrderDetail> orderDetails = orderDetailMapper.getOrderProductByProductId(map.get("productId"),orderId);
+            orderDetails.forEach(orderDetail->{
+
+                List<OrderGlassDetail> orderGlassDetails =
+                        orderGlassDetailMapper.selectList(
+                                new QueryWrapper<OrderGlassDetail>().
+                                        eq("order_id",orderId).
+                                        eq("order_number",orderDetail.getOrderNumber())
+                        );
+                Integer differentSize = orderGlassDetailMapper.getDifferentSizeNumber(orderId,orderDetail.getOrderNumber());
+                orderDetail.setDifferentSize(differentSize);
+                orderDetail.setOrderGlassDetails(orderGlassDetails);
+            });
 
 
             orderProductDetailMap.put("productDetail",orderDetails);
diff --git a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
index 7e2ab2e..5fc2cbc 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -727,6 +727,13 @@
         where id=#{inventoryId}
     </update>
 
+    <update id="updateMaterialInventoryAvailableInventoryOutMes">
+        update mm.material_inventory
+        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity},
+            plan_quantity=plan_quantity-#{quantity},total_area=inventory_quantity*single_piece_area
+        where id=#{inventoryId}
+    </update>
+
 
     <update id="updateMaterialOutboundToExamine">
         update mm.material_outbound set reviewed_state=#{reviewedState},reviewed=#{reviewed},reviewed_time=now()
@@ -1061,5 +1068,48 @@
         </where>
     </select>
 
+    <select id="getSelectMaterialOutboundProjectNo">
+        select * from mm.material_outbound mo where order_id=#{projectNo}
+    </select>
+
+    <select id="getSelectOptimizeUses">
+        select * from pp.optimize_use  where project_no=#{projectNo} and width=#{width} and height=#{height} and state=1
+    </select>
+
+    <select id="getSelectMaterialOutboundOptimizeUses">
+        select * from mm.material_outbound_detail mo
+        <where>
+            mo.material_outbound_id=#{materialOutboundId}
+            <if test="useId != null">
+               and mo.use_id=#{useId}
+            </if>
+        </where>
+    </select>
+
+    <select id="updateMaterialOutboundOptimizeUses">
+        update mm.material_outbound_detail set outbound_quantity=outbound_quantity+#{quantity} where use_id=#{useId};
+    </select>
+
+    <select id="updateOptimizeUsesMes">
+        update pp.optimize_use set not_use_count=not_use_count-#{quantity} where id=#{useId};
+    </select>
+
+    <insert id="insertMaterialOutboundDetailOptimizeUses"  useGeneratedKeys="true" >
+        insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,use_id,inventory_id,inventory_organization,
+                                                 outbound_quantity,single_piece_area,inventory_area,date_of_manufacture)
+        values (
+                   #{materialOutboundId} ,#{number},#{materialCode},#{useId},#{inventoryId},'鍘熺墖搴�',#{outboundQuantity},
+                   #{singlePieceArea},#{inventoryArea},#{dateOfManufacture}
+               )
+    </insert>
+
+    <insert id="insertMaterialOutboundOptimizeUses"  useGeneratedKeys="true" >
+        insert into mm.material_outbound(material_outbound_id,order_id,outbound_type,
+                                         warehouse_manager,material_requisition_date,reviewed_state,reviewed,create_time,reviewed_time)
+        values (
+                   #{materialOutboundId} ,#{projectNo},'鏍囧噯鍑哄簱',#{name},now(),1,#{name},now(),now()
+               )
+    </insert>
+
 
 </mapper>
\ No newline at end of file
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 2d179a1..3647616 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -738,7 +738,7 @@
                fc.quantity,
                round(ogd.total_area, 2)                                       as total_area,
                od.perimeter,
-               if(od.bend_radius!=null,od.bend_radius,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04'))) as bend_radius,
+               if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
                concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
                od.other_columns,
                round(ogd.child_width)                                         as width,
@@ -1396,7 +1396,7 @@
                fc.quantity,
                round(ogd.total_area, 2)                                       as total_area,
                od.perimeter,
-               if(od.bend_radius!=null,od.bend_radius,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04'))) as bend_radius,
+               if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
                concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
                od.other_columns,
                round(ogd.child_width)                                         as width,
@@ -1503,7 +1503,7 @@
                sum(pl.patch_num)                                                 as quantity,
                round(ogd.total_area, 2)                                       as total_area,
                od.perimeter,
-               if(od.bend_radius!=null,od.bend_radius,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04'))) as bend_radius,
+               if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
                concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
                od.other_columns,
                round(ogd.child_width)                                         as width,

--
Gitblit v1.8.0