You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

136 lines
6.3 KiB

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaotao.modules.base.dao.ProductProcessRouteMapper">
<!-- 查询-产品工艺路线 -->
<select id="searchProductProcessRoute" resultType="com.gaotao.modules.base.entity.ProductProcessRouteData">
Select T.PartNo,MP.PartDescription,MP.UMid,T.RevNo,T.PhaseInDate,T.PhaseOutDate,T.RoutingType_DB,
T.RoutingType,T.Status,T.Status_DB,T.Remark,T.Defaultflag,D.ItemNo,D.OperationDesc,D.WorkCenterNo,
CP.WorkCenterDesc,D.MachSetupTime,D.MachRunFactor,D.FactorUnit_DB,
D.FactorUnit,D.Efficiency,D.Crewsize,D.Remark as DetailRemark,T.Site,D.JJGZ_UnitFactor,D.JJGZ_UnitPrice,
CP.WorkCenterType
from RoutingHeader as T,RoutingDetail as D,Part as MP,WorkCenter as CP
<where>
AND T.Site=D.Site
and T.PartNo=D.PartNo
and T.RevNo=D.RevNo
and T.Site=MP.Site
and T.PartNo=MP.PartNo
and T.Site=CP.Site
and D.WorkCenterNo=CP.WorkCenterNo
and T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
<if test=" site != null and site != ''">
AND T.Site = #{site}
</if>
<if test=" partNo != null and partNo != ''">
AND T.PartNo like #{partNo}
</if>
<if test=" partDescription != null and partDescription != ''">
AND MP.PartDescription like #{partDescription}
</if>
<if test="spec != null and spec != ''">
AND MP.Spec like #{spec}
</if>
<if test=" revNo != null and revNo != ''">
AND T.RevNo like #{revNo}
</if>
<if test=" routingType != null and routingType != ''">
AND T.RoutingType like #{routingType}
</if>
<if test=" workCenterNo != null and workCenterNo != ''">
AND D.WorkCenterNo like #{workCenterNo}
</if>
<if test=" workCenterDesc != null and workCenterDesc != ''">
AND CP.WorkCenterDesc like #{workCenterDesc}
</if>
<if test=" defaultflag != null and defaultflag != ''">
AND T.Defaultflag like #{defaultflag}
</if>
<if test=" status != null and status != ''">
AND T.Status like #{status}
</if>
<if test=" date1 != null ">
AND T.PhaseInDate >= #{date1}
</if>
<if test=" date2 != null ">
AND dateadd( DAY, 1, #{date2} ) > T.PhaseInDate
</if>
<if test=" date3 != null ">
AND T.PhaseOutDate >= #{date3}
</if>
<if test=" date4 != null ">
AND dateadd( DAY, 1, #{date4} ) > T.PhaseOutDate
</if>
</where>
</select>
<!--查询-工艺路线工具-->
<select id="searchProcessRouteTool" resultType="com.gaotao.modules.base.entity.ProcessRouteToolData">
Select
T.CreateDate,T.CreateDate,T.Remark,T.ToolQty,
T.ToolID,D.ToolDescription,D.Spec as ToolSpec,D.FamilyID as ToolFamilyID,PF2.FamilyName as ToolFamilyName
,D.Active as ToolActive,T.PartNo,P.PartDescription,P.Spec,P.Active,T.RevNo,T.ItemNo,Rd.OperationDesc
,RD.WorkCenterNo,RH.RoutingType,RH.PhaseInDate,RH.PhaseOutDate,RH.Status,RH.Defaultflag,RH.RepairFlag
,P.FamilyID,PF1.FamilyName,P.GroupID,PG.GroupName,T.Site
from RoutingTool as T,RoutingDetail as RD,RoutingHeader as RH,ToolHeader as D
Left Join PartFamily as PF2 On D.Site=PF2.Site and D.FamilyID=PF2.FamilyID,Part as P
Left Join PartFamily as PF1 On P.Site=PF1.Site and P.FamilyID=PF1.FamilyID
Left Join PartGroup as PG On P.Site=PG.Site and P.GroupID=PG.GroupID
<where>
and T.Site=RD.Site and T.PartNo=RD.PartNo and T.RevNo=RD.RevNo and T.ItemNo=RD.ItemNo
and T.Site=RH.Site and T.PartNo=RH.PartNo and T.RevNo=RH.RevNo and T.Site=D.Site
and T.ToolID=D.ToolID and T.Site=P.Site and T.PartNo=P.PartNo
and T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
<if test=" site != null and site != ''">
AND T.Site = #{site}
</if>
<if test=" toolID != null and toolID != ''">
AND T.ToolID like #{toolID}
</if>
<if test=" toolDescription != null and toolDescription != ''">
AND D.ToolDescription like #{toolDescription}
</if>
<if test="toolSpec != null and toolSpec != ''">
AND D.Spec like #{toolSpec}
</if>
<if test=" toolFamilyID != null and toolFamilyID != ''">
AND D.FamilyID like #{toolFamilyID}
</if>
<if test=" toolActive != null and toolActive != ''">
AND D.Active like #{toolActive}
</if>
<if test=" workCenterNo != null and workCenterNo != ''">
AND RD.WorkCenterNo like #{workCenterNo}
</if>
<if test=" partNo != null and partNo != ''">
AND T.PartNo like #{partNo}
</if>
<if test=" partDescription != null and partDescription != ''">
AND P.PartDescription like #{partDescription}
</if>
<if test=" spec != null and spec != ''">
AND P.Spec like #{spec}
</if>
<if test=" status != null and status != ''">
AND RH.Status like #{status}
</if>
<if test=" defaultflag != null and defaultflag != ''">
AND RH.Defaultflag like #{defaultflag}
</if>
<if test=" active != null and active != ''">
AND P.Active like #{active}
</if>
<if test=" date1 != null ">
AND T.PhaseInDate >= #{date1}
</if>
<if test=" date2 != null ">
AND dateadd( DAY, 1, #{date2} ) > RH.PhaseInDate
</if>
<if test=" date3 != null ">
AND T.PhaseOutDate >= #{date3}
</if>
<if test=" date4 != null ">
AND dateadd( DAY, 1, #{date4} ) > RH.PhaseOutDate
</if>
</where>
</select>
</mapper>