chenlu
2025-08-11 8bcd0cc77b0c7aa2c00ffd926ee87f1f09a3a3b5
north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -310,7 +310,7 @@
    <!--优化查询-->
    <select id="computeAndOptimization">
        SELECT
            1 AS rackNo,
            c.rack AS rackNo,
            h.layout_id as layoutId,
            h.width AS width,
            h.height AS height,
@@ -746,7 +746,7 @@
        from pp.optimize_project as p
                 left join pp.optimize_admin as a on p.creater = a.Id
        where (`p`.`state` > 0)
            and (tempering_state>0 or optimize_state>0)
#             and (tempering_state>0 or optimize_state>0)
            and DATE (`p`.`create_time`) BETWEEN #{startSelectTime} AND #{endSelectTime}
        <if test="optimizeProjectMange.projectNumber != null and optimizeProjectMange.projectNumber != ''">
            and p.project_no regexp #{optimizeProjectMange.projectNumber}
@@ -1232,6 +1232,7 @@
            y_axis,
            patch_state,
            mark_icon,
            isRotate,
            rack_no
            ) VALUES (
            #{projectId},
@@ -1249,6 +1250,7 @@
            #{glass.y},
            #{glass.patchState},
            #{glass.markIcon},
            #{glass.isRotate},
            #{glass.rackNo}
            );
        </foreach>
@@ -1341,6 +1343,28 @@
            now()
            );
        </foreach>
    </insert>
    <insert id="addOptimizeOffcut">
        INSERT INTO pp.optimize_offcut (
        project_no,
        stock_id,
        width,
        height,
        x_axis,
        y_axis,
        model,
        thickness
        ) VALUES (
        #{projectId},
        #{map.stockSort},
        #{map.width},
        #{map.height},
        #{map.x},
        #{map.y},
        #{glassType},
        #{glassThickness}
        )
    </insert>
@@ -1435,6 +1459,11 @@
    <update id="updateOptimizeConfig">
        UPDATE pp.optimize_config set config_detail=#{json},create_time=now()
        where config_type=#{type} and creater=#{username}
    </update>
    <update id="updateFlowCardRack">
        UPDATE pp.flow_card
        SET rack = #{rackValue}
        WHERE process_id = #{processId} AND technology_number = #{technologyNumber}
    </update>
    <select id="simulatedTypesettingUsingOpt">
@@ -1632,9 +1661,128 @@
    </delete>
    <select id="selectOptimizeProject">
        select
            project_no as engineerId,
            project_name as engineerName,
            avg_cut_pct as avgAvailability,
            valid_cut_pct as validAvailability,
            last_cut_pct as lastAvailability,
            glass_total as glassTotal,
            glass_total_area as glassTotalArea,
            raw_stock_qty as planPatternTotal,
            raw_stock_area as planPatternTotalArea,
            glass_thickness as thickness,
            glass_type as filmsId
        from
            pp.optimize_project
        where
            project_no = #{projectNo}
    </select>
    <select id="selectOptimizeLayout">
        select
            ol.project_no as engineeringId,
            op.glass_type as filmsId,
            ol.realwidth as rawGlassWidth,
            ol.realheight as rawGlassHeight,
            op.glass_thickness as rawGlassThickness,
            ol.stock_id rawSequence
        from
            pp.optimize_layout ol
                left join pp.optimize_project op on ol.project_no = op.project_no
        where
            ol.project_no = #{projectNo}
        order by
            ol.stock_id
    </select>
    <select id="selectOptimizeDetail">
        select
            opd.glass_id as glassId,
            opd.project_no as engineerId,
            opd.process_id as flowCardId,
            opd.order_sort as orderNumber,
            opd.o_width as width,
            opd.o_height as height,
            op.glass_thickness as thickness,
            op.glass_type as filmsId,
            opd.total_layer as totalLayer,
            opd.layer,
            opd.stock_id as rawSequence,
            opd.p_width as edgWidth,
            opd.p_height as edgHeight,
            opd.x_axis as xAxis,
            opd.y_axis as yAxis,
            if(opd.o_width!=opd.width,1,0) as rawAngle,
            opd.heat_layout_id as temperingLayoutId,
            opd.heat_layout_sort as temperingFeedSequence,
            ohd.x_axis as xCoordinate,
            ohd.y_axis as yCoordinate,
            ohd.rotate_angle as angle,
            IF(LOCATE('中空', ogd.process ) > 0 or LOCATE('夹层', ogd.process ) > 0, 1, 0) as isMultiple,
            od.width as maxWidth,
            od.height as maxHeight,
            opd.mark_icon as markIcon,
            fc.`merge` as combine,
            concat( opd.process_id, '/', opd.layer ) as flowCardSequence,
            ogd.process
        from
            pp.optimize_detail opd
                left join pp.optimize_project op on op.project_no = opd.project_no
                left join pp.flow_card fc on opd.process_id = fc.process_id
                and opd.layer = fc.technology_number
                and opd.order_sort = order_number
                left join sd.`order` o on fc.order_id = o.order_id
                left join sd.order_detail od on fc.order_id = od.order_id
                and fc.order_number = od.order_number
                left join sd.order_glass_detail ogd on fc.order_id = ogd.order_id
                and fc.order_number = ogd.order_number
                and ogd.technology_number = fc.technology_number
                left join pp.optimize_heat_detail ohd on ohd.layout_id = opd.heat_layout_id
                and ohd.sort = opd.heat_layout_sort and ohd.project_no=opd.project_no
        where
            opd.project_no = #{projectNo}
    </select>
    <select id="selectFlowCardInfoList">
        select
            fc.process_id as flowCardId,
            ogd.child_width as width,
            ogd.child_height as height,
            REPLACE (JSON_UNQUOTE( JSON_EXTRACT( pd.separation, '$.thickness' )), 'mm', '' ) as thickness,
            JSON_UNQUOTE(JSON_EXTRACT( pd.separation, '$.color' )) as filmsId,
            fc.layers_number as totalLayer,
            fc.technology_number as layer,
            fc.quantity as glassTotal,
            od.order_number as orderNumber,
            od.product_name as productName,
            o.customer_name as customerName
        from
            pp.flow_card fc
                left join sd.`order` o on fc.order_id = o.order_id
                left join sd.order_detail od on fc.order_id = od.order_id
                and fc.order_number = od.order_number
                left join sd.order_glass_detail ogd on fc.order_id = ogd.order_id
                and fc.order_number = ogd.order_number
                and ogd.technology_number = fc.technology_number
                left join sd.product p on od.product_id = p.id
                left join sd.product_detail pd on od.product_id = pd.prod_id
                and fc.technology_number = pd.glass_sort
        where
            project_no =#{projectNo}
    </select>
    <select id="getGlassInfo" resultType="java.util.Map">
        select
            project_no,
            glass_type,
            glass_thickness
        from
            pp.optimize_project
        where
            project_no = #{projectId}
    </select>
</mapper>