From 8f878c56003027d0b7408c82b53d2abfc0f1df10 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期二, 09 十二月 2025 12:27:30 +0800
Subject: [PATCH] 提交按照配置文件错误问题

---
 north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml |  254 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 239 insertions(+), 15 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
index 4e31f15..a7b5afd 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
@@ -10,19 +10,64 @@
         from
             sd.`order` as o
         where
-            o.quantity=#{order.quantity} and o.area=#{order.area} and o.project=#{order.project} and o.customer_id=#{order.customerId} and o.money=#{order.money}
+            o.quantity=#{order.quantity} and o.area=#{order.area} and trim(o.project)=trim(#{order.project}) and o.customer_id=#{order.customerId}
     </select>
 
     <select id="selectMaxOrderId">
         select
-           ifnull(SUBSTR(max(order_id) from 9),0)
+           ifnull(SUBSTR(max(right(order_id,8)) from 7),0)
         from
             `order` as a
         where
             date(a.create_time) = curdate()
-        order by id desc,order_id	desc limit  1
+        /*order by order_id desc,order_id	desc limit  1*/
     </select>
-    
+
+    <select id="selectMaxOrderIdByMonth">
+        select
+            ifnull(SUBSTR(max(right(order_id,8)) from 5),0)
+        from
+            `order` as a
+        where
+            date(a.create_time)  BETWEEN DATE_FORMAT(DATE(NOW()), '%Y-%m-01') AND DATE(NOW())
+    </select>
+
+    <select id="selectMaxOrderIdByYear">
+       select
+           ifnull(SUBSTR(max(right(order_id,8)) from 3),0)
+        from
+            `order` as a
+        where
+            year(a.create_time)  = year(now())
+    </select>
+
+    <select id="selectOrderIdMin">
+        select count(*) from sd.`order` where SUBSTR(order_id,3,11)>#{substringInt}
+    </select>
+
+    <select id="selectOrderIdIs">
+        select count(*) from sd.`order` where SUBSTR(order_id,3,11)=#{substringInt}
+    </select>
+
+    <select id="selectOrderIdDay">
+        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},9,2)=01
+    </select>
+
+    <select id="selectOrderIdMonth">
+        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},7,4)=0001
+    </select>
+
+    <select id="selectOrderIdYear">
+        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},5,2)=000001
+    </select>
+
+    <select id="selectOrderId">
+        select * from sd.`order` where order_id=#{orderId}
+    </select>
+
+    <update id="updateOrderId">
+        update sd.`order` set order_id=#{newOrderId} where order_id=#{oldOrderId}
+    </update>
 
     <update id="updateOrderParameter">
         update `order` o
@@ -49,21 +94,23 @@
             o.area = od.c,
             o.perimeter= od.aa,
             o.other_money = ifnull(c.money,0),
