From e0c8edd1d949fae5883a60019d02a9c5f7cb7a29 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 18 三月 2026 09:08:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_宁夏_中盛建材' into dev_宁夏_中盛建材

---
 src/main/resources/mapper/production/ProductOrderMapper.xml |   65 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index 616d12f..e5d318c 100644
--- a/src/main/resources/mapper/production/ProductOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -5,38 +5,75 @@
 
     <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProductOrder">
         <id property="id" column="id"/>
-        <result property="productModelId" column="product_model_id"/>
         <result property="tenantId" column="tenant_id"/>
-        <result property="salesLedgerId" column="sales_ledger_id"/>
         <result property="routeId" column="route_id"/>
         <result property="npsNo" column="nps_no"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
+        <result property="planCompleteTime" column="plan_complete_time"/>
     </resultMap>
+
     <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto">
-        select po.*,sl.sales_contract_no,sl.customer_name,slp.product_category,slp.specification_model
+        select po.*,
+        ppr.process_route_code,
+        ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus
         from product_order po
-        left join sales_ledger sl on po.sales_ledger_id = sl.id
-        left join sales_ledger_product slp on po.product_model_id = slp.id
-        left join process_route pr on po.route_id = pr.id
+        left join product_process_route ppr on po.id = ppr.product_order_id
         <where>
             <if test="c.npsNo != null and c.npsNo != ''">
                 and po.nps_no like concat('%',#{c.npsNo},'%')
             </if>
-            <if test="c.salesContractNo != null and c.salesContractNo != ''">
-                and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%')
-            </if>
             <if test="c.customerName != null and c.customerName != ''">
                 and sl.customer_name like concat('%',#{c.customerName},'%')
             </if>
-            <if test="c.productCategory != null and c.productCategory != ''">
-                and slp.product_category like concat('%',#{c.productCategory},'%')
-            </if>
-            <if test="c.specificationModel != null and c.specificationModel != ''">
-                and slp.specification_model like concat('%',#{c.specificationModel},'%')
+            <if test="c.startTime != null and c.endTime != null">
+                and po.create_time between #{c.startTime} and #{c.endTime}
             </if>
         </where>
     </select>
+    <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute">
+        select pr.*
+        from process_route pr
+                 left join product_material_sku pms on pms.id = pr.product_model_id
+        where pms.id = #{productModelId}
+    </select>
+    <select id="listProcessBom" resultType="com.ruoyi.production.dto.ProductStructureDto">
+        select ps.id,
+               ps.product_model_id,
+               ps.process_id,
+               ps.unit_quantity,
+               ps.unit_quantity * po.quantity as demandedQuantity,
+               ps.unit,
+               p.product_name,
+               pp.name as  process_name,
+               pm.product_id,
+               pm.model
+        from
+            product_structure ps
+                left join product_model pm on ps.product_model_id = pm.id
+                left join product p on pm.product_id = p.id
+                left join product_process pp on ps.process_id = pp.id
+                left join product_process_route ppr on ps.bom_id = ppr.bom_id
+                left join product_order po on po.id = ppr.product_order_id
+        where ppr.product_order_id = #{orderId}
+        order by ps.id
+    </select>
 
 
+    <select id="countCreated" resultType="java.lang.Integer">
+        SELECT count(1) FROM product_order
+        WHERE create_time &gt;= #{startDate} AND create_time &lt;= #{endDate}
+    </select>
+
+    <select id="countCompleted" resultType="java.lang.Integer">
+        SELECT count(1) FROM product_order
+        WHERE end_time &gt;= #{startDate} AND end_time &lt;= #{endDate}
+          AND complete_quantity &gt;= quantity
+    </select>
+
+    <select id="countPending" resultType="java.lang.Integer">
+        SELECT count(1) FROM product_order
+        WHERE create_time &gt;= #{startDate} AND create_time &lt;= #{endDate}
+          AND complete_quantity &lt; quantity
+    </select>
 </mapper>

--
Gitblit v1.9.3