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.

135 lines
6.3 KiB

8 months ago
  1. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  2. <mapper namespace="com.gaotao.modules.base.dao.ProductProcessRouteMapper">
  3. <!-- 查询-产品工艺路线 -->
  4. <select id="searchProductProcessRoute" resultType="com.gaotao.modules.base.entity.ProductProcessRouteData">
  5. Select T.PartNo,MP.PartDescription,MP.UMid,T.RevNo,T.PhaseInDate,T.PhaseOutDate,T.RoutingType_DB,
  6. T.RoutingType,T.Status,T.Status_DB,T.Remark,T.Defaultflag,D.ItemNo,D.OperationDesc,D.WorkCenterNo,
  7. CP.WorkCenterDesc,D.MachSetupTime,D.MachRunFactor,D.FactorUnit_DB,
  8. D.FactorUnit,D.Efficiency,D.Crewsize,D.Remark as DetailRemark,T.Site,D.JJGZ_UnitFactor,D.JJGZ_UnitPrice,
  9. CP.WorkCenterType
  10. from RoutingHeader as T,RoutingDetail as D,Part as MP,WorkCenter as CP
  11. <where>
  12. AND T.Site=D.Site
  13. and T.PartNo=D.PartNo
  14. and T.RevNo=D.RevNo
  15. and T.Site=MP.Site
  16. and T.PartNo=MP.PartNo
  17. and T.Site=CP.Site
  18. and D.WorkCenterNo=CP.WorkCenterNo
  19. and T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
  20. <if test=" site != null and site != ''">
  21. AND T.Site = #{site}
  22. </if>
  23. <if test=" partNo != null and partNo != ''">
  24. AND T.PartNo like #{partNo}
  25. </if>
  26. <if test=" partDescription != null and partDescription != ''">
  27. AND MP.PartDescription like #{partDescription}
  28. </if>
  29. <if test="spec != null and spec != ''">
  30. AND MP.Spec like #{spec}
  31. </if>
  32. <if test=" revNo != null and revNo != ''">
  33. AND T.RevNo like #{revNo}
  34. </if>
  35. <if test=" routingType != null and routingType != ''">
  36. AND T.RoutingType like #{routingType}
  37. </if>
  38. <if test=" workCenterNo != null and workCenterNo != ''">
  39. AND D.WorkCenterNo like #{workCenterNo}
  40. </if>
  41. <if test=" workCenterDesc != null and workCenterDesc != ''">
  42. AND CP.WorkCenterDesc like #{workCenterDesc}
  43. </if>
  44. <if test=" defaultflag != null and defaultflag != ''">
  45. AND T.Defaultflag like #{defaultflag}
  46. </if>
  47. <if test=" status != null and status != ''">
  48. AND T.Status like #{status}
  49. </if>
  50. <if test=" date1 != null ">
  51. AND T.PhaseInDate >= #{date1}
  52. </if>
  53. <if test=" date2 != null ">
  54. AND dateadd( DAY, 1, #{date2} ) > T.PhaseInDate
  55. </if>
  56. <if test=" date3 != null ">
  57. AND T.PhaseOutDate >= #{date3}
  58. </if>
  59. <if test=" date4 != null ">
  60. AND dateadd( DAY, 1, #{date4} ) > T.PhaseOutDate
  61. </if>
  62. </where>
  63. </select>
  64. <!--查询-工艺路线工具-->
  65. <select id="searchProcessRouteTool" resultType="com.gaotao.modules.base.entity.ProcessRouteToolData">
  66. Select
  67. T.CreateDate,T.CreateDate,T.Remark,T.ToolQty,
  68. T.ToolID,D.ToolDescription,D.Spec as ToolSpec,D.FamilyID as ToolFamilyID,PF2.FamilyName as ToolFamilyName
  69. ,D.Active as ToolActive,T.PartNo,P.PartDescription,P.Spec,P.Active,T.RevNo,T.ItemNo,Rd.OperationDesc
  70. ,RD.WorkCenterNo,RH.RoutingType,RH.PhaseInDate,RH.PhaseOutDate,RH.Status,RH.Defaultflag,RH.RepairFlag
  71. ,P.FamilyID,PF1.FamilyName,P.GroupID,PG.GroupName,T.Site
  72. from RoutingTool as T,RoutingDetail as RD,RoutingHeader as RH,ToolHeader as D
  73. Left Join PartFamily as PF2 On D.Site=PF2.Site and D.FamilyID=PF2.FamilyID,Part as P
  74. Left Join PartFamily as PF1 On P.Site=PF1.Site and P.FamilyID=PF1.FamilyID
  75. Left Join PartGroup as PG On P.Site=PG.Site and P.GroupID=PG.GroupID
  76. <where>
  77. and T.Site=RD.Site and T.PartNo=RD.PartNo and T.RevNo=RD.RevNo and T.ItemNo=RD.ItemNo
  78. and T.Site=RH.Site and T.PartNo=RH.PartNo and T.RevNo=RH.RevNo and T.Site=D.Site
  79. and T.ToolID=D.ToolID and T.Site=P.Site and T.PartNo=P.PartNo
  80. and T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
  81. <if test=" site != null and site != ''">
  82. AND T.Site = #{site}
  83. </if>
  84. <if test=" toolID != null and toolID != ''">
  85. AND T.ToolID like #{toolID}
  86. </if>
  87. <if test=" toolDescription != null and toolDescription != ''">
  88. AND D.ToolDescription like #{toolDescription}
  89. </if>
  90. <if test="toolSpec != null and toolSpec != ''">
  91. AND D.Spec like #{toolSpec}
  92. </if>
  93. <if test=" toolFamilyID != null and toolFamilyID != ''">
  94. AND D.FamilyID like #{toolFamilyID}
  95. </if>
  96. <if test=" toolActive != null and toolActive != ''">
  97. AND D.Active like #{toolActive}
  98. </if>
  99. <if test=" workCenterNo != null and workCenterNo != ''">
  100. AND RD.WorkCenterNo like #{workCenterNo}
  101. </if>
  102. <if test=" partNo != null and partNo != ''">
  103. AND T.PartNo like #{partNo}
  104. </if>
  105. <if test=" partDescription != null and partDescription != ''">
  106. AND P.PartDescription like #{partDescription}
  107. </if>
  108. <if test=" spec != null and spec != ''">
  109. AND P.Spec like #{spec}
  110. </if>
  111. <if test=" status != null and status != ''">
  112. AND RH.Status like #{status}
  113. </if>
  114. <if test=" defaultflag != null and defaultflag != ''">
  115. AND RH.Defaultflag like #{defaultflag}
  116. </if>
  117. <if test=" active != null and active != ''">
  118. AND P.Active like #{active}
  119. </if>
  120. <if test=" date1 != null ">
  121. AND T.PhaseInDate >= #{date1}
  122. </if>
  123. <if test=" date2 != null ">
  124. AND dateadd( DAY, 1, #{date2} ) > RH.PhaseInDate
  125. </if>
  126. <if test=" date3 != null ">
  127. AND T.PhaseOutDate >= #{date3}
  128. </if>
  129. <if test=" date4 != null ">
  130. AND dateadd( DAY, 1, #{date4} ) > RH.PhaseOutDate
  131. </if>
  132. </where>
  133. </select>
  134. </mapper>