chenlu
2024-03-07 de18cca83738bdf6b279046e34b910ccd5b73a84
north-glass-erp/src/main/resources/mapper/sd/DeliveryDetail.xml
@@ -29,6 +29,7 @@
        <result column="d_quantity" property="deliveryDetail.quantity"/>
        <result column="money" property="deliveryDetail.money"/>
        <result column="delivery_number" property="deliveryDetail.deliveryNumber"/>
        <result column="delivery_detail_remakes" property="deliveryDetail.deliveryDetailRemakes"/>
        <result column="batch" property="order.batch"/>
@@ -55,12 +56,24 @@
    </resultMap>
    <delete id="deleteDeliveryDetail">
        delete from sd.delivery_detail where delivery_id=#{deliveryId}
    </delete>
    <update id="updateOrderDetailDeliveryNum">
        update sd.order_detail set delivery_num=#{finishedGoodsInventory.quantityAvailable} where order_id=#{orderId} and order_number=#{orderNumber}
        update sd.order_detail set delivery_num=#{deliveryDetail.quantity} where order_id=#{orderId} and order_number=#{orderNumber}
    </update>
    <update id="updateIsNotOrderDetailDeliveryNum">
        update sd.order_detail set delivery_num=delivery_num-#{quantity} where order_id=#{orderId} and order_number=#{orderNumber}
    </update>
    <select id="getdeliveryDetailmaximum" >
        select count(*) from sd.delivery_detail where  delivery_id=#{deliveryId}
    </select>
    <select id="getIsNotDeliveryDetail" >
        select * from sd.delivery_detail where  delivery_id=#{deliveryId}
    </select>
@@ -68,19 +81,40 @@
        insert into sd.delivery_detail (delivery_id,delivery_number,order_number,
                                        area,order_id,quantity,money,delivery_detail_remakes,delivery_detail_state,create_time)
        values (
                   #{number} ,#{deliveryNumber},#{orderDetail.orderNumber},#{orderDetail.computeGrossArea},
                #{orderDetail.orderId},#{orderDetail.finishedGoodsInventory.quantityAvailable},
                #{orderDetail.price}*#{orderDetail.finishedGoodsInventory.quantityAvailable},'',1,now()
                   #{number} ,#{deliveryNumber},#{orderDetail.order_number},#{orderDetail.computeGrossArea},
                #{orderDetail.orderId},#{orderDetail.deliveryDetail.quantity},
                #{orderDetail.price}*#{orderDetail.deliveryDetail.quantity},'',1,now()
               )
    </insert>
    <select id="getseletShippingOrderDetail" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
        select od.order_id,o.batch,fgi.quantity_available,od.quantity-dd.quantity as t_quantity,od.quantity as o_quantity,dd.quantity
        as d_quantity,od.building_number,od.product_id,od.product_name,od.price,fgi.storage_region,dd.money,od.width,
        od.height,od.shape,fgi.actual_signal_area,od.gross_area,od.compute_area,od.compute_gross_area,
        od.processing_note,od.edging_type,od.perimeter,dd.delivery_detail_remakes
    <select id="getSelectShippingOrderDetail" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
        select od.order_id,
               o.batch,
               dd.delivery_number,
               fgi.quantity_available + dd.quantity as quantity_available,
               od.order_number,
               od.quantity-dd.quantity as t_quantity,
               od.quantity as o_quantity,
               dd.quantity as d_quantity,
               od.building_number,
               od.product_id,
               od.product_name,
               od.price,
               fgi.storage_region,
               dd.money,
               od.width,
               od.height,
               od.shape,
               fgi.actual_signal_area,
               od.gross_area,
               od.compute_area,
               od.compute_gross_area,
               od.processing_note,
               od.edging_type,
               od.perimeter,
               dd.delivery_detail_remakes
        from sd.delivery_detail dd
        left join sd.delivery d on dd.delivery_id=d.delivery_id
        left join sd.order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
@@ -90,12 +124,78 @@
            <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''">
                and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryDetail.quantity != null and orderDetail.deliveryDetail.quantity != ''">
                and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp #{orderDetail.price}
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.deliveryDetail.money != null and orderDetail.deliveryDetail.money != ''">
                and dd.money regexp  REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
            <if test="orderDetail.deliveryDetail.deliveryDetailRemakes != null and orderDetail.deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getseletShippingOrderDetailPageTotal">
    <select id="getSelectShippingOrderDetailPageTotal">
        select
            CEILING(count(dd.id)/#{pageSize})
        from sd.delivery_detail dd
@@ -107,18 +207,84 @@
            <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''">
                and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryDetail.quantity != null and orderDetail.deliveryDetail.quantity != ''">
                and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp #{orderDetail.price}
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.deliveryDetail.money != null and orderDetail.deliveryDetail.money != ''">
                and dd.money regexp  REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
            <if test="orderDetail.deliveryDetail.deliveryDetailRemakes != null and orderDetail.deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getseletShippingOrderDetails" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
    <select id="getSelectShippingOrderDetails" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
        select od.order_id,
               od.order_number,
               o.batch,
               fgi.quantity_available,
               od.quantity- od.delivery_num as t_quantity,
               od.quantity as o_quantity,
               od.delivery_num as d_quantity,
               fgi.quantity_available as d_quantity,
               od.building_number,
               od.product_id,
               od.product_name,
@@ -143,11 +309,68 @@
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryNum != null and orderDetail.deliveryNum != ''">
                and od.delivery_num regexp #{orderDetail.deliveryNum}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp  REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getseletShippingOrderDetailsPageTotal">
    <select id="getSelectShippingOrderDetailsPageTotal">
        select
        CEILING(count(od.id)/#{pageSize})
        from sd.order_detail od
@@ -159,6 +382,63 @@
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryNum != null and orderDetail.deliveryNum != ''">
                and od.delivery_num regexp #{orderDetail.deliveryNum}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp  REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>