-            o.other_remarks = (select group_concat( distinct edging_type) from order_detail where order_id = #{orderId} and  edging_type is not null)
+            o.other_remarks = (select GROUP_CONCAT(DISTINCT edging_type)
+        from order_detail where order_id = #{orderId} and  edging_type is not null)
         where
             o.order_id = #{orderId}
 
     </update>
     
     <select id="getOrderList">
-        select
-            *,
-        ifnull(sum(fgi.quantity_available),0) as goodsQuantity
+       select * from (select
+            o.*,
+        ifnull(sum(fgi.quantity_available),0) as goodsQuantity,
+        if(DATEDIFF(o.delivery_date, CURDATE()) &lt; 3  and o.delivery &lt; 2, 'timeOut','' ) as timeOut
         from
-            `order` as o
+            sd.`order` as o
         left join mm.finished_goods_inventory as  fgi
         on o.order_id = fgi.order_id
-        where  date(o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
+        where  date(o.create_time) between #{startDate} and  #{endDate}
 
           <if test="orderType!= null and orderType != ''">
                and o.create_order = #{orderType}
@@ -105,6 +152,14 @@
                and o.salesman REGEXP #{order.salesman}
            </if>
 
+            <if test="order.creator != null and order.creator != ''">
+                and o.creator REGEXP #{order.creator}
+            </if>
+
+            <if test="order.verifier != null and order.verifier != ''">
+                and o.verifier REGEXP #{order.verifier}
+            </if>
+
            <if test="order.perimeter != null and order.perimeter != ''">
                and o.perimeter REGEXP #{order.perimeter}
            </if>
@@ -120,19 +175,62 @@
            <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
                and o.delivery_address REGEXP #{order.deliveryAddress}
            </if>
+        <if test="order.delivery != null ">
+            and o.delivery = #{order.delivery}
+        </if>
+        <if test="order.processReview != null ">
+            and o.process_review = #{order.processReview}
+        </if>
+        <if test="order.orderReview != null ">
+            and o.order_review = #{order.orderReview}
+        </if>
+        <if test="order.productionOrder != null ">
+            and o.production_order = #{order.productionOrder}
+        </if>
+        <if test="order.processingCard != null ">
+            and o.processing_card = #{order.processingCard}
+        </if>
+        <if test="order.warehousing != null ">
+            and o.warehousing = #{order.warehousing}
+        </if>
+        <if test="order.processingNote != null and order.processingNote != ''">
+            and o.processing_note REGEXP #{order.processingNote}
+        </if>
         group by o.id
-        order by o.id desc
+        ) as acc
+        order by
+        <if test="orderBy == null ">
+            order_id desc
+        </if>
+        <if test="orderBy == 'desc'">
+            ${field} desc
+        </if>
+        <if test="orderBy == 'asc'">
+            ${field}
+        </if>
         limit #{offset},#{pageSize}
     </select>
 
     <select id="getPageTotal">
         select
             CEILING(count(o.id)/#{pageSize}) as 'pageTotal',
-            count(o.id) as 'total'
+            count(o.id) as 'dataTotal',
+            sum(o.quantity) as quantity,
+            sum(o.area) as area,
+            sum(o.money) as money,
+            ifnull(fgi.goodsQuantity ,0) as goodsQuantity ,
+            ROUND(sum(perimeter),2) as perimeter,
+            #{pageSize} as pageSize
         from
         `order` as o
+        left join(
+                    select order_id,
+                           ifnull(sum(quantity_available),0) as goodsQuantity
+                    from mm.finished_goods_inventory group by order_id
+                    )  as  fgi
+        on o.order_id = fgi.order_id
         where date (o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
-            <if test="orderType!= null and orderType != ''">
+            <if test="orderType!= null and orderType != 0">
                 and o.create_order = #{orderType}
             </if>
 
@@ -172,6 +270,14 @@
                 and o.salesman REGEXP #{order.salesman}
             </if>
 
+            <if test="order.creator != null and order.creator != ''">
+                and o.creator REGEXP #{order.creator}
+            </if>
+
+            <if test="order.verifier != null and order.verifier != ''">
+                and o.verifier REGEXP #{order.verifier}
+            </if>
+
             <if test="order.perimeter != null and order.perimeter != ''">
                 and o.perimeter REGEXP #{order.perimeter}
             </if>
@@ -187,8 +293,28 @@
             <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
                 and o.delivery_address REGEXP #{order.deliveryAddress}
             </if>
+        <if test="order.delivery != null ">
+            and o.delivery = #{order.delivery}
+        </if>
+        <if test="order.processReview != null ">
+            and o.process_review = #{order.processReview}
+        </if>
+        <if test="order.orderReview != null ">
+            and o.order_review = #{order.orderReview}
+        </if>
+        <if test="order.productionOrder != null ">
+            and o.production_order = #{order.productionOrder}
+        </if>
+        <if test="order.processingCard != null ">
+            and o.processing_card = #{order.processingCard}
+        </if>
+        <if test="order.warehousing != null ">
+            and o.warehousing = #{order.warehousing}
+        </if>
+        <if test="order.processingNote != null and order.processingNote != ''">
+            and o.processing_note REGEXP #{order.processingNote}
+        </if>
         order by o.id desc
-        limit #{offset},#{pageSize}
     </select>
     
     <update id="reviewOrderById">
@@ -205,12 +331,19 @@
         where order_id = #{id}
     </update>
 
+    <update id="backReviewOrderById">
+        update `order` set order_review = 0,
+                           verifier_id = null,
+                           verifier = null
+        where order_id = #{id}
+    </update>
+
     <update id="reviewProcessById">
         update `order` set process_review = #{status} where order_id = #{id}
     </update>
 
     <update id="updateMoney">
-        update `order` set money = #{order.money} where order_id = #{order.orderId}
+        update `order` set money = #{order.money},calculate_type = #{order.calculateType},other_money=#{order.otherMoney} where order_id = #{order.orderId}
     </update>
 
     <update id="cancelOrder">
@@ -225,4 +358,95 @@
         where order_id = #{order.orderId}
     </update>
 
+    <update id="updateOrderPrintNumber">
+        update sd.`order` o
+            set o.printing_number=o.printing_number+1
+        where
+            o.order_id = #{orderId}
+
+    </update>
+
+    <select id="selectDifferentSize">
+    select a.order_number,count(a.order_number),a.order_id from(select order_id,order_number
+    from sd.order_glass_detail ogd
+    where ogd.order_id = #{orderId}
+    group by ogd.order_number,ogd.child_height,child_width)
+    as a
+    group by a.order_number
+    having count(a.order_number) > 1
+    </select>
+
+    <select id="searchOrderWarehousing">
+        select  warehousing from `order`
+        where order_id = #{orderId}
+    </select>
+
+    <select id="getProcessIdByOptimizeHeatDetail">
+        select  process_id from pp.optimize_heat_detail as a
+        where a.project_no = #{projectId}
+          and a.layout_id = #{layoutId}
+          and a.sort = #{sort}
+    </select>
+
+    <select id="scannerGlassInfo">
+        select c.order_id as orderId,
+               b.order_number as orderNumber,
+               b.technology_number as technologyNumber,
+               a.process_id as processId,
+               c.customer_name as customerName,
+               concat(a.width," * " , a.height) as size,
+               b.area,
+               b.glass_child as glassChild,
+               d.product_name as productName,
+               d.building_number as buildingNumber,
+               d.remarks as remarks,
+               d.processing_note as processingNote
+        from pp.optimize_heat_detail as a
+        left join sd.order_glass_detail as b
+            on b.order_number = a.order_sort
+            and b.technology_number = a. layer
+            and b.order_id = #{orderId}
+        left join  sd.order as c
+            on c.order_id = b.order_id
+        left join sd.order_detail as d
+            on c.order_id = d.order_id
+            and d.order_number = a.order_sort
+        where a.project_no = #{projectNo}
+        and a.layout_id = #{layoutId}
+        and a.sort = #{sort}
+    </select>
+
+
+    <insert id="saveOrderFile">
+        insert into sd.order_file (order_id,order_number,file_name,file_data,file_json,create_time) values(#{orderId},#{orderNumber},#{fileName},#{dxfData},#{fileJson},now())
+    </insert>
+
+    <select id="selectOrderFile">
+        select  * from sd.order_file
+        where order_id = #{orderId} and order_number = #{orderNumber}
+
+    </select>
+
+    <select id="selectOrderFileList">
+        select  * from sd.order_file
+        where order_id = #{orderId}
+
+    </select>
+
+    <update id="updateOrderFile">
+        update sd.order_file set file_name=#{fileName},file_data=#{dxfData},file_json=#{fileJson},create_time=now() where order_id=#{orderId} and order_number=#{orderNumber}
+    </update>
+
+
+    <select id="selectProcessAttributeConfigOne">
+        select  * from sd.process_attribute_config
+        where level=1
+
+    </select>
+
+    <select id="selectProcessAttributeConfigTow">
+        select  * from sd.process_attribute_config
+        where level=2 and belong=#{belong}
+
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0