From deb789b123fc47b37859da8a6dd16910cf7c96cb Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 26 一月 2024 16:00:15 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml |  281 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 246 insertions(+), 35 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml b/north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml
index ee7221f..eb359fa 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml
@@ -3,10 +3,10 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
-<mapper namespace="com.example.erp.mapper.mm.FinishedGoodsInventoryMapper" >
+<mapper namespace="com.example.erp.mapper.mm.FinishedGoodsInventoryMapper">
 
-    <resultMap id="selectFinishedGoodsInventory" type="com.example.erp.entity.mm.FinishedGoodsInventory" >
-        <id column="id" property="id"/>
+    <resultMap id="selectFinishedGoodsInventory" type="com.example.erp.entity.mm.FinishedGoodsInventory">
+        <id column="fid" property="id"/>
         <result column="inventory" property="inventory"/>
         <result column="area" property="area"/>
         <result column="actual_signal_area" property="actualSignalArea"/>
@@ -19,50 +19,255 @@
         <result column="update_time" property="updateTime"/>
         <result column="end_time" property="endTime"/>
 
-
-            <result column="order_id" property="order.orderId"/>
-            <result column="project" property="order.project"/>
-            <result column="order_type" property="order.orderType"/>
+        <result column="order_id" property="order.orderId"/>
+        <result column="project" property="order.project"/>
+        <result column="order_type" property="order.orderType"/>
 
 
-            <result column="order_number" property="orderDetail.orderNumber"/>
-            <result column="width" property="orderDetail.width"/>
-            <result column="height" property="orderDetail.height"/>
-            <result column="product_name" property="orderDetail.product.productName"/>
-            <result column="product_id" property="orderDetail.product.id"/>
-
-
+        <result column="order_number" property="orderDetail.orderNumber"/>
+        <result column="width" property="orderDetail.width"/>
+        <result column="height" property="orderDetail.height"/>
+        <result column="product_name" property="orderDetail.productName"/>
+        <result column="product_id" property="orderDetail.productId"/>
 
     </resultMap>
+
+    <resultMap id="selectFlowCard" type="com.example.erp.entity.pp.FlowCard">
+        <id column="id" property="id"/>
+        <result column="order_number" property="orderNumber"/>
+        <result column="inventory_quantity" property="inventoryQuantity"/>
+        <result column="process_id" property="processId"/>
+        <result column="received_quantity" property="receivedQuantity"/>
+
+
+        <result column="order_id" property="order.orderId"/>
+        <result column="project" property="order.project"/>
+        <result column="creater" property="order.creater"/>
+        <result column="area" property="order.area"/>
+        <result column="batch" property="order.batch"/>
+
+        <result column="building_number" property="orderDetail.buildingNumber"/>
+        <result column="width" property="orderDetail.width"/>
+        <result column="height" property="orderDetail.height"/>
+        <result column="product_name" property="orderDetail.productName"/>
+        <result column="product_id" property="orderDetail.productId"/>
+        <result column="quantity" property="orderDetail.quantity"/>
+    </resultMap>
+
+    <update id="updateflowcard">
+        update pp.flow_card
+        set received_quantity=received_quantity+${inventoryQuantity}
+        where order_number=#{orderNumber} and process_id=#{processId}
+    </update>
+
+    <update id="updateInventory">
+        update mm.finished_goods_inventory
+        set inventory=inventory+${inventoryQuantity},quantity_available=quantity_available+${inventoryQuantity},
+            update_time=now(),area=area+actual_signal_area*${inventoryQuantity}
+        where order_number=#{orderNumber}
+    </update>
+
+    <insert id="insertFinishedGoodsInventory"  useGeneratedKeys="true"  >
+        insert into mm.finished_goods_inventory (order_id,
+                                                 order_number,
+                                                 inventory,
+                                                 actual_signal_area,
+                                                 area,
+                                                 quantity_available,
+                                                 warehouse_number,
+                                                 storage_region,
+                                                 `status`,
+                                                 enter_storage_time,
+                                                 update_time,
+                                                 end_time,
+                                                 remark
+        )
+        values (
+                   #{flowCard.order.orderId} ,#{flowCard.orderNumber},#{flowCard.inventoryQuantity},ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}/1000000,2),
+                   ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}*#{flowCard.inventoryQuantity}/1000000,2),
+                #{flowCard.inventoryQuantity},null,#{storageRegion},
+                0,now(),now(),null,#{remark}
+               )
+    </insert>
+
+    <select id="findOrderNumberdcount" >
+        select count(*)
+        from  mm.`finished_goods_inventory`
+        where order_number = #{orderNumber}
+
+    </select>
+
+    <select id="findOrderNumberd" >
+        select *
+        from  sd.finished_goods_inventory
+         where order_number = #{orderNumber}
+
+    </select>
+
+    <select id="getseletwarehousing" resultMap="selectFlowCard">
+        select
+        fc.id,
+        o.order_id,
+        od.building_number,
+        od.product_id,
+        od.product_name,
+        od.width,
+        od.height,
+        o.creater,
+        o.project,
+        fc.order_number,
+        od.quantity,
+        fc.inventory_quantity,
+        o.area,
+        fc.process_id,
+        fc.received_quantity,
+        o.batch
+        from pp.flow_card fc left join sd.order_detail od on fc.order_number=od.order_number inner join sd.`order` o on
+        o.order_id=fc.order_id
+        <where>
+                and fc.received_quantity <![CDATA[<]]> fc.inventory_quantity
+            <if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
+                and o.order_id regexp #{flowCard.order.orderId}
+            </if>
+            <if test="flowCard.orderDetail.buildingNumber != null and flowCard.orderDetail.buildingNumber != ''">
+                and od.building_number regexp #{flowCard.orderDetail.buildingNumber}
+            </if>
+            <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
+                and od.product_id regexp #{flowCard.orderDetail.productId}
+            </if>
+            <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName != ''">
+                and od.product_name regexp #{flowCard.orderDetail.productName}
+            </if>
+            <if test="flowCard.orderDetail.width != null and flowCard.orderDetail.width != ''">
+                and od.width regexp #{flowCard.orderDetail.width}
+            </if>
+            <if test="flowCard.orderDetail.height != null and flowCard.orderDetail.height != ''">
+                and od.height regexp #{flowCard.orderDetail.height}
+            </if>
+            <if test="flowCard.order.creater != null and flowCard.order.creater != ''">
+                and o.creater regexp #{flowCard.order.creater}
+            </if>
+            <if test="flowCard.order.project != null and flowCard.order.project != ''">
+                and o.project regexp #{flowCard.order.project}
+            </if>
+            <if test="flowCard.orderNumber != null and flowCard.orderNumber != ''">
+                and fc.order_number regexp #{flowCard.orderNumber}
+            </if>
+            <if test="flowCard.orderDetail.quantity != null and flowCard.orderDetail.quantity != ''">
+                and od.quantity regexp #{flowCard.orderDetail.quantity}
+            </if>
+            <if test="flowCard.inventoryQuantity != null and flowCard.inventoryQuantity != ''">
+                and fc.inventory_quantity regexp #{flowCard.inventoryQuantity}
+            </if>
+            <if test="flowCard.order.area != null and flowCard.order.area != ''">
+                and o.area regexp #{flowCard.order.area}
+            </if>
+            <if test="flowCard.order.batch != null and flowCard.order.batch != ''">
+                and o.batch regexp #{flowCard.order.batch}
+            </if>
+            <if test="flowCard.processId != null and flowCard.processId != ''">
+                and fc.process_id regexp #{flowCard.processId}
+            </if>
+            <if test="flowCard.receivedQuantity != null and flowCard.receivedQuantity != ''">
+                and fc.received_quantity regexp #{flowCard.receivedQuantity}
+            </if>
+
+        </where>
+        group by fc.order_number,fc.process_id order by fc.create_time
+        limit #{offset},#{pageSize};
+    </select>
+    <select id="getseletwarehousingPageTotal" >
+        select  CEILING(count(zu.order_number)/#{pageSize}) from (
+        select fc.order_number as order_number,fc.process_id from pp.flow_card fc left join sd.order_detail od on
+        fc.order_number=od.order_number inner join sd.`order` o on o.order_id=fc.order_id
+        <where>
+            and fc.received_quantity <![CDATA[<]]> fc.inventory_quantity
+            <if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
+                and o.order_id regexp #{flowCard.order.orderId}
+            </if>
+            <if test="flowCard.orderDetail.buildingNumber != null and flowCard.orderDetail.buildingNumber != ''">
+                and od.building_number regexp #{flowCard.orderDetail.buildingNumber}
+            </if>
+            <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
+                and od.product_id regexp #{flowCard.orderDetail.productId}
+            </if>
+            <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName != ''">
+                and od.product_name regexp #{flowCard.orderDetail.productName}
+            </if>
+            <if test="flowCard.orderDetail.width != null and flowCard.orderDetail.width != ''">
+                and od.width regexp #{flowCard.orderDetail.width}
+            </if>
+            <if test="flowCard.orderDetail.height != null and flowCard.orderDetail.height != ''">
+                and od.height regexp #{flowCard.orderDetail.height}
+            </if>
+            <if test="flowCard.order.creater != null and flowCard.order.creater != ''">
+                and o.creater regexp #{flowCard.order.creater}
+            </if>
+            <if test="flowCard.order.project != null and flowCard.order.project != ''">
+                and o.project regexp #{flowCard.order.project}
+            </if>
+            <if test="flowCard.orderNumber != null and flowCard.orderNumber != ''">
+                and fc.order_number regexp #{flowCard.orderNumber}
+            </if>
+            <if test="flowCard.orderDetail.quantity != null and flowCard.orderDetail.quantity != ''">
+                and od.quantity regexp #{flowCard.orderDetail.quantity}
+            </if>
+            <if test="flowCard.inventoryQuantity != null and flowCard.inventoryQuantity != ''">
+                and fc.inventory_quantity regexp #{flowCard.inventoryQuantity}
+            </if>
+            <if test="flowCard.order.area != null and flowCard.order.area != ''">
+                and o.area regexp #{flowCard.order.area}
+            </if>
+            <if test="flowCard.order.batch != null and flowCard.order.batch != ''">
+                and o.batch regexp #{flowCard.order.batch}
+            </if>
+            <if test="flowCard.processId != null and flowCard.processId != ''">
+                and fc.process_id regexp #{flowCard.processId}
+            </if>
+            <if test="flowCard.receivedQuantity != null and flowCard.receivedQuantity != ''">
+                and fc.received_quantity regexp #{flowCard.receivedQuantity}
+            </if>
+
+        </where>
+        group by fc.order_number,fc.process_id order by fc.create_time) as zu
+    </select>
+
+
     <select id="defaultfinishedGoods" resultMap="selectFinishedGoodsInventory">
         select od.order_number,
-               o.order_id,
-               o.project,
-               o.order_type,
-               od.product_name,
-               od.product_id,
-               od.width,
-               od.height,
-               fgi.inventory,
-               fgi.quantity_available,
-               fgi.actual_signal_area,
-               fgi.area,
-               fgi.warehouse_number,
-               fgi.storage_region,
-               fgi.`status`,
-               fgi.update_time,
-               fgi.enter_storage_time,
-               fgi.end_time,
-               fgi.remark
+        o.order_id,
+        o.project,
+        o.order_type,
+        od.product_name,
+        od.product_id,
+        od.width,
+        od.height,
+        fgi.inventory,
+        fgi.quantity_available,
+        fgi.actual_signal_area,
+        fgi.area,
+        fgi.warehouse_number,
+        fgi.storage_region,
+        fgi.`status`,
+        fgi.update_time,
+        fgi.enter_storage_time,
+        fgi.end_time,
+        fgi.remark
         from finished_goods_inventory fgi
-                 left join sd.order_detail od on fgi.order_number = od.order_number
-                 inner join sd.`order` o on fgi.order_id = o.order_id
+        left join sd.order_detail od on fgi.order_number = od.order_number
+        inner join sd.`order` o on fgi.order_id = o.order_id
         <where>
             <if test="finishedGoodsInventory.orderDetail.width != null and finishedGoodsInventory.orderDetail.width != ''">
                 and od.width regexp #{finishedGoodsInventory.orderDetail.width}
             </if>
             <if test="finishedGoodsInventory.orderDetail.orderNumber != null and finishedGoodsInventory.orderDetail.orderNumber != ''">
                 and od.order_number regexp #{finishedGoodsInventory.orderDetail.orderNumber}
+            </if>
+            <if test="finishedGoodsInventory.orderDetail.productName != null and finishedGoodsInventory.orderDetail.productName != ''">
+                and od.product_name regexp #{finishedGoodsInventory.orderDetail.productName}
+            </if>
+            <if test="finishedGoodsInventory.orderDetail.productId != null and finishedGoodsInventory.orderDetail.productId != ''">
+                and od.product_id regexp #{finishedGoodsInventory.orderDetail.productId}
             </if>
             <if test="finishedGoodsInventory.order.orderId != null and finishedGoodsInventory.order.orderId != ''">
                 and o.order_id regexp #{finishedGoodsInventory.order.orderId}
@@ -118,7 +323,7 @@
     </select>
 
 
-    <select id="getPageTotal" >
+    <select id="getPageTotal">
         select
         CEILING(count(fgi.id)/#{pageSize})
         from finished_goods_inventory fgi
@@ -131,6 +336,12 @@
             <if test="finishedGoodsInventory.orderDetail.orderNumber != null and finishedGoodsInventory.orderDetail.orderNumber != ''">
                 and od.order_number regexp #{finishedGoodsInventory.orderDetail.orderNumber}
             </if>
+            <if test="finishedGoodsInventory.orderDetail.productName != null and finishedGoodsInventory.orderDetail.productName != ''">
+                and od.product_name regexp #{finishedGoodsInventory.orderDetail.productName}
+            </if>
+            <if test="finishedGoodsInventory.orderDetail.productId != null and finishedGoodsInventory.orderDetail.productId != ''">
+                and od.product_id regexp #{finishedGoodsInventory.orderDetail.productId}
+            </if>
             <if test="finishedGoodsInventory.order.orderId != null and finishedGoodsInventory.order.orderId != ''">
                 and o.order_id regexp #{finishedGoodsInventory.order.orderId}
             </if>

--
Gitblit v1.8.0