O
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.

4338 lines
201 KiB

4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
3 years ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.xujie.sys.modules.pms.mapper.QcMapper">
  4. <!-- ================================================= 检验方法 ================================================= -->
  5. <!-- 条件查询检验方法 -->
  6. <select id="qcMethodSearch" parameterType="com.xujie.sys.modules.pms.data.QcMethodData" resultType="com.xujie.sys.modules.pms.data.QcMethodData">
  7. SELECT
  8. qm.site,
  9. qm.bu_no,
  10. dbo.get_bu_desc(qm.site, qm.bu_no) as buDesc,
  11. qm.method_no,
  12. qm.method_name,
  13. qm.create_date,
  14. qm.create_by,
  15. dbo.getOperatorDesc(qm.site, qm.create_by) as createByDesc,
  16. qm.method_remark,
  17. qm.update_date,
  18. qm.update_by,
  19. dbo.getOperatorDesc(qm.site, qm.update_by) as updateByDesc,
  20. qm.inspection_type_no,
  21. qit.inspection_type_name
  22. FROM qc_method as qm
  23. LEFT JOIN qc_inspection_type as qit on qm.site = qit.site and qm.inspection_type_no = qit.inspection_type_no
  24. <where>
  25. qm.site in (select site from eam_access_site where username = #{query.userName})
  26. and (qm.site + '-' + qm.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  27. <if test="query.buDesc != null and query.buDesc != ''">
  28. AND dbo.get_bu_desc ( qm.site, qm.bu_no ) = #{query.buDesc}
  29. </if>
  30. <if test="query.methodNo != null and query.methodNo != ''">
  31. AND qm.method_no LIKE '%' + #{query.methodNo} +'%'
  32. </if>
  33. <if test="query.methodName != null and query.methodName != ''">
  34. AND qm.method_name LIKE '%' + #{query.methodName} +'%'
  35. </if>
  36. <if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  37. AND qm.inspection_type_no = #{query.inspectionTypeNo}
  38. </if>
  39. </where>
  40. </select>
  41. <!-- 获得检验方法单号 -->
  42. <select id="getMethodNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  43. SELECT
  44. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(method_no,4))),0)+1),4)
  45. FROM qc_method
  46. WHERE site = #{site} AND inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  47. </select>
  48. <!-- 新增检验方法 -->
  49. <insert id="qcMethodSave" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  50. INSERT INTO qc_method (site, bu_no, method_no, method_name, create_date, create_by, method_remark, update_date, update_by, inspection_type_no)
  51. VALUES (#{site}, #{buNo}, #{methodNo}, #{methodName}, GetDate(), #{createBy}, #{methodRemark}, getDate(), #{updateBy}, #{inspectionTypeNo})
  52. </insert>
  53. <!-- 修改检验方法 -->
  54. <update id="qcMethodUpdate" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  55. UPDATE qc_method
  56. SET method_name = #{methodName},
  57. method_remark = #{methodRemark},
  58. update_date = getDate(),
  59. update_by = #{updateBy},
  60. inspection_type_no = #{inspectionTypeNo}
  61. WHERE site = #{site} and method_no = #{methodNo} and bu_no = #{buNo}
  62. </update>
  63. <!-- 检查方法是否在被项目使用 -->
  64. <select id="checkMethodIsUsed" parameterType="com.xujie.sys.modules.pms.data.QcMethodData" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
  65. SELECT
  66. ItemNo
  67. FROM qc_method_item
  68. WHERE site = #{site} and method_no = #{methodNo} and bu_no = #{buNo}
  69. </select>
  70. <!-- 删除检验方法 -->
  71. <delete id="qcMethodDelete" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  72. DELETE FROM qc_method
  73. WHERE site = #{site} and method_no = #{methodNo} and bu_no = #{buNo}
  74. </delete>
  75. <!-- ================================================= 检验项目 ================================================= -->
  76. <!-- 根据条件查询检验项目 -->
  77. <select id="qcItemSearch" parameterType="com.xujie.sys.modules.pms.data.QcItemData" resultType="com.xujie.sys.modules.pms.data.QcItemData">
  78. SELECT
  79. epi.site,
  80. epi.bu_no,
  81. dbo.get_bu_desc(epi.site, epi.bu_no) as buDesc,
  82. epi.ItemNo,
  83. epi.ItemDesc,
  84. epi.DefaultValue,
  85. epi.ValueType,
  86. epi.ValueType_DB as valueTypeDb,
  87. epi.ValueChooseFlag,
  88. epi.CreatedDate,
  89. epi.CreatedBy,
  90. dbo.getOperatorDesc(epi.site, epi.CreatedBy) as createdByDesc,
  91. epi.MaxValue,
  92. epi.MinValue,
  93. epi.ItemRemark,
  94. epi.ItemType,
  95. epi.update_date,
  96. epi.update_by,
  97. dbo.getOperatorDesc(epi.site, epi.update_by) as updateByDesc,
  98. qm.method_no,
  99. qm.method_name,
  100. qm.method_remark,
  101. epi.inspection_type_no,
  102. qit.inspection_type_name,
  103. epi.item_sampling_quantity,
  104. epi.sampling_programme_no,
  105. qsip.sampling_programme_desc,
  106. epi.sampling_level_no,
  107. qsil.sampling_level_desc,
  108. epi.default_sampling_proportion,
  109. epi.collection_flag,
  110. epi.collection_source,
  111. epi.collection_method,
  112. CASE WHEN epi.collection_method = 'plc' THEN 'PLC'
  113. WHEN epi.collection_method = 'file' THEN '文件'
  114. WHEN epi.collection_method = 'image' THEN '图片'
  115. else '' end as collectionMethodDesc,
  116. epi.collection_condition,
  117. epi.collection_data_content
  118. FROM eam_properties_item as epi
  119. LEFT JOIN qc_method_item as qmi on epi.ItemNo = qmi.ItemNo and epi.site = qmi.site and epi.bu_no = qmi.bu_no
  120. LEFT JOIN qc_method as qm on qmi.method_no = qm.method_no and qmi.site = qm.site and qmi.bu_no = qm.bu_no
  121. LEFT JOIN qc_inspection_type as qit on qit.inspection_type_no = epi.inspection_type_no and qit.site = epi.site
  122. left join qc_sampling_inspection_programme as qsip on qsip.site = epi.site and qsip.sampling_programme_no = epi.sampling_programme_no and qsip.bu_no = epi.bu_no
  123. left join qc_sampling_inspection_level as qsil on qsil.site = epi.site and qsil.sampling_level_no = epi.sampling_level_no and qsil.bu_no = epi.bu_no
  124. <where>
  125. epi.site in (select site from eam_access_site where username = #{query.userName})
  126. and (epi.site + '-' + epi.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  127. and epi.ItemType = #{query.itemType}
  128. <if test="query.buDesc != null and query.buDesc != ''">
  129. AND dbo.get_bu_desc ( epi.site, epi.bu_no ) = #{query.buDesc}
  130. </if>
  131. <if test="query.itemDesc != null and query.itemDesc != ''">
  132. AND epi.ItemDesc LIKE '%' + #{query.itemDesc} +'%'
  133. </if>
  134. <if test="query.itemNo != null and query.itemNo != ''">
  135. AND epi.ItemNo LIKE '%' + #{query.itemNo} +'%'
  136. </if>
  137. <if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  138. AND epi.inspection_type_no = #{query.inspectionTypeNo}
  139. </if>
  140. </where>
  141. </select>
  142. <!-- 检测是否存在该项目 -->
  143. <select id="checkQcItem" parameterType="com.xujie.sys.modules.pms.data.QcItemData" resultType="com.xujie.sys.modules.pms.data.QcItemData">
  144. SELECT ItemNo,
  145. ItemDesc
  146. FROM eam_properties_item
  147. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
  148. </select>
  149. <!-- 获得检验项目单号 -->
  150. <select id="getItemNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  151. SELECT
  152. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(ItemNo,4))),0)+1),4)
  153. FROM eam_properties_item
  154. WHERE site = #{site} and ItemType = 'D' and inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  155. </select>
  156. <!-- 新增检验项目 -->
  157. <insert id="qcItemSave" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  158. INSERT INTO eam_properties_item (site, bu_no, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, CreatedDate, CreatedBy, MaxValue, MinValue, ItemRemark, ItemType, update_date, update_by, inspection_type_no, item_sampling_quantity, sampling_programme_no, sampling_level_no, default_sampling_proportion, collection_flag, collection_source, collection_method, collection_condition, collection_data_content)
  159. VALUES (#{site}, #{buNo}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType}, getDate(), #{updateBy}, #{inspectionTypeNo}, #{itemSamplingQuantity}, #{samplingProgrammeNo}, #{samplingLevelNo}, #{defaultSamplingProportion}, #{collectionFlag}, #{collectionSource}, #{collectionMethod}, #{collectionCondition}, #{collectionDataContent})
  160. </insert>
  161. <!-- 新增项目里的方法 -->
  162. <insert id="qcItemMethodSave" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  163. INSERT INTO qc_method_item (ItemNo, method_no, site, bu_no)
  164. VALUES (#{itemNo}, #{methodNo}, #{site}, #{buNo})
  165. </insert>
  166. <!-- 修改检验项目 -->
  167. <update id="qcItemUpdate" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  168. UPDATE eam_properties_item
  169. SET ItemDesc = #{itemDesc},
  170. DefaultValue = #{defaultValue},
  171. ValueType = #{valueType},
  172. ValueType_DB = #{valueTypeDb},
  173. ValueChooseFlag = #{valueChooseFlag},
  174. MaxValue = #{maxValue,jdbcType=DECIMAL},
  175. MinValue = #{minValue,jdbcType=DECIMAL},
  176. ItemRemark = #{itemRemark},
  177. update_date = getDate(),
  178. update_by = #{updateBy},
  179. inspection_type_no = #{inspectionTypeNo},
  180. item_sampling_quantity = #{itemSamplingQuantity},
  181. sampling_programme_no = #{samplingProgrammeNo},
  182. sampling_level_no = #{samplingLevelNo},
  183. default_sampling_proportion = #{defaultSamplingProportion},
  184. collection_flag = #{collectionFlag},
  185. collection_source = #{collectionSource},
  186. collection_method = #{collectionMethod},
  187. collection_condition = #{collectionCondition},
  188. collection_data_content = #{collectionDataContent}
  189. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType} and bu_no = #{buNo}
  190. </update>
  191. <!-- 修改项目中的方法 -->
  192. <update id="qcItemMethodUpdate" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  193. UPDATE qc_method_item
  194. SET method_no = #{methodNo}
  195. WHERE site = #{site} and ItemNo = #{itemNo} and bu_no = #{buNo}
  196. </update>
  197. <!-- 检查项目是否在被模板使用 -->
  198. <select id="checkItemIsUsed" parameterType="com.xujie.sys.modules.pms.data.QcItemData" resultType="EamPropertiesModelDetailData">
  199. SELECT template_id
  200. FROM qc_template_detailed
  201. WHERE site = #{site} and ItemNo = #{itemNo} and bu_no = #{buNo}
  202. </select>
  203. <!-- 删除检验项目 -->
  204. <delete id="qcItemDelete" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  205. DELETE
  206. FROM eam_properties_item
  207. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType} and bu_no = #{buNo}
  208. </delete>
  209. <!-- 删除项目-方法中间表数据 -->
  210. <delete id="qcItemMethodDelete" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  211. DELETE
  212. FROM qc_method_item
  213. WHERE site = #{site} and ItemNo = #{itemNo} and bu_no = #{buNo}
  214. </delete>
  215. <!-- ================================================= 质检员信息维护 ================================================= -->
  216. <!-- 查询质检员信息列表 -->
  217. <select id="inspectorSearch" resultType="com.xujie.sys.modules.pms.data.QcInspectorData">
  218. SELECT inspector_no,
  219. inspector_name,
  220. inspector_phone,
  221. inspector_type,
  222. inspector_active
  223. FROM qc_inspector
  224. </select>
  225. <!-- 检验是否已存在该质检员 -->
  226. <select id="checkInspector" resultType="com.xujie.sys.modules.pms.data.QcInspectorData">
  227. SELECT inspector_name
  228. FROM qc_inspector
  229. WHERE inspector_no = #{inspectorNo}
  230. </select>
  231. <!-- 新增质检员 -->
  232. <insert id="inspectorSave" parameterType="com.xujie.sys.modules.pms.data.QcInspectorData">
  233. INSERT INTO qc_inspector (inspector_no, inspector_name, inspector_phone, inspector_type, inspector_active, create_time)
  234. VALUES (#{inspectorNo}, #{inspectorName}, #{inspectorPhone}, #{inspectorType}, #{inspectorActive}, getDate())
  235. </insert>
  236. <!-- 修改质检员 -->
  237. <update id="inspectorUpdate" parameterType="com.xujie.sys.modules.pms.data.QcInspectorData">
  238. UPDATE qc_inspector
  239. SET inspector_name = #{inspectorName},
  240. inspector_phone = #{inspectorPhone},
  241. inspector_type = #{inspectorType},
  242. inspector_active = #{inspectorActive}
  243. WHERE inspector_no = #{inspectorNo}
  244. </update>
  245. <!-- 删除质检员 -->
  246. <delete id="inspectorDelete" parameterType="com.xujie.sys.modules.pms.data.QcInspectorData">
  247. DELETE FROM qc_inspector
  248. WHERE inspector_no = #{inspectorNo}
  249. </delete>
  250. <!-- ================================================= 抽样矩阵维护 ================================================= -->
  251. <!-- 查询抽样矩阵 -->
  252. <select id="samplingInspectionPlanSearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  253. SELECT
  254. qsip.site,
  255. qsip.bu_no,
  256. dbo.get_bu_desc(qsip.site, qsip.bu_no) as buDesc,
  257. qsip.sampling_plan_no,
  258. qsip.sampling_plan_desc,
  259. qsip.sampling_qty_no,
  260. qsiq.sampling_qty,
  261. qsiq.sampling_qty_desc,
  262. qsip.sampling_qty_rank_no,
  263. qsiqr.sampling_qty_rank_desc,
  264. qsiqr.min_qty,
  265. qsiqr.max_qty,
  266. qsip.sampling_level_no,
  267. qsil.sampling_level_desc,
  268. qsip.sampling_plan_active,
  269. case when qsip.sampling_plan_active = 'Y' then '是' when qsip.sampling_plan_active = 'N' then '否' else '' end as samplingPlanActiveDesc,
  270. qsip.create_date,
  271. qsip.create_by,
  272. dbo.getOperatorDesc(qsip.site, qsip.create_by) as createByDesc,
  273. qsip.update_date,
  274. qsip.update_by,
  275. dbo.getOperatorDesc(qsip.site, qsip.update_by) as updateByDesc
  276. FROM qc_sampling_inspection_plan as qsip
  277. LEFT JOIN qc_sampling_inspection_qty as qsiq ON qsip.sampling_qty_no = qsiq.sampling_qty_no and qsip.site = qsiq.site and qsip.bu_no = qsiq.bu_no
  278. LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr ON qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no and qsip.site = qsiqr.site and qsip.bu_no = qsiqr.bu_no
  279. LEFT JOIN qc_sampling_inspection_level as qsil ON qsip.sampling_level_no = qsil.sampling_level_no and qsip.site = qsil.site and qsip.bu_no = qsil.bu_no
  280. <where>
  281. qsip.site in (select site from eam_access_site where username = #{query.userName})
  282. and (qsip.site + '-' + qsip.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  283. <if test="query.buDesc != null and query.buDesc != ''">
  284. AND dbo.get_bu_desc ( qsip.site, qsip.bu_no ) = #{query.buDesc}
  285. </if>
  286. <if test="query.samplingQtyDesc != null and query.samplingQtyDesc != ''">
  287. AND qsiq.sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc}+'%'
  288. </if>
  289. <if test="query.samplingLevelDesc != null and query.samplingLevelDesc != ''">
  290. AND qsil.sampling_level_desc LIKE '%' + #{query.samplingLevelDesc}+'%'
  291. </if>
  292. <if test="query.samplingPlanActive != null and query.samplingPlanActive != ''">
  293. AND qsip.sampling_plan_active = #{query.samplingPlanActive}
  294. </if>
  295. </where>
  296. </select>
  297. <!-- 根据三个编码查矩阵 -->
  298. <select id="selectSamplingPlanByNo" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  299. SELECT
  300. site,
  301. bu_no,
  302. sampling_plan_no,
  303. sampling_qty_no,
  304. sampling_qty_rank_no,
  305. sampling_level_no,
  306. sampling_plan_active
  307. FROM qc_sampling_inspection_plan
  308. WHERE sampling_qty_no = #{samplingQtyNo} AND sampling_qty_rank_no = #{samplingQtyRankNo} AND sampling_level_no = #{samplingLevelNo} AND site = #{site} and bu_no = #{buNo}
  309. </select>
  310. <!-- 根据名称查矩阵 -->
  311. <select id="selectSamplingPlanByDesc" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  312. SELECT
  313. site,
  314. bu_no,
  315. sampling_plan_no,
  316. sampling_qty_no,
  317. sampling_qty_rank_no,
  318. sampling_level_no,
  319. sampling_plan_active
  320. FROM qc_sampling_inspection_plan
  321. WHERE sampling_plan_desc = #{samplingPlanDesc} AND site = #{site} and bu_no = #{buNo}
  322. </select>
  323. <!-- 获取最大方矩阵编码 -->
  324. <select id="queryLastSamplingPlanNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  325. SELECT top 1 sampling_plan_no
  326. FROM qc_sampling_inspection_plan
  327. where site = #{site} and bu_no = #{buNo}
  328. ORDER BY sampling_plan_no Desc
  329. </select>
  330. <!-- 新增抽样矩阵 -->
  331. <insert id="samplingInspectionPlanSave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  332. INSERT INTO qc_sampling_inspection_plan (site, bu_no, sampling_plan_no, sampling_plan_desc, sampling_qty_rank_no, sampling_level_no, sampling_qty_no, sampling_plan_active, create_date, create_by, update_date, update_by)
  333. VALUES (#{site}, #{buNo}, #{samplingPlanNo}, #{samplingPlanDesc}, #{samplingQtyRankNo}, #{samplingLevelNo}, #{samplingQtyNo}, #{samplingPlanActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  334. </insert>
  335. <!-- 修改抽样矩阵 -->
  336. <update id="samplingInspectionPlanUpdate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  337. UPDATE qc_sampling_inspection_plan
  338. SET sampling_qty_rank_no = #{samplingQtyRankNo},
  339. sampling_level_no = #{samplingLevelNo},
  340. sampling_qty_no = #{samplingQtyNo},
  341. sampling_plan_active = #{samplingPlanActive},
  342. update_date = getDate(),
  343. update_by = #{updateBy}
  344. WHERE sampling_plan_no = #{samplingPlanNo} AND site = #{site} and bu_no = #{buNo}
  345. </update>
  346. <!-- 删除抽样矩阵 -->
  347. <delete id="samplingInspectionPlanDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData">
  348. DELETE FROM qc_sampling_inspection_plan
  349. WHERE sampling_plan_no = #{samplingPlanNo} AND site = #{site} and bu_no = #{buNo}
  350. </delete>
  351. <!-- ================================================= 检验模板维护 ================================================= -->
  352. <!-- 查询模板 -->
  353. <select id="templateSearch" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  354. SELECT
  355. qt.site,
  356. qt.bu_no,
  357. dbo.get_bu_desc(qt.site, qt.bu_no) as buDesc,
  358. qt.template_id,
  359. qt.template_name,
  360. qt.template_remark,
  361. qt.template_type,
  362. qt.template_version,
  363. qt.sampling_programme_no,
  364. qsip.sampling_programme_Desc,
  365. qt.inspection_type_no,
  366. qit.inspection_type_name,
  367. qt.sampling_level_no,
  368. qsil.sampling_level_desc,
  369. qt.inspection_cycle,
  370. qt.create_time,
  371. qt.create_by,
  372. dbo.getOperatorDesc(qt.site, qt.create_by) as createByDesc,
  373. qt.update_date,
  374. qt.update_by,
  375. dbo.getOperatorDesc(qt.site, qt.update_by) as updateByDesc,
  376. qt.AQL,
  377. qt.AC,
  378. qt.RE,
  379. qt.default_sampling_quantity,
  380. qt.default_sampling_proportion
  381. FROM qc_template as qt
  382. LEFT JOIN qc_inspection_type as qit on qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  383. LEFT JOIN qc_sampling_inspection_level as qsil on qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
  384. LEFT JOIN qc_sampling_inspection_programme as qsip on qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
  385. <where>
  386. qt.site in (select site from eam_access_site where username = #{query.userName})
  387. and (qt.site + '-' + qt.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  388. <if test="query.buDesc != null and query.buDesc != ''">
  389. AND dbo.get_bu_desc ( qt.site, qt.bu_no ) = #{query.buDesc}
  390. </if>
  391. <if test = "query.templateId != null and query.templateId != ''">
  392. AND qt.template_id LIKE '%' + #{query.templateId}+'%'
  393. </if>
  394. <if test = "query.templateName != null and query.templateName != ''">
  395. AND qt.template_name LIKE '%' + #{query.templateName}+'%'
  396. </if>
  397. <if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  398. AND qt.inspection_type_no = #{query.inspectionTypeNo}
  399. </if>
  400. </where>
  401. order by qt.create_time desc
  402. </select>
  403. <!-- 获得检验模板单号 -->
  404. <select id="getTemplateNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  405. SELECT
  406. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(template_id,3))),0)+1),3)
  407. FROM qc_template
  408. WHERE site = #{site} and inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  409. </select>
  410. <!-- 新增模板 -->
  411. <insert id="templateSave" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  412. INSERT INTO qc_template (site, bu_no, template_id, template_name, template_version, template_remark, template_type, sampling_programme_no, inspection_type_no, create_time, create_by, sampling_level_no, inspection_cycle, AQL, AC, RE, default_sampling_quantity, default_sampling_proportion, update_date, update_by)
  413. VALUES (#{site}, #{buNo}, #{templateId}, #{templateName},#{templateVersion}, #{templateRemark}, #{templateType}, #{samplingProgrammeNo}, #{inspectionTypeNo}, getDate(), #{createBy}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{aql}, #{ac}, #{re}, #{defaultSamplingQuantity}, #{defaultSamplingProportion}, getDate(), #{updateBy})
  414. </insert>
  415. <!-- 修改模板 -->
  416. <update id="templateUpdate" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  417. UPDATE qc_template
  418. SET template_name = #{templateName},
  419. template_version = #{templateVersion},
  420. template_remark = #{templateRemark},
  421. template_type = #{templateType},
  422. sampling_programme_no = #{samplingProgrammeNo},
  423. inspection_cycle = #{inspectionCycle},
  424. inspection_type_no = #{inspectionTypeNo},
  425. sampling_level_no = #{samplingLevelNo},
  426. AQL = #{aql},
  427. AC = #{ac},
  428. RE = #{re},
  429. default_sampling_quantity = #{defaultSamplingQuantity},
  430. default_sampling_proportion = #{defaultSamplingProportion},
  431. update_date = getDate(),
  432. update_by = #{updateBy}
  433. WHERE template_id = #{templateId} AND site = #{site} and bu_no = #{buNo}
  434. </update>
  435. <!-- 查询模板里的项目详情 -->
  436. <select id="templateDetailsSearch" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  437. SELECT
  438. a.site,
  439. a.bu_no,
  440. a.template_id,
  441. a.ItemNo,
  442. b.ItemDesc,
  443. a.default_value,
  444. b.ValueType,
  445. b.ValueType_DB,
  446. a.max_value,
  447. a.min_value,
  448. b.ItemRemark,
  449. b.ItemType,
  450. a.object_id,
  451. eo.objectDesc,
  452. b.item_sampling_quantity,
  453. b.sampling_programme_no,
  454. c.sampling_programme_desc,
  455. b.sampling_level_no,
  456. d.sampling_level_desc,
  457. b.default_sampling_proportion,a.order_id
  458. FROM qc_template_detailed a
  459. LEFT JOIN eam_properties_item b ON a.ItemNo = b.ItemNo and a.site = b.site and a.bu_no = b.bu_no
  460. left join qc_sampling_inspection_programme as c on b.site = c.site and b.sampling_programme_no = c.sampling_programme_no and b.bu_no = c.bu_no
  461. left join qc_sampling_inspection_level as d on b.site = d.site and b.sampling_level_no = d.sampling_level_no and b.bu_no = d.bu_no
  462. LEFT JOIN eam_object eo ON a.object_id = eo.ObjectID and a.site = b.site and a.bu_no = b.bu_no
  463. WHERE a.template_id = #{templateId} AND b.ItemType = #{itemType} and a.site = #{site} and a.bu_no = #{buNo}
  464. order by order_id,ItemNo
  465. </select>
  466. <!-- 查询模板里是否已存在该项目 -->
  467. <select id="selectItemDetails" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  468. SELECT template_id,
  469. ItemNo,
  470. default_value,
  471. max_value,
  472. min_value
  473. FROM qc_template_detailed
  474. WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site} and bu_no = #{buNo}
  475. </select>
  476. <!-- 查询项目的最大最小值 -->
  477. <select id="selectDetail" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  478. SELECT ItemNo,
  479. DefaultValue,
  480. MaxValue,
  481. MinValue
  482. FROM eam_properties_item
  483. WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} and bu_no = #{buNo}
  484. </select>
  485. <!-- 新增模板的检验项目 -->
  486. <insert id="addItemDetails" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  487. INSERT INTO qc_template_detailed (template_id, ItemNo, default_value, max_value, min_value, site, bu_no,order_id)
  488. VALUES (#{templateId}, #{itemNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{site}, #{buNo},#{orderId})
  489. </insert>
  490. <!-- 删除模板的检验项目 -->
  491. <delete id="delItemDetails" >
  492. DELETE FROM qc_template_detailed
  493. WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site} and bu_no = #{buNo}
  494. </delete>
  495. <!-- 获取当前模板不包含的项目 -->
  496. <select id="getItemList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  497. SELECT
  498. a.site,
  499. a.bu_no,
  500. a.itemNo,
  501. a.ItemDesc,
  502. a.DefaultValue,
  503. a.MaxValue,
  504. a.MinValue
  505. FROM eam_properties_item a
  506. LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site and a.bu_no = b.bu_no
  507. WHERE a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null and a.bu_no = #{buNo} and dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  508. </select>
  509. <!-- 查询项目 -->
  510. <select id="getItem" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  511. SELECT
  512. a.site,
  513. a.bu_no,
  514. a.itemNo,
  515. a.ItemDesc,
  516. a.DefaultValue,
  517. a.MaxValue,
  518. a.MinValue
  519. FROM eam_properties_item a
  520. LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site and a.bu_no = b.bu_no
  521. <where>
  522. a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null and a.bu_no = #{buNo} and dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  523. <if test = "itemNo != null and itemNo != ''">
  524. AND a.ItemNo LIKE '%' + #{itemNo} + '%'
  525. </if>
  526. <if test = "itemDesc != null and itemDesc != ''">
  527. AND a.ItemDesc LIKE '%' + #{itemDesc} + '%'
  528. </if>
  529. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  530. AND a.inspection_type_no = #{inspectionTypeNo}
  531. </if>
  532. </where>
  533. </select>
  534. <!-- 删除模板 -->
  535. <delete id="templateDelete" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  536. DELETE FROM qc_template
  537. WHERE template_id = #{templateId} AND site = #{site} and bu_no = #{buNo}
  538. </delete>
  539. <!-- 删除模板-项目中间表 -->
  540. <delete id="itemItemDelete" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  541. DELETE FROM qc_template_detailed
  542. WHERE template_id = #{templateId} and site = #{site} and bu_no = #{buNo}
  543. </delete>
  544. <!-- 搜索所有检验类型 -->
  545. <select id="inspectionTypeSearch" resultType="com.xujie.sys.modules.pms.data.QcInspectionTypeData" parameterType="com.xujie.sys.modules.pms.data.QcInspectionTypeData">
  546. SELECT inspection_type_no,
  547. inspection_type_name
  548. FROM qc_inspection_type
  549. WHERE site = #{site}
  550. </select>
  551. <!-- 搜索所有设备 -->
  552. <select id="objectSearch" resultType="EamObjectData">
  553. SELECT
  554. ObjectID,
  555. ObjectDesc
  556. FROM eam_object
  557. WHERE Active = 'Y' and site = #{site} and bu_no = #{buNo}
  558. </select>
  559. <!-- 导入文件检验 -->
  560. <select id="getItemByItemNo" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  561. SELECT ItemDesc,
  562. ItemType
  563. FROM eam_properties_item
  564. WHERE ItemDesc = #{itemDesc}
  565. AND DefaultValue = #{defaultValue}
  566. AND MaxValue = #{maxValue}
  567. AND MinValue = #{minValue}
  568. AND ItemType = #{itemType}
  569. </select>
  570. <!-- 新增检验项目 -->
  571. <insert id="insertItem" parameterType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
  572. INSERT INTO eam_properties_item (ItemNo, ItemDesc,DefaultValue,ValueType,ValueType_DB, CreatedDate,CreatedBy,MaxValue, MinValue, ItemRemark,ItemType)
  573. VALUES(#{itemNo},#{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType})
  574. </insert>
  575. <!-- &lt;!&ndash; 获取最大项目编码 &ndash;&gt;-->
  576. <!-- <select id="queryLastItemNo" resultType="string" parameterType="QcItemData">-->
  577. <!-- SELECT top 1 ItemNo-->
  578. <!-- FROM eam_properties_item-->
  579. <!-- WHERE ItemType = #{itemType}-->
  580. <!-- ORDER BY ItemNo Desc-->
  581. <!-- </select>-->
  582. <!-- 根据模板名称查询模板 -->
  583. <select id="selectTemplateByDesc" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  584. SELECT template_id,
  585. template_name,
  586. template_version
  587. FROM qc_template
  588. WHERE template_name = #{templateName}
  589. AND site = #{site}
  590. AND template_version = #{templateVersion}
  591. </select>
  592. <delete id="delTemplateItem" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  593. delete qc_template_detailed
  594. WHERE template_id = #{templateId} and site = #{site} and bu_no = #{buNo}
  595. </delete>
  596. <!-- &lt;!&ndash; 修改项目明细的最大最小值 &ndash;&gt;-->
  597. <!-- <insert id="saveItemDetailed">-->
  598. <!-- INSERT INTO qc_template_detailed-->
  599. <!-- (site, bu_no, template_id, ItemNo, default_value, max_value, min_value)-->
  600. <!-- VALUES-->
  601. <!-- <foreach collection="list" item="item" separator=",">-->
  602. <!-- (#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.maxValue,jdbcType=DECIMAL}, #{item.minValue,jdbcType=DECIMAL})-->
  603. <!-- </foreach>-->
  604. <!-- </insert>-->
  605. <!-- 修改项目明细的最大最小值 -->
  606. <insert id="saveItemDetailed">
  607. INSERT INTO qc_template_detailed
  608. (site, bu_no, template_id, ItemNo, default_value, max_value, min_value, order_id)
  609. VALUES
  610. (#{site}, #{buNo}, #{templateId}, #{itemNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL},#{orderId})
  611. </insert>
  612. <!-- 查询项目明细 -->
  613. <select id="selectItem" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  614. SELECT ItemNo,
  615. ItemDesc,
  616. DefaultValue,
  617. ValueType,
  618. ValueType_DB,
  619. MaxValue,
  620. MinValue,
  621. ItemRemark,
  622. ItemType,
  623. site,
  624. bu_no
  625. FROM eam_properties_item
  626. WHERE ItemNo = #{itemNo} AND ItemType = #{itemType} AND bu_no = #{buNo}
  627. </select>
  628. <!-- ================================================= 样本量维护 ================================================= -->
  629. <!-- 查询样本量 -->
  630. <select id="samplingQtySearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  631. SELECT
  632. site,
  633. bu_no,
  634. dbo.get_bu_desc(site, bu_no) as buDesc,
  635. sampling_qty_no,
  636. sampling_qty_desc,
  637. sampling_qty,
  638. sampling_qty_remark,
  639. sampling_qty_active,
  640. case when sampling_qty_active = 'Y' then '是' when sampling_qty_active = 'N' then '否' else '' end as samplingQtyActiveDesc,
  641. create_date,
  642. create_by,
  643. dbo.getOperatorDesc(site, create_by) as createByDesc,
  644. update_date,
  645. update_by,
  646. dbo.getOperatorDesc(site, update_by) as updateByDesc
  647. FROM qc_sampling_inspection_qty
  648. <where>
  649. site in (select site from eam_access_site where username = #{query.userName})
  650. and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
  651. <if test="query.buDesc != null and query.buDesc != ''">
  652. AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
  653. </if>
  654. <if test="query.samplingQtyNo != null and query.samplingQtyNo != ''">
  655. AND sampling_qty_no LIKE '%' + #{query.samplingQtyNo} + '%'
  656. </if>
  657. <if test="query.samplingQtyDesc != null and query.samplingQtyDesc != ''">
  658. AND sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc} + '%'
  659. </if>
  660. <if test="query.samplingQty != null">
  661. AND sampling_qty = #{query.samplingQty,jdbcType=DECIMAL}
  662. </if>
  663. <if test="query.samplingQtyActive != null and query.samplingQtyActive != ''">
  664. AND sampling_qty_active = #{query.samplingQtyActive}
  665. </if>
  666. </where>
  667. </select>
  668. <!-- 新增样本量 -->
  669. <insert id="samplingQtySave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  670. INSERT INTO qc_sampling_inspection_qty (site, bu_no, sampling_qty_no, sampling_qty, sampling_qty_remark, sampling_qty_active, sampling_qty_desc, create_date, create_by, update_date, update_by)
  671. VALUES(#{site}, #{buNo}, #{samplingQtyNo}, #{samplingQty,jdbcType=DECIMAL}, #{samplingQtyRemark}, #{samplingQtyActive}, #{samplingQtyDesc}, getDate(), #{createBy}, getDate(), #{updateBy})
  672. </insert>
  673. <!-- 根据样本量字码查询样本量 -->
  674. <select id="selectSamplingQtyByDesc" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  675. SELECT
  676. site,
  677. bu_no,
  678. sampling_qty_no,
  679. sampling_qty_desc,
  680. sampling_qty,
  681. sampling_qty_remark,
  682. sampling_qty_active
  683. FROM qc_sampling_inspection_qty
  684. WHERE sampling_qty_desc = #{samplingQtyDesc} AND site = #{site} and bu_no = #{buNo}
  685. </select>
  686. <!-- 获取最大样本量编码 -->
  687. <select id="queryLastSamplingQtyNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  688. SELECT top 1 sampling_qty_no
  689. FROM qc_sampling_inspection_qty
  690. where site = #{site} and bu_no = #{buNo}
  691. ORDER BY sampling_qty_no Desc
  692. </select>
  693. <!-- 修改样本量 -->
  694. <update id="samplingQtyUpdate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  695. UPDATE qc_sampling_inspection_qty
  696. SET sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  697. sampling_qty_desc = #{samplingQtyDesc},
  698. sampling_qty_remark = #{samplingQtyRemark},
  699. sampling_qty_active = #{samplingQtyActive},
  700. update_date = getDate(),
  701. update_by = #{updateBy}
  702. WHERE sampling_qty_no = #{samplingQtyNo} AND site = #{site} and bu_no = #{buNo}
  703. </update>
  704. <!-- 根据样本量编码查询矩阵 -->
  705. <select id="selectSamplingPlanBySamplingQtyNo" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  706. SELECT
  707. site,
  708. sampling_plan_no,
  709. sampling_qty_no,
  710. sampling_qty_rank_no,
  711. sampling_level_no,
  712. sampling_plan_active
  713. FROM qc_sampling_inspection_plan
  714. WHERE site = #{site} AND sampling_qty_no = #{samplingQtyNo} and bu_no = #{buNo}
  715. </select>
  716. <!-- 删除样本量 -->
  717. <delete id="samplingQtyDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyData">
  718. DELETE FROM qc_sampling_inspection_qty
  719. WHERE site = #{site} AND sampling_qty_no = #{samplingQtyNo} AND sampling_qty_desc = #{samplingQtyDesc} and bu_no = #{buNo}
  720. </delete>
  721. <!-- ================================================= 批量级次维护 ================================================= -->
  722. <!-- 查询批量级次 -->
  723. <select id="samplingQtyRankSearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  724. SELECT
  725. site,
  726. bu_no,
  727. dbo.get_bu_desc(site, bu_no) as buDesc,
  728. sampling_qty_rank_no,
  729. sampling_qty_rank_desc,
  730. min_qty,
  731. max_qty,
  732. sampling_qty_rank_active,
  733. case when sampling_qty_rank_active = 'Y' then '是' when sampling_qty_rank_active = 'N' then '否' else '' end as samplingQtyRankActiveDesc,
  734. sampling_qty_rank_Remark,
  735. create_date,
  736. create_by,
  737. dbo.getOperatorDesc(site, create_by) as createByDesc,
  738. update_date,
  739. update_by,
  740. dbo.getOperatorDesc(site, update_by) as updateByDesc
  741. FROM qc_sampling_inspection_qty_rank
  742. <where>
  743. site in (select site from eam_access_site where username = #{query.userName})
  744. and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
  745. <if test="query.buDesc != null and query.buDesc != ''">
  746. AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
  747. </if>
  748. <if test="query.samplingQtyRankNo != null and query.samplingQtyRankNo != ''">
  749. AND sampling_qty_rank_no LIKE '%' + #{query.samplingQtyRankNo}+'%'
  750. </if>
  751. <if test="query.samplingQtyRankDesc != null and query.samplingQtyRankDesc != ''">
  752. AND sampling_qty_rank_desc LIKE '%' + #{query.samplingQtyRankDesc}+'%'
  753. </if>
  754. <if test="query.samplingQtyRankActive != null and query.samplingQtyRankActive != ''">
  755. AND sampling_qty_rank_active = #{query.samplingQtyRankActive}
  756. </if>
  757. </where>
  758. </select>
  759. <!-- 根据名称查询批量级次 -->
  760. <select id="selectSamplingQtyRankByDesc" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  761. SELECT
  762. site,
  763. bu_no,
  764. sampling_qty_rank_no,
  765. sampling_qty_rank_desc,
  766. min_qty,
  767. max_qty,
  768. sampling_qty_rank_active,
  769. sampling_qty_rank_Remark
  770. FROM qc_sampling_inspection_qty_rank
  771. WHERE sampling_qty_rank_desc = #{samplingQtyRankDesc} AND site = #{site} and bu_no = #{buNo}
  772. </select>
  773. <!-- 获取最大批量级次编码 -->
  774. <select id="queryLastSamplingQtyRankNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  775. SELECT top 1 sampling_qty_rank_no
  776. FROM qc_sampling_inspection_qty_rank
  777. where site = #{site} and bu_no = #{buNo}
  778. ORDER BY sampling_qty_rank_no Desc
  779. </select>
  780. <!-- 新增批量级次 -->
  781. <insert id="samplingQtyRankSave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  782. INSERT INTO qc_sampling_inspection_qty_rank (site, bu_no, sampling_qty_rank_no, sampling_qty_rank_desc, min_qty, max_qty, sampling_qty_rank_Remark, sampling_qty_rank_active, create_date, create_by, update_date, update_by)
  783. VALUES(#{site}, #{buNo}, #{samplingQtyRankNo}, #{samplingQtyRankDesc}, #{minQty,jdbcType=DECIMAL}, #{maxQty,jdbcType=DECIMAL}, #{samplingQtyRankRemark}, #{samplingQtyRankActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  784. </insert>
  785. <!-- 根据批量级次编码查询矩阵 -->
  786. <select id="selectSamplingPlanBySamplingQtyRankNo" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  787. SELECT
  788. site,
  789. bu_no,
  790. sampling_plan_no,
  791. sampling_qty_no,
  792. sampling_qty_rank_no,
  793. sampling_level_no,
  794. sampling_plan_active
  795. FROM qc_sampling_inspection_plan
  796. WHERE site = #{site} AND sampling_qty_rank_no = #{samplingQtyRankNo} and bu_no = #{buNo}
  797. </select>
  798. <!-- 修改批量级次 -->
  799. <update id="samplingQtyRankUpdate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  800. UPDATE qc_sampling_inspection_qty_rank
  801. SET sampling_qty_rank_desc = #{samplingQtyRankDesc},
  802. min_qty = #{minQty,jdbcType=DECIMAL},
  803. max_qty = #{maxQty,jdbcType=DECIMAL},
  804. sampling_qty_rank_Remark = #{samplingQtyRankRemark},
  805. sampling_qty_rank_active = #{samplingQtyRankActive},
  806. update_date = getDate(),
  807. update_by = #{updateBy}
  808. WHERE sampling_qty_rank_no = #{samplingQtyRankNo} AND site = #{site} and bu_no = #{buNo}
  809. </update>
  810. <!-- 删除批量级次 -->
  811. <delete id="samplingQtyRankDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionQtyRankData">
  812. DELETE FROM qc_sampling_inspection_qty_rank
  813. WHERE site = #{site} and bu_no = #{buNo}
  814. AND sampling_qty_rank_no = #{samplingQtyRankNo}
  815. AND sampling_qty_rank_desc = #{samplingQtyRankDesc}
  816. </delete>
  817. <!-- ================================================= 检验等级维护 ================================================= -->
  818. <!-- 查询检验等级 -->
  819. <select id="samplingLevelSearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  820. SELECT
  821. site,
  822. bu_no,
  823. dbo.get_bu_desc(site, bu_no) as buDesc,
  824. sampling_level_no,
  825. sampling_level_desc,
  826. sampling_level_remark,
  827. sampling_level_active,
  828. case when sampling_level_active = 'Y' then '是' when sampling_level_active = 'N' then '否' else '' end as samplingLevelActiveDesc,
  829. create_date,
  830. create_by,
  831. dbo.getOperatorDesc(site, create_by) as createByDesc,
  832. update_date,
  833. update_by,
  834. dbo.getOperatorDesc(site, update_by) as updateByDesc
  835. FROM qc_sampling_inspection_level
  836. <where>
  837. site in (select site from eam_access_site where username = #{query.userName})
  838. and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
  839. <if test="query.buDesc != null and query.buDesc != ''">
  840. AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
  841. </if>
  842. <if test="query.samplingLevelNo != null and query.samplingLevelNo != ''">
  843. AND sampling_level_no LIKE '%' + #{query.samplingLevelNo}+'%'
  844. </if>
  845. <if test="query.samplingLevelDesc != null and query.samplingLevelDesc != ''">
  846. AND sampling_level_desc LIKE '%' + #{query.samplingLevelDesc}+'%'
  847. </if>
  848. <if test="query.samplingLevelActive != null and query.samplingLevelActive != ''">
  849. AND sampling_level_active = #{query.samplingLevelActive}
  850. </if>
  851. </where>
  852. </select>
  853. <!-- 根据名称查询检验等级 -->
  854. <select id="selectSamplingLevelByDesc" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  855. SELECT
  856. site,
  857. bu_no,
  858. sampling_level_no,
  859. sampling_level_desc,
  860. sampling_level_remark,
  861. sampling_level_active
  862. FROM qc_sampling_inspection_level
  863. WHERE sampling_level_desc = #{samplingLevelDesc} AND site = #{site} and bu_no = #{buNo}
  864. </select>
  865. <!-- 获取最大检验等级编码 -->
  866. <select id="queryLastSamplingLevelNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  867. SELECT top 1 sampling_level_no
  868. FROM qc_sampling_inspection_level
  869. where site = #{site} and bu_no = #{buNo}
  870. ORDER BY sampling_level_no Desc
  871. </select>
  872. <!-- 新增检验等级 -->
  873. <insert id="samplingLevelSave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  874. INSERT INTO qc_sampling_inspection_level (site, bu_no, sampling_level_no, sampling_level_desc, sampling_level_remark, sampling_level_active, create_date, create_by, update_date, update_by)
  875. VALUES (#{site}, #{buNo}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingLevelRemark}, #{samplingLevelActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  876. </insert>
  877. <!-- 根据检验等级编码查询矩阵 -->
  878. <select id="selectSamplingPlanBySamplingLevelNo" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  879. SELECT
  880. site,
  881. bu_no,
  882. sampling_plan_no,
  883. sampling_qty_no,
  884. sampling_qty_rank_no,
  885. sampling_level_no,
  886. sampling_plan_active
  887. FROM qc_sampling_inspection_plan
  888. WHERE site = #{site} and bu_no = #{buNo}
  889. AND sampling_level_no = #{samplingLevelNo}
  890. </select>
  891. <!-- 修改检验等级 -->
  892. <update id="samplingLevelUpdate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  893. UPDATE qc_sampling_inspection_level
  894. SET sampling_level_desc = #{samplingLevelDesc},
  895. sampling_level_remark = #{samplingLevelRemark},
  896. sampling_level_active = #{samplingLevelActive},
  897. update_date = getDate(),
  898. update_by = #{updateBy}
  899. WHERE sampling_level_no = #{samplingLevelNo}
  900. AND site = #{site} and bu_no = #{buNo}
  901. </update>
  902. <!-- 删除检验等级 -->
  903. <delete id="samplingLevelDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionLevelData">
  904. DELETE FROM qc_sampling_inspection_level
  905. WHERE site = #{site} and bu_no = #{buNo}
  906. AND sampling_level_no = #{samplingLevelNo}
  907. AND sampling_level_desc = #{samplingLevelDesc}
  908. </delete>
  909. <!-- ================================================= 物料属性设置维护 ================================================= -->
  910. <!-- 查询物料属性 -->
  911. <select id="qcPartAttributeSearch" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  912. SELECT
  913. qa.site,
  914. qa.bu_no,
  915. dbo.get_bu_desc(qa.site, qa.bu_no) as buDesc,
  916. p.part_no as partNo,
  917. p.part_desc,
  918. p.cinv_source_code as cinvSourceCode,
  919. p.sku as sku,
  920. p.FamilyID,
  921. p.invtype as familyName,
  922. p.spec,
  923. p.umid,
  924. qa.supplier_no,
  925. dbo.qc_get_supplier_name(qa.site, qa.supplier_no) as supplierDesc,
  926. qa.attribute_remark,
  927. qa.create_time,
  928. qa.create_by,
  929. dbo.getOperatorDesc(qa.site, qa.create_by) as createByDesc,
  930. qa.attribute_type,
  931. qa.update_date,
  932. qa.update_by,
  933. dbo.getOperatorDesc(qa.site, qa.update_by) as updateByDesc,
  934. qa.exempt_inspection
  935. FROM qc_part_attribute qa
  936. LEFT JOIN part p on qa.attribute_no = p.part_no and qa.site = p.site
  937. <where>
  938. qa.site in (select site from eam_access_site where username = #{query.userName})
  939. and (qa.site + '-' + qa.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  940. and qa.attribute_type = #{query.attributeType}
  941. <if test="query.buDesc != null and query.buDesc != ''">
  942. AND dbo.get_bu_desc ( qa.site, qa.bu_no ) = #{query.buDesc}
  943. </if>
  944. <if test = "query.partNo != null and query.partNo != ''">
  945. AND qa.attribute_no LIKE '%' + #{query.partNo}+'%'
  946. </if>
  947. <if test = "query.partDesc != null and query.partDesc != ''">
  948. AND p.part_desc LIKE '%' + #{query.partDesc}+'%'
  949. </if>
  950. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  951. AND p.cinv_source_code LIKE '%' + #{query.cinvSourceCode}+'%'
  952. </if>
  953. <if test = "query.sku != null and query.sku != ''">
  954. AND p.sku LIKE '%' + #{query.sku}+'%'
  955. </if>
  956. <if test = "query.familyName != null and query.familyName != ''">
  957. AND p.invtype LIKE '%' + #{query.familyName}+'%'
  958. </if>
  959. </where>
  960. </select>
  961. <!-- 查询是否已有该物料属性 -->
  962. <select id="selectPartAttributeByNo" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  963. SELECT
  964. attribute_no,
  965. supplier_no,
  966. attribute_remark,
  967. attribute_type
  968. FROM qc_part_attribute
  969. WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  970. </select>
  971. <!-- 新增物料属性 -->
  972. <insert id="qcPartAttributeSave" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  973. INSERT INTO qc_part_attribute (attribute_no, supplier_no, attribute_remark, create_time, create_by, attribute_type, site, exempt_inspection, bu_no)
  974. VALUES(#{partNo}, #{supplierNo}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{exemptInspection}, #{buNo})
  975. </insert>
  976. <!-- 物料属性修改 -->
  977. <update id="qcPartAttributeEdit" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  978. UPDATE qc_part_attribute
  979. SET attribute_remark = #{attributeRemark},
  980. exempt_inspection = #{exemptInspection},
  981. update_date = getDate(),
  982. update_by = #{updateBy}
  983. WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  984. </update>
  985. <!-- 删除物料属性 -->
  986. <delete id="qcPartAttributeDelete" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  987. DELETE FROM qc_part_attribute
  988. WHERE site = #{site} and bu_no = #{buNo} and attribute_no = #{partNo} and attribute_type = #{attributeType}
  989. </delete>
  990. <!-- 删除物料属性模板 -->
  991. <delete id="deletePartAttributeTemplate" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  992. DELETE FROM qc_attribute_template
  993. WHERE site = #{site} and bu_no = #{buNo} and attribute_no = #{partNo} and attribute_type = #{attributeType}
  994. </delete>
  995. <!-- 查询类别模板 -->
  996. <select id="searchPartAttributeDetails" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  997. SELECT
  998. qat.site,
  999. qat.bu_no,
  1000. qpa.attribute_no,
  1001. qpa.attribute_type,
  1002. qt.template_id,
  1003. qt.template_name,
  1004. qt.template_remark,
  1005. qt.template_version,
  1006. qat.sampling_programme_no,
  1007. qsip.sampling_programme_desc,
  1008. qat.AQL,
  1009. qat.AC,
  1010. qat.RE,
  1011. qt.inspection_type_no,
  1012. qit.inspection_type_name,
  1013. qt.default_sampling_quantity,
  1014. qt.default_sampling_proportion,
  1015. qat.sampling_level_no,
  1016. qsil.sampling_level_desc,
  1017. qat.inspection_cycle,
  1018. qat.operation,
  1019. qat.manufacturer_id,
  1020. dbo.qc_get_supplier_name(qat.site, qat.manufacturer_id) as manufacturerName,
  1021. qat.resource_id
  1022. FROM qc_attribute_template as qat
  1023. LEFT JOIN qc_part_attribute as qpa ON qpa.attribute_no = qat.attribute_no and qat.site = qpa.site and qat.bu_no = qpa.bu_no
  1024. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1025. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1026. LEFT JOIN qc_inspection_type as qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1027. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1028. <where>
  1029. qat.site = #{site} and qpa.attribute_type = #{attributeType} and qpa.attribute_no = #{attributeNo} and qat.bu_no = #{buNo}
  1030. <if test="inspectionTypeNo !=null and inspectionTypeNo != ''">
  1031. and qt.inspection_type_no = #{inspectionTypeNo}
  1032. </if>
  1033. </where>
  1034. </select>
  1035. <!-- 物料属性模板查重 -->
  1036. <select id="searchPartRepeat" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1037. SELECT
  1038. attribute_no,
  1039. template_id
  1040. FROM qc_attribute_template
  1041. WHERE attribute_no = #{attributeNo}
  1042. AND template_id = #{templateId}
  1043. AND attribute_type = #{attributeType}
  1044. AND special_field = #{specialField}
  1045. </select>
  1046. <!-- 新增物料属性模板 -->
  1047. <insert id="savePartAttributeDetails" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1048. INSERT INTO qc_attribute_template
  1049. (attribute_no, template_id, sampling_level_no, inspection_cycle, sampling_programme_no, AQL, AC, RE,
  1050. attribute_type, operation, manufacturer_id, resource_id, site, bu_no, inspection_type_no)
  1051. VALUES
  1052. (#{attributeNo}, #{templateId}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{samplingProgrammeNo}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  1053. #{attributeType}, #{operation}, #{manufacturerID}, #{resourceID}, #{site}, #{buNo}, #{inspectionTypeNo})
  1054. </insert>
  1055. <!-- 可选模板 -->
  1056. <select id="getTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1057. SELECT
  1058. qt.template_id,
  1059. qt.template_name,
  1060. qit.inspection_type_name
  1061. FROM qc_template as qt
  1062. LEFT JOIN qc_attribute_template as qat ON qat.template_id = qt.template_id and qat.attribute_no = #{attributeNo}
  1063. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
  1064. <where>
  1065. qt.site = #{site}
  1066. AND qat.attribute_no is null
  1067. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1068. AND qt.inspection_type_no = #{inspectionTypeNo}
  1069. </if>
  1070. <if test = "templateId != null and templateId != ''">
  1071. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1072. </if>
  1073. <if test = "templateName != null and templateName != ''">
  1074. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1075. </if>
  1076. </where>
  1077. </select>
  1078. <!-- 已有模板 -->
  1079. <select id="getPartTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1080. SELECT
  1081. qt.template_id,
  1082. qt.template_name,
  1083. qit.inspection_type_name,
  1084. qat.operation,
  1085. qat.manufacturer_id,
  1086. dbo.qc_get_supplier_name(qt.site, qat.manufacturer_id) as manufacturerName,
  1087. qat.resource_id
  1088. FROM qc_attribute_template as qat
  1089. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1090. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1091. WHERE qt.site = #{site} AND qat.attribute_no = #{attributeNo} and qt.bu_no = #{buNo}
  1092. </select>
  1093. <!-- 物料可选模板 -->
  1094. <select id="getTemplateListAll" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1095. SELECT
  1096. qt.template_id,
  1097. qt.template_name,
  1098. qit.inspection_type_name
  1099. FROM qc_template as qt
  1100. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1101. <where>
  1102. qt.site = #{site} and qt.bu_no = #{buNo}
  1103. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1104. AND qt.inspection_type_no = #{inspectionTypeNo}
  1105. </if>
  1106. <if test = "templateId != null and templateId != ''">
  1107. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1108. </if>
  1109. <if test = "templateName != null and templateName != ''">
  1110. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1111. </if>
  1112. </where>
  1113. </select>
  1114. <!-- 删除物料属性模板 -->
  1115. <delete id="deletePartAttributeDetails" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1116. DELETE FROM qc_attribute_template
  1117. <where>
  1118. site = #{site} and bu_no = #{buNo} and attribute_no = #{attributeNo} and template_id = #{templateId} and attribute_type = #{attributeType}
  1119. <if test = "operation != null and operation != ''">
  1120. and operation = #{operation}
  1121. </if>
  1122. <if test = "resourceID != null and resourceID != ''">
  1123. and resource_id = #{resourceID}
  1124. </if>
  1125. <if test = "manufacturerID != null and manufacturerID != ''">
  1126. and manufacturer_id = #{manufacturerID}
  1127. </if>
  1128. </where>
  1129. </delete>
  1130. <!-- 查询模板的基础数据 -->
  1131. <select id="selectTemplateData" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1132. SELECT
  1133. template_id,
  1134. template_name,
  1135. sampling_programme_no,
  1136. sampling_level_no,
  1137. inspection_cycle,
  1138. AQL,
  1139. AC,
  1140. RE,
  1141. inspection_type_no
  1142. FROM qc_template
  1143. WHERE site = #{site} AND template_id = #{templateId} and bu_no = #{buNo}
  1144. </select>
  1145. <!-- 新增物料属性模板详情 -->
  1146. <update id="saveAttributeDetailed" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1147. UPDATE qc_attribute_template
  1148. SET sampling_level_no = #{samplingLevelNo},
  1149. inspection_cycle = #{inspectionCycle,jdbcType=DECIMAL},
  1150. sampling_programme_no = #{samplingProgrammeNo},
  1151. AQL = #{aql,jdbcType=DECIMAL},
  1152. AC = #{ac,jdbcType=DECIMAL},
  1153. RE = #{re,jdbcType=DECIMAL}
  1154. <where>
  1155. site = #{site} and attribute_no = #{attributeNo} AND template_id = #{templateId} AND attribute_type = #{attributeType} and bu_no = #{buNo}
  1156. <if test = "operation != null and operation != ''">
  1157. AND operation = #{operation}
  1158. </if>
  1159. <if test = "resourceID != null and resourceID != ''">
  1160. AND resource_id = #{resourceID}
  1161. </if>
  1162. <if test = "manufacturerID != null and manufacturerID != ''">
  1163. AND manufacturer_id = #{manufacturerID}
  1164. </if>
  1165. </where>
  1166. </update>
  1167. <!-- 更新物料属性修改时间 -->
  1168. <update id="updatePartAttributeTime" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1169. UPDATE qc_part_attribute
  1170. SET update_date = getDate(),
  1171. update_by = #{updateBy}
  1172. WHERE site = #{site} and attribute_no = #{attributeNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1173. </update>
  1174. <!-- ================================================= 类别属性设置维护 ================================================= -->
  1175. <!-- 查询类别属性 -->
  1176. <select id="qcFamilyAttributeSearch" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1177. SELECT
  1178. qa.site,
  1179. qa.bu_no,
  1180. dbo.get_bu_desc(qa.site, qa.bu_no) as buDesc,
  1181. qa.attribute_no as familyID,
  1182. pf.FamilyName,
  1183. qa.supplier_no,
  1184. qa.attribute_remark,
  1185. qa.create_time,
  1186. qa.create_by,
  1187. qa.update_date,
  1188. qa.update_by,
  1189. qa.attribute_type
  1190. FROM qc_part_attribute as qa
  1191. LEFT JOIN PartFamily as pf on qa.attribute_no = pf.FamilyID and qa.site = pf.site
  1192. <where>
  1193. qa.site in (select site from eam_access_site where username = #{query.userName})
  1194. and (qa.site + '-' + qa.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1195. and qa.attribute_type = #{query.attributeType}
  1196. <if test="query.buDesc != null and query.buDesc != ''">
  1197. AND dbo.get_bu_desc ( qa.site, qa.bu_no ) = #{query.buDesc}
  1198. </if>
  1199. <if test = "query.familyID != null and query.familyID != ''">
  1200. AND qa.attribute_no LIKE '%' + #{query.familyID}+'%'
  1201. </if>
  1202. <if test = "query.familyName != null and query.familyName != ''">
  1203. AND pf.FamilyName LIKE '%' + #{query.familyName}+'%'
  1204. </if>
  1205. </where>
  1206. </select>
  1207. <!-- 新增类别属性 -->
  1208. <insert id="qcFamilyAttributeSave" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1209. INSERT INTO qc_part_attribute (attribute_no, attribute_remark, create_time, create_by, attribute_type, site, bu_no)
  1210. VALUES(#{familyID}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{buNo})
  1211. </insert>
  1212. <!-- 删除分类属性 -->
  1213. <delete id="qcFamilyAttributeDelete" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1214. DELETE FROM qc_part_attribute
  1215. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1216. </delete>
  1217. <!-- 删除分类属性模板 -->
  1218. <delete id="deleteFamilyAttributeTemplate" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1219. DELETE FROM qc_attribute_template
  1220. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1221. </delete>
  1222. <!-- ================================================= 抽样方案维护 ================================================= -->
  1223. <!-- 查询类别属性 -->
  1224. <select id="samplingProgrammeSearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1225. SELECT
  1226. site,
  1227. bu_no,
  1228. dbo.get_bu_desc(site, bu_no) as buDesc,
  1229. sampling_programme_no,
  1230. sampling_programme_desc,
  1231. sampling_programme_code,
  1232. create_time,
  1233. create_by,
  1234. dbo.getOperatorDesc(site, create_by) as createByDesc,
  1235. update_date,
  1236. update_by,
  1237. dbo.getOperatorDesc(site, update_by) as updateByDesc
  1238. FROM qc_sampling_inspection_programme
  1239. <where>
  1240. site in (select site from eam_access_site where username = #{query.userName})
  1241. and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1242. <if test="query.buDesc != null and query.buDesc != ''">
  1243. AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
  1244. </if>
  1245. <if test = "query.samplingProgrammeNo != null and query.samplingProgrammeNo != ''">
  1246. AND sampling_programme_no LIKE '%' + #{query.samplingProgrammeNo}+'%'
  1247. </if>
  1248. <if test = "query.samplingProgrammeCode != null and query.samplingProgrammeCode != ''">
  1249. AND sampling_programme_code LIKE '%' + #{query.samplingProgrammeCode}+'%'
  1250. </if>
  1251. <if test = "query.samplingProgrammeDesc != null and query.samplingProgrammeDesc != ''">
  1252. AND sampling_programme_desc LIKE '%' + #{query.samplingProgrammeDesc}+'%'
  1253. </if>
  1254. </where>
  1255. </select>
  1256. <!-- 新增抽样方案 -->
  1257. <insert id="samplingProgrammeSave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1258. INSERT INTO qc_sampling_inspection_programme (site, bu_no, sampling_programme_no, sampling_programme_desc, sampling_programme_code, create_time, create_by, update_date, update_by)
  1259. VALUES(#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{samplingProgrammeCode}, getDate(), #{createBy}, getDate(), #{updateBy})
  1260. </insert>
  1261. <!-- 删除抽样方案 -->
  1262. <delete id="samplingProgrammeDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1263. DELETE FROM qc_sampling_inspection_programme
  1264. WHERE site = #{site} and bu_no = #{buNo}
  1265. AND sampling_programme_no = #{samplingProgrammeNo}
  1266. </delete>
  1267. <!-- 删除抽样方案中的矩阵 -->
  1268. <delete id="deletePlanByProgrammeNo" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1269. DELETE FROM qc_programme_plan
  1270. WHERE sampling_programme_no = #{samplingProgrammeNo} and site = #{site} and bu_no = #{buNo}
  1271. </delete>
  1272. <!-- 根据名称查询抽样方案 -->
  1273. <select id="selectSamplingProgrammeByDesc" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1274. SELECT
  1275. site,
  1276. bu_no,
  1277. sampling_programme_no,
  1278. sampling_programme_desc
  1279. FROM qc_sampling_inspection_programme
  1280. WHERE sampling_programme_desc = #{samplingProgrammeDesc} AND site = #{site} and bu_no = #{buNo}
  1281. </select>
  1282. <!-- 获取最大抽样方案编码 -->
  1283. <select id="queryLastSamplingProgrammeNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1284. SELECT top 1 sampling_programme_no
  1285. FROM qc_sampling_inspection_programme
  1286. where site = #{site} and bu_no = #{buNo}
  1287. ORDER BY sampling_programme_no Desc
  1288. </select>
  1289. <!-- 搜索抽样方案中的矩阵 -->
  1290. <select id="searchSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1291. SELECT
  1292. qpp.site,
  1293. qpp.bu_no,
  1294. qpp.sampling_programme_no,
  1295. qsip.sampling_plan_no,
  1296. qsip.sampling_plan_Desc,
  1297. qsip.sampling_qty_no,
  1298. qsiq.sampling_qty_desc,
  1299. qsiq.sampling_qty,
  1300. qsip.sampling_qty_rank_no,
  1301. qsiqr.sampling_qty_rank_desc,
  1302. qsiqr.min_qty,
  1303. qsiqr.max_qty,
  1304. qsip.sampling_level_no,
  1305. qsil.sampling_level_desc,
  1306. qsip.sampling_plan_active
  1307. FROM qc_programme_plan as qpp
  1308. LEFT JOIN qc_sampling_inspection_plan as qsip on qpp.sampling_plan_no = qsip.sampling_plan_no and qpp.site = qsip.site and qpp.bu_no = qsip.bu_no
  1309. LEFT JOIN qc_sampling_inspection_qty as qsiq on qsip.sampling_qty_no = qsiq.sampling_qty_no and qsip.site = qsiq.site and qsip.bu_no = qsiq.bu_no
  1310. LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr on qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no and qsip.site = qsiqr.site and qsip.bu_no = qsiqr.bu_no
  1311. LEFT JOIN qc_sampling_inspection_level as qsil on qsip.sampling_level_no = qsil.sampling_level_no and qsip.site = qsil.site and qsip.bu_no = qsil.bu_no
  1312. WHERE qpp.sampling_programme_no = #{samplingProgrammeNo} and qpp.site = #{site} and qpp.bu_no = #{buNo}
  1313. </select>
  1314. <!-- 获取该方案不包含的矩阵 -->
  1315. <select id="getPlanList" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1316. SELECT
  1317. qip.sampling_plan_no,
  1318. qip.sampling_plan_desc
  1319. FROM qc_sampling_inspection_plan as qip
  1320. LEFT JOIN qc_programme_plan as qpp ON qpp.sampling_plan_no = qip.sampling_plan_no and qpp.sampling_programme_no = #{samplingProgrammeNo} and qpp.site = qip.site and qpp.bu_no = qip.bu_no
  1321. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no is null
  1322. </select>
  1323. <!-- 获取当前方案所包含的矩阵 -->
  1324. <select id="getProgrammePlanList" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1325. SELECT
  1326. qip.sampling_plan_no,
  1327. qip.sampling_plan_desc
  1328. FROM qc_programme_plan as qpp
  1329. LEFT JOIN qc_sampling_inspection_plan as qip ON qpp.sampling_plan_no = qip.sampling_plan_no and qpp.site = qip.site and qpp.bu_no = qip.bu_no
  1330. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no = #{samplingProgrammeNo}
  1331. </select>
  1332. <!-- 查重 -->
  1333. <select id="searchPlanRepeat" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1334. SELECT
  1335. sampling_plan_no,
  1336. sampling_programme_no
  1337. FROM qc_programme_plan
  1338. WHERE sampling_programme_no = #{samplingProgrammeNo} AND sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1339. </select>
  1340. <!-- 新增抽样方案中的矩阵 -->
  1341. <insert id="saveSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1342. INSERT INTO qc_programme_plan (site, bu_no, sampling_programme_no, sampling_plan_no)
  1343. VALUES (#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingPlanNo})
  1344. </insert>
  1345. <!-- 更新抽样方案修改时间 -->
  1346. <update id="updateSamplingInspectionProgrammeDate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1347. UPDATE qc_sampling_inspection_programme
  1348. SET update_date = getDate(),
  1349. update_by = #{updateBy}
  1350. WHERE site = #{site} AND sampling_programme_no = #{samplingProgrammeNo} and bu_no = #{buNo}
  1351. </update>
  1352. <!-- 删除抽样方案中的矩阵 -->
  1353. <delete id="deleteSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1354. DELETE FROM qc_programme_plan
  1355. WHERE sampling_programme_no = #{samplingProgrammeNo} and sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1356. </delete>
  1357. <!-- ================================================= FAI检验维护 ================================================= -->
  1358. <!-- 查询FAI基础数据 -->
  1359. <select id="selectFAIBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1360. SELECT
  1361. top 1
  1362. a.orderno as orderNo,
  1363. j.part_no,
  1364. j.part_desc,
  1365. c.operation_desc,
  1366. b.approve_qty as rollQty,
  1367. a.s_resourceid as resourceId,
  1368. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  1369. a.itemno as itemNo,
  1370. a.id as ssrId
  1371. FROM soscheduledrouting as a
  1372. LEFT JOIN sfdc as b
  1373. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  1374. select min(sfdc.id)
  1375. from sfdc
  1376. group by sfdc.assjob_seq_no, site
  1377. )
  1378. LEFT JOIN so_routing as c
  1379. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  1380. LEFT JOIN part j
  1381. ON a.site = j.site and a.part_no = j.part_no
  1382. WHERE a.itemno = '10'
  1383. AND a.id not in (select ssr_id from qc_fai_record)
  1384. AND b.approve_qty is not null
  1385. ORDER BY a.id desc
  1386. </select>
  1387. <!-- 获取该物料属性下维护的iqc -->
  1388. <select id="selectPartAttributeByPartNo" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1389. SELECT
  1390. qat.site,
  1391. qat.bu_no,
  1392. qat.attribute_no,
  1393. qat.template_id,
  1394. qat.sampling_level_no,
  1395. qsil.sampling_level_desc,
  1396. qat.inspection_cycle,
  1397. qat.sampling_programme_no,
  1398. qsip.sampling_programme_desc,
  1399. qat.AQL,
  1400. qat.AC,
  1401. qat.RE,
  1402. qt.default_sampling_quantity,
  1403. qt.default_sampling_proportion
  1404. FROM qc_attribute_template as qat
  1405. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1406. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1407. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1408. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1409. AND qat.attribute_no = #{partNo}
  1410. AND qat.attribute_type = #{attributeType}
  1411. AND qt.inspection_type_no = #{inspectionTypeNo}
  1412. AND qat.manufacturer_id = #{supplierNo}
  1413. </select>
  1414. <!-- 获取该物料属性下维护的ipqc -->
  1415. <select id="selectPartAttributeByOperationAndResource" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1416. SELECT
  1417. qat.site,
  1418. qat.bu_no,
  1419. qat.attribute_no,
  1420. qat.template_id,
  1421. qat.sampling_level_no,
  1422. qsil.sampling_level_desc,
  1423. qat.inspection_cycle,
  1424. qat.sampling_programme_no,
  1425. qsip.sampling_programme_desc,
  1426. qat.AQL,
  1427. qat.AC,
  1428. qat.RE,
  1429. qt.default_sampling_quantity,
  1430. qt.default_sampling_proportion
  1431. FROM qc_attribute_template as qat
  1432. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1433. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1434. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1435. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1436. AND qat.attribute_no = #{partNo}
  1437. AND qat.attribute_type = #{attributeType1}
  1438. AND qt.inspection_type_no = #{inspectionTypeNo}
  1439. AND qat.operation = #{operationDesc}
  1440. AND qat.resource_id = #{resourceId}
  1441. </select>
  1442. <!-- 获取模板详情 -->
  1443. <select id="selectTemplate" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1444. SELECT
  1445. qt.site,
  1446. qt.bu_no,
  1447. qt.template_id,
  1448. qt.sampling_level_no,
  1449. qsil.sampling_level_desc,
  1450. qt.inspection_cycle,
  1451. qt.sampling_programme_no,
  1452. qsip.sampling_programme_desc,
  1453. qt.AQL,
  1454. qt.AC,
  1455. qt.RE,
  1456. qt.default_sampling_quantity,
  1457. qt.default_sampling_proportion
  1458. FROM qc_template as qt
  1459. LEFT JOIN qc_sampling_inspection_level as qsil ON qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
  1460. LEFT JOIN qc_sampling_inspection_programme as qsip ON qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
  1461. WHERE qt.site = #{site} and qt.template_id = #{templateId} and qt.bu_no = #{buNo}
  1462. </select>
  1463. <!-- 新增FAI主记录信息 -->
  1464. <insert id="saveFAIRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1465. INSERT INTO qc_fai_record (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  1466. VALUES(#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  1467. </insert>
  1468. <insert id="saveFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1469. INSERT INTO qc_fai_detailed_record
  1470. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1471. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1472. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  1473. VALUES
  1474. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  1475. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  1476. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  1477. </insert>
  1478. <!-- 新增FAI明细记录信息 -->
  1479. <insert id="saveFAIDetailedRecords">
  1480. INSERT INTO qc_fai_detailed_record
  1481. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1482. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1483. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  1484. VALUES
  1485. <foreach collection="list" item="item" separator=",">
  1486. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  1487. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  1488. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  1489. </foreach>
  1490. </insert>
  1491. <!-- 查询FAI主记录信息 -->
  1492. <select id="qcFAIInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1493. SELECT
  1494. a.inspection_no,
  1495. a.site,
  1496. a.bu_no,
  1497. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  1498. a.state,
  1499. a.inspection_result,
  1500. a.task_date,
  1501. a.inspection_type_no,
  1502. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  1503. a.inspection_cycle,
  1504. a.order_no,
  1505. a.operation_desc,
  1506. a.resource_id,
  1507. r.resource_desc,
  1508. a.part_no,
  1509. d.part_desc,
  1510. d.cinv_source_code as cinvSourceCode,
  1511. d.sku as sku,
  1512. d.invdefinetype as invdefinetype,
  1513. a.inspection_remark,
  1514. a.roll_qty,
  1515. a.sampling_qty,
  1516. a.disposal_measures,
  1517. a.disposal_remark,
  1518. a.inspector_date,
  1519. a.inspector_no,
  1520. u.user_display as inspectorName,
  1521. a.ssr_id,
  1522. a.unqualified_qty,
  1523. a.submit_flag,
  1524. a.seq_no,
  1525. a.batch_roll_no,
  1526. a.special_requirements,
  1527. a.work_center_no,
  1528. a.roll_no,
  1529. a.um_id,
  1530. um.UMName as umName,
  1531. a.action_date,
  1532. a.action_by,
  1533. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  1534. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  1535. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  1536. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  1537. a.pass_qty,
  1538. a.not_pass_qty,
  1539. a.batch_qualified_qty
  1540. FROM qc_fai_record as a
  1541. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  1542. left join sys_user as u on a.inspector_no = u.username
  1543. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  1544. left join UM as um on a.site = um.site and a.um_id = um.UMID
  1545. <where>
  1546. a.site in (select site from eam_access_site where username = #{query.userName})
  1547. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1548. <if test="query.buNo != null and query.buNo != ''">
  1549. AND a.bu_no = #{query.buNo}
  1550. </if>
  1551. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  1552. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  1553. </if>
  1554. <if test = "query.partNo != null and query.partNo != ''">
  1555. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  1556. </if>
  1557. <if test = "query.partDesc != null and query.partDesc != ''">
  1558. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  1559. </if>
  1560. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  1561. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  1562. </if>
  1563. <if test = "query.sku != null and query.sku != ''">
  1564. AND d.sku LIKE '%' + #{query.sku} + '%'
  1565. </if>
  1566. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  1567. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  1568. </if>
  1569. <if test = "query.states != null and query.states.size > 0">
  1570. AND a.state in
  1571. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  1572. #{item}
  1573. </foreach>
  1574. </if>
  1575. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  1576. AND a.inspection_result = #{query.inspectionResult}
  1577. </if>
  1578. <if test = "query.orderNo != null and query.orderNo != ''">
  1579. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  1580. </if>
  1581. <if test = "query.seqNo != null and query.seqNo != ''">
  1582. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  1583. </if>
  1584. <if test = "query.operationDesc != null and query.operationDesc != ''">
  1585. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  1586. </if>
  1587. <if test="query.startDate != null">
  1588. AND a.inspector_date >= #{query.startDate}
  1589. </if>
  1590. <if test="query.endDate != null">
  1591. AND #{query.endDate} >= a.inspector_date
  1592. </if>
  1593. <if test="query.startDate2 != null">
  1594. AND a.task_date >= #{query.startDate2}
  1595. </if>
  1596. <if test="query.endDate2 != null">
  1597. AND #{query.endDate2} >= a.task_date
  1598. </if>
  1599. </where>
  1600. ORDER BY
  1601. CASE WHEN a.state = '待检验' THEN 1
  1602. WHEN a.state = '待审核' THEN 2
  1603. WHEN a.state = '已完成' THEN 3
  1604. END, a.task_date desc
  1605. </select>
  1606. <!-- 获取物料的类别编码 -->
  1607. <select id="selectFamilyIdByPartNo" parameterType="string" resultType="string">
  1608. SELECT FamilyID
  1609. FROM part
  1610. WHERE part_no = #{partNo} AND site = #{site}
  1611. </select>
  1612. <!-- FAI明细记录查询 -->
  1613. <select id="faiDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1614. SELECT
  1615. a.site,
  1616. a.bu_no,
  1617. a.inspection_no,
  1618. a.order_no,
  1619. a.template_id,
  1620. a.sampling_level_no,
  1621. a.sampling_level_desc,
  1622. a.sampling_programme_no,
  1623. a.sampling_programme_desc,
  1624. a.AQL,
  1625. a.AC,
  1626. a.RE,
  1627. a.item_no,
  1628. a.item_desc,
  1629. a.object_id,
  1630. a.object_desc,
  1631. a.default_value,
  1632. a.min_value,
  1633. a.max_value,
  1634. a.text_value,
  1635. a.number_value,
  1636. a.value_type_db,
  1637. a.value_type,
  1638. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  1639. a.is_submit,
  1640. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  1641. a.sampling_qty,
  1642. dbo.qc_get_fai_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  1643. c.method_no,
  1644. c.method_name,
  1645. c.method_remark
  1646. FROM qc_fai_detailed_record as a
  1647. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  1648. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  1649. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  1650. order by a.order_id
  1651. </select>
  1652. <!-- 修改FAI主记录信息 -->
  1653. <update id="updateFAIMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1654. UPDATE qc_fai_record
  1655. SET disposal_measures = #{disposalMeasures},
  1656. disposal_remark = #{disposalRemark},
  1657. inspection_result = #{inspectionResult},
  1658. inspector_no = #{inspectorNo},
  1659. state = #{state},
  1660. inspection_remark = #{inspectionRemark},
  1661. inspector_date = getDate(),
  1662. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  1663. roll_qty = #{rollQty,jdbcType=DECIMAL},
  1664. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  1665. pass_qty = #{passQty,jdbcType=DECIMAL},
  1666. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  1667. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  1668. submit_date = getDate()
  1669. WHERE site = #{site} AND inspection_no = #{inspectionNo} and bu_no = #{buNo}
  1670. </update>
  1671. <!-- 修改FAI明细记录信息 -->
  1672. <update id="updateFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1673. UPDATE qc_fai_detailed_record
  1674. SET item_result = #{itemResult},
  1675. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  1676. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  1677. text_value = #{textValue},
  1678. number_value = #{numberValue,jdbcType=DECIMAL}
  1679. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1680. </update>
  1681. <!-- 修改子明细提交标识 -->
  1682. <update id="updateSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1683. UPDATE qc_fai_sub_detail_record
  1684. SET is_submit = 'Y'
  1685. WHERE inspection_no = #{inspectionNo}
  1686. </update>
  1687. <!-- 删除FAI检验记录 -->
  1688. <delete id="deleteFAIRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1689. DELETE FROM qc_fai_record
  1690. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1691. </delete>
  1692. <!-- 删除FAI明细记录信息 -->
  1693. <delete id="deleteFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1694. DELETE FROM qc_fai_detailed_record
  1695. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1696. </delete>
  1697. <!-- 删除FAI子明细记录信息 -->
  1698. <delete id="deleteFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1699. DELETE FROM qc_fai_sub_detail_record
  1700. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1701. </delete>
  1702. <!-- 修改FAI主记录标识为已提交 -->
  1703. <update id="updateFAIMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1704. UPDATE qc_fai_record
  1705. SET submit_flag = 'Y',
  1706. state = '已完成',
  1707. submit_date = getDate()
  1708. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1709. </update>
  1710. <!-- 修改FAI明细记录标识为已提交 -->
  1711. <update id="updateFAIDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1712. UPDATE qc_fai_detailed_record
  1713. SET is_submit = 'Y'
  1714. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1715. </update>
  1716. <!-- 修改子明细记录标识为已提交 -->
  1717. <update id="updateFAISubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1718. UPDATE qc_fai_sub_detail_record
  1719. SET is_submit = 'Y'
  1720. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1721. </update>
  1722. <!-- 查询FAI检验记录是否已提交 -->
  1723. <select id="checkFAIIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1724. SELECT submit_flag
  1725. FROM qc_fai_record
  1726. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1727. </select>
  1728. <!-- 删除子明细的老数据 -->
  1729. <delete id="delFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  1730. DELETE FROM qc_fai_sub_detail_record
  1731. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1732. </delete>
  1733. <!-- 新增FAI子明细信息 -->
  1734. <insert id="saveFAISubDetailed">
  1735. INSERT INTO qc_fai_sub_detail_record
  1736. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  1737. VALUES
  1738. <foreach collection="list" item="item" separator=",">
  1739. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  1740. </foreach>
  1741. </insert>
  1742. <!-- 查询FAI的子明细 -->
  1743. <select id="selectFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  1744. SELECT
  1745. site,
  1746. bu_no,
  1747. sub_detail_value,
  1748. sampling_location,
  1749. is_submit,
  1750. sampling_location_b,
  1751. num,
  1752. sub_detail_value_b,
  1753. sub_detail_value_c,
  1754. sub_detail_value_d,
  1755. sub_detail_value_e
  1756. FROM qc_fai_sub_detail_record
  1757. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1758. <if test = "collectionDataContent != null and collectionDataContent != ''">
  1759. AND sub_detail_value ${collectionDataContent}
  1760. </if>
  1761. </select>
  1762. <!-- 获取该项目的子明细值 -->
  1763. <select id="selectFAISubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  1764. SELECT sub_detail_value,
  1765. sampling_location,
  1766. is_submit
  1767. FROM qc_fai_sub_detail_record
  1768. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  1769. </select>
  1770. <!-- ================================================= IPQC检验维护 ================================================= -->
  1771. <!-- 查询IPQC基础数据 -->
  1772. <select id="selectIPQCBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1773. SELECT
  1774. top 1
  1775. a.orderno as orderNo,
  1776. j.part_no,
  1777. j.part_desc,
  1778. c.operation_desc,
  1779. b.approve_qty as rollQty,
  1780. a.s_resourceid as resourceId,
  1781. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  1782. a.itemno as itemNo,
  1783. a.id as ssrId
  1784. FROM soscheduledrouting as a
  1785. LEFT JOIN sfdc as b
  1786. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  1787. select max(sfdc.id)
  1788. from sfdc
  1789. group by sfdc.assjob_seq_no, site
  1790. )
  1791. LEFT JOIN so_routing as c
  1792. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  1793. LEFT JOIN part j
  1794. ON a.site = j.site and a.part_no = j.part_no
  1795. LEFT JOIN (select ssr_id from qc_ipqc_record where check_type = '末件检') as temp
  1796. ON a.id = temp.ssr_id
  1797. WHERE b.approve_qty is not null and temp.ssr_id is null
  1798. ORDER BY a.id desc
  1799. </select>
  1800. <select id="qcExec" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="string" statementType="CALLABLE">
  1801. {CALL
  1802. getIpqcRecord(#{site,mode=IN,jdbcType=VARCHAR})
  1803. }
  1804. </select>
  1805. <insert id="saveIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1806. INSERT INTO qc_ipqc_detailed_record
  1807. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1808. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1809. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  1810. VALUES
  1811. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  1812. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  1813. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  1814. </insert>
  1815. <!-- 新增IPQC明细记录信息 -->
  1816. <insert id="saveIPQCDetailedRecords">
  1817. INSERT INTO qc_ipqc_detailed_record
  1818. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1819. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1820. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  1821. VALUES
  1822. <foreach collection="list" item="item" separator=",">
  1823. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  1824. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  1825. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  1826. </foreach>
  1827. </insert>
  1828. <!-- 新增IPQC主记录信息 -->
  1829. <insert id="saveIPQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1830. INSERT INTO qc_ipqc_record
  1831. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  1832. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  1833. VALUES
  1834. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  1835. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  1836. </insert>
  1837. <!-- 查询IPQC主记录信息 -->
  1838. <select id="qcIPQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1839. SELECT
  1840. a.inspection_no,
  1841. a.site,
  1842. a.bu_no,
  1843. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  1844. a.state,
  1845. a.inspection_result,
  1846. a.task_date,
  1847. a.inspection_type_no,
  1848. a.inspection_cycle,
  1849. a.order_no,
  1850. a.operation_desc,
  1851. a.resource_id,
  1852. r.resource_desc,
  1853. a.part_no,
  1854. d.part_desc,
  1855. d.cinv_source_code as cinvSourceCode,
  1856. d.sku as sku,
  1857. d.invdefinetype as invdefinetype,
  1858. a.inspection_remark,
  1859. a.roll_qty,
  1860. a.sampling_qty,
  1861. a.disposal_measures,
  1862. a.disposal_remark,
  1863. a.inspector_date,
  1864. a.inspector_no,
  1865. u.user_display as inspectorName,
  1866. a.ssr_id,
  1867. a.unqualified_qty,
  1868. a.submit_flag,
  1869. a.seq_no,
  1870. a.batch_roll_no,
  1871. a.special_requirements,
  1872. a.work_center_no,
  1873. a.roll_no,
  1874. a.um_id,
  1875. um.UMName as umName,
  1876. a.action_date,
  1877. a.action_by,
  1878. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  1879. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  1880. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  1881. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  1882. a.pass_qty,
  1883. a.not_pass_qty,
  1884. a.batch_qualified_qty
  1885. FROM qc_ipqc_record as a
  1886. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  1887. left join sys_user as u on a.inspector_no = u.username
  1888. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  1889. left join UM as um on a.site = um.site and a.um_id = um.UMID
  1890. <where>
  1891. a.site in (select site from eam_access_site where username = #{query.userName})
  1892. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1893. <if test="query.buNo != null and query.buNo != ''">
  1894. AND a.bu_no = #{query.buNo}
  1895. </if>
  1896. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  1897. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  1898. </if>
  1899. <if test = "query.partNo != null and query.partNo != ''">
  1900. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  1901. </if>
  1902. <if test = "query.partDesc != null and query.partDesc != ''">
  1903. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  1904. </if>
  1905. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  1906. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  1907. </if>
  1908. <if test = "query.sku != null and query.sku != ''">
  1909. AND d.sku LIKE '%' + #{query.sku} + '%'
  1910. </if>
  1911. <if test = "query.states != null and query.states.size > 0">
  1912. AND a.state in
  1913. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  1914. #{item}
  1915. </foreach>
  1916. </if>
  1917. <if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  1918. AND a.inspection_type_no = #{query.inspectionTypeNo}
  1919. </if>
  1920. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  1921. AND a.inspection_result = #{query.inspectionResult}
  1922. </if>
  1923. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  1924. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  1925. </if>
  1926. <if test = "query.orderNo != null and query.orderNo != ''">
  1927. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  1928. </if>
  1929. <if test = "query.seqNo != null and query.seqNo != ''">
  1930. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  1931. </if>
  1932. <if test = "query.operationDesc != null and query.operationDesc != ''">
  1933. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  1934. </if>
  1935. <if test="query.startDate != null">
  1936. AND a.inspector_date >= #{query.startDate}
  1937. </if>
  1938. <if test="query.endDate != null">
  1939. AND #{query.endDate} >= a.inspector_date
  1940. </if>
  1941. <if test="query.startDate2 != null">
  1942. AND a.task_date >= #{query.startDate2}
  1943. </if>
  1944. <if test="query.endDate2 != null">
  1945. AND #{query.endDate2} >= a.task_date
  1946. </if>
  1947. </where>
  1948. ORDER BY
  1949. CASE WHEN a.state = '待检验' THEN 1
  1950. WHEN a.state = '待审核' THEN 2
  1951. WHEN a.state = '已完成' THEN 3
  1952. END, a.task_date desc
  1953. </select>
  1954. <!-- IPQC明细记录查询 -->
  1955. <select id="ipqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1956. SELECT
  1957. a.site,
  1958. a.bu_no,
  1959. a.inspection_no,
  1960. a.order_no,
  1961. a.template_id,
  1962. a.sampling_level_no,
  1963. a.sampling_level_desc,
  1964. a.sampling_programme_no,
  1965. a.sampling_programme_desc,
  1966. a.AQL,
  1967. a.AC,
  1968. a.RE,
  1969. a.item_no,
  1970. a.item_desc,
  1971. a.object_id,
  1972. a.object_desc,
  1973. a.default_value,
  1974. a.min_value,
  1975. a.max_value,
  1976. a.text_value,
  1977. a.number_value,
  1978. a.value_type_db,
  1979. a.value_type,
  1980. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  1981. a.is_submit,
  1982. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  1983. a.sampling_qty,
  1984. dbo.qc_get_ipqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  1985. c.method_no,
  1986. c.method_name,
  1987. c.method_remark
  1988. FROM qc_ipqc_detailed_record as a
  1989. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  1990. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  1991. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  1992. order by a.order_id
  1993. </select>
  1994. <!-- 删除IPQC检验记录 -->
  1995. <delete id="deleteIPQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1996. DELETE FROM qc_ipqc_record
  1997. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1998. </delete>
  1999. <!-- 删除IPQC明细记录信息 -->
  2000. <delete id="deleteIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2001. DELETE FROM qc_ipqc_detailed_record
  2002. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2003. </delete>
  2004. <!-- 删除IPQC子明细记录信息 -->
  2005. <delete id="deleteIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2006. DELETE FROM qc_ipqc_sub_detail_record
  2007. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2008. </delete>
  2009. <!-- 修改IPQC主记录信息 -->
  2010. <update id="updateIPQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2011. UPDATE qc_ipqc_record
  2012. SET disposal_measures = #{disposalMeasures},
  2013. disposal_remark = #{disposalRemark},
  2014. inspection_result = #{inspectionResult},
  2015. inspector_no = #{inspectorNo},
  2016. state = #{state},
  2017. inspection_remark = #{inspectionRemark},
  2018. inspector_date = getDate(),
  2019. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2020. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2021. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2022. pass_qty = #{passQty,jdbcType=DECIMAL},
  2023. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2024. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2025. submit_date = getDate()
  2026. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2027. </update>
  2028. <!-- 修改IPQC明细记录信息 -->
  2029. <update id="updateIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2030. UPDATE qc_ipqc_detailed_record
  2031. SET item_result = #{itemResult},
  2032. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2033. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2034. text_value = #{textValue},
  2035. number_value = #{numberValue,jdbcType=DECIMAL}
  2036. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2037. </update>
  2038. <!-- 修改IPQC主记录标识为已提交 -->
  2039. <update id="updateIPQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2040. UPDATE qc_ipqc_record
  2041. SET submit_flag = 'Y',
  2042. state = '已完成',
  2043. submit_date = getDate()
  2044. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2045. </update>
  2046. <!-- 修改IPQC明细记录标识为已提交 -->
  2047. <update id="updateIPQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2048. UPDATE qc_ipqc_detailed_record
  2049. SET is_submit = 'Y'
  2050. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2051. </update>
  2052. <!-- 修改IPQC子明细记录标识为已提交 -->
  2053. <update id="updateIPQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2054. UPDATE qc_ipqc_sub_detail_record
  2055. SET is_submit = 'Y'
  2056. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2057. </update>
  2058. <!-- 删除IPQC子明细的老数据 -->
  2059. <delete id="delIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2060. DELETE FROM qc_ipqc_sub_detail_record
  2061. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2062. </delete>
  2063. <!-- 新增IPQC子明细信息 -->
  2064. <insert id="saveIPQCSubDetailed">
  2065. INSERT INTO qc_ipqc_sub_detail_record
  2066. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  2067. VALUES
  2068. <foreach collection="list" item="item" separator=",">
  2069. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2070. </foreach>
  2071. </insert>
  2072. <!-- 查询IPQC的子明细 -->
  2073. <select id="selectIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2074. SELECT
  2075. site,
  2076. bu_no,
  2077. sub_detail_value,
  2078. sampling_location,
  2079. is_submit,
  2080. sampling_location_b,
  2081. num,
  2082. sub_detail_value_b,
  2083. sub_detail_value_c,
  2084. sub_detail_value_d,
  2085. sub_detail_value_e
  2086. FROM qc_ipqc_sub_detail_record
  2087. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2088. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2089. AND sub_detail_value ${collectionDataContent}
  2090. </if>
  2091. </select>
  2092. <!-- 查询IPQC检验记录是否已提交 -->
  2093. <select id="checkIPQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2094. SELECT submit_flag
  2095. FROM qc_ipqc_record
  2096. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2097. </select>
  2098. <!-- 获取该项目的子明细值 -->
  2099. <select id="selectIPQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2100. SELECT sub_detail_value,
  2101. sampling_location,
  2102. is_submit
  2103. FROM qc_ipqc_sub_detail_record
  2104. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2105. </select>
  2106. <!-- 查询工序列表 -->
  2107. <select id="getOperationList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2108. SELECT
  2109. DISTINCT
  2110. a.seqno as seqNo,
  2111. a.orderno as orderNo,
  2112. j.part_no,
  2113. j.part_desc,
  2114. j.invdefinetype,
  2115. j.sku,
  2116. c.operation_desc as operationDesc,
  2117. a.itemno as operationNo,
  2118. a.s_resourceid as resourceId,
  2119. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2120. c.work_center_no
  2121. FROM soscheduledrouting as a
  2122. LEFT JOIN so_routing as c ON a.site = c.site and c.order_no = a.orderno and a.itemno = c.item_no
  2123. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2124. WHERE a.site = #{site} and a.seqno = #{seqNo}
  2125. </select>
  2126. <!-- 根据工单号和工序号查出所有数据 -->
  2127. <select id="getResourceList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2128. SELECT
  2129. a.s_resourceid as resourceId,
  2130. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2131. c.work_center_no
  2132. FROM soscheduledrouting as a
  2133. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  2134. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2135. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2136. WHERE a.site = #{site} and b.approve_qty is not null and a.seqno = #{seqNo}
  2137. ORDER BY a.id desc
  2138. </select>
  2139. <!-- a.orderno = #{orderNo} and c.operation_desc = #{operationDesc}-->
  2140. <!-- 查询机台名称 -->
  2141. <select id="selectResourceDesc" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2142. SELECT distinct
  2143. resource_desc
  2144. FROM resource
  2145. WHERE site = #{site} and resource_id = #{resourceId}
  2146. </select>
  2147. <!-- 查询物料名称 -->
  2148. <select id="selectPartDesc" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2149. SELECT distinct
  2150. part_desc
  2151. FROM part
  2152. WHERE site = #{site} and part_no = #{partNo}
  2153. </select>
  2154. <!-- ================================================= IQC检验维护 ================================================= -->
  2155. <!-- 查询IQC基础数据 -->
  2156. <select id="selectIQCBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2157. SELECT
  2158. qir.inspection_no,
  2159. qir.state,
  2160. qir.create_date as taskDate,
  2161. qir.roll_no,
  2162. qir.part_no,
  2163. p.part_desc,
  2164. p.cinv_source_code,
  2165. p.sku as sku,
  2166. qir.roll_qty,
  2167. qir.print_flag,
  2168. qir.create_by,
  2169. qir.supplier_no,
  2170. qir.site,
  2171. qir.bu_no,
  2172. qir.po_orderNo,
  2173. qir.po_itemNo,
  2174. qir.roll_count
  2175. FROM qc_iqc_record as qir
  2176. LEFT JOIN part p ON qir.part_no = p.part_no and qir.site = p.site
  2177. WHERE qir.site in (select site from eam_access_site where username = #{userName})
  2178. and (qir.site + '-' + qir.bu_no) in (select * from dbo.query_bu(#{userName}))
  2179. and qir.detail_flag = 'N'
  2180. </select>
  2181. <!-- 新增IQC明细记录信息 -->
  2182. <insert id="saveIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2183. INSERT INTO qc_iqc_detailed_record (inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  2184. VALUES(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty}, #{buNo},#{orderId,jdbcType=INTEGER})
  2185. </insert>
  2186. <!-- 修改IQC检验记录 -->
  2187. <update id="updateIQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2188. UPDATE qc_iqc_record
  2189. SET inspection_type_no = #{inspectionTypeNo},
  2190. sampling_qty = #{samplingQty},
  2191. inspection_cycle = #{inspectionCycle},
  2192. part_no = #{partNo},
  2193. supplier_no = #{supplierNo},
  2194. part_desc = #{partDesc},
  2195. detail_flag = 'Y',
  2196. state = '未开始',
  2197. action_date = '',
  2198. action_by = ''
  2199. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2200. </update>
  2201. <!-- 查询IQC主记录信息 -->
  2202. <select id="qcIQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2203. SELECT
  2204. a.inspection_no,
  2205. a.site,
  2206. a.bu_no,
  2207. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  2208. a.state,
  2209. a.inspection_result,
  2210. a.create_date as taskDate,
  2211. a.inspection_type_no,
  2212. a.inspection_cycle,
  2213. a.part_no,
  2214. a.part_desc,
  2215. d.cinv_source_code as cinvSourceCode,
  2216. d.sku,
  2217. d.umid as umId,
  2218. d.invdefinetype as invdefinetype,
  2219. a.inspection_remark,
  2220. a.roll_qty,
  2221. a.sampling_qty,
  2222. a.disposal_measures,
  2223. a.disposal_remark,
  2224. a.inspector_date,
  2225. a.inspector_no,
  2226. u.user_display as inspectorName,
  2227. a.unqualified_quantity,
  2228. a.submit_flag,
  2229. a.roll_no,
  2230. a.supplier_no,
  2231. s.SupplierName as supplierDesc,
  2232. a.po_orderNo,
  2233. a.po_itemNo,
  2234. a.roll_count,
  2235. dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
  2236. a.action_date,
  2237. a.action_by,
  2238. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2239. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2240. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2241. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2242. a.submission_remark,
  2243. a.submission_type,
  2244. a.batch_no,
  2245. a.production_date,
  2246. a.expiration_warning_date,
  2247. a.expiration_date,
  2248. a.cancel_check_date,
  2249. a.submit_date,
  2250. a.pass_qty,
  2251. a.not_pass_qty,
  2252. a.batch_qualified_qty
  2253. FROM qc_iqc_record as a
  2254. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  2255. left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
  2256. left join sys_user as u on a.inspector_no = u.username
  2257. <where>
  2258. a.site in (select site from eam_access_site where username = #{query.userName})
  2259. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  2260. <if test="query.buNo != null and query.buNo != ''">
  2261. AND a.bu_no = #{query.buNo}
  2262. </if>
  2263. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2264. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2265. </if>
  2266. <if test = "query.states != null and query.states.size > 0">
  2267. AND a.state in
  2268. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2269. #{item}
  2270. </foreach>
  2271. </if>
  2272. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2273. AND a.inspection_result = #{query.inspectionResult}
  2274. </if>
  2275. <if test = "query.partNo != null and query.partNo != ''">
  2276. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2277. </if>
  2278. <if test = "query.partDesc != null and query.partDesc != ''">
  2279. AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
  2280. </if>
  2281. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2282. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2283. </if>
  2284. <if test = "query.sku != null and query.sku != ''">
  2285. AND d.sku LIKE '%' + #{query.sku} + '%'
  2286. </if>
  2287. <if test = "query.supplierDesc != null and query.supplierDesc != ''">
  2288. AND s.SupplierName LIKE '%' + #{query.supplierDesc} + '%'
  2289. </if>
  2290. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2291. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2292. </if>
  2293. <if test = "query.inspectorName != null and query.inspectorName != ''">
  2294. u.user_display LIKE '%' + #{query.inspectorName} + '%'
  2295. </if>
  2296. <if test="query.startDate != null">
  2297. AND a.inspector_date >= #{query.startDate}
  2298. </if>
  2299. <if test="query.endDate != null">
  2300. AND #{query.endDate} >= a.inspector_date
  2301. </if>
  2302. <if test="query.startDate2 != null">
  2303. AND a.create_date >= #{query.startDate2}
  2304. </if>
  2305. <if test="query.endDate2 != null">
  2306. AND #{query.endDate2} >= a.create_date
  2307. </if>
  2308. <if test = "query.poOrderNo != null and query.poOrderNo != ''">
  2309. AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
  2310. </if>
  2311. <if test = "query.poItemNo != null and query.poItemNo != ''">
  2312. AND a.po_itemNo LIKE '%' + #{query.poItemNo} + '%'
  2313. </if>
  2314. <if test = "query.orderType != null and query.orderType != ''">
  2315. AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
  2316. </if>
  2317. <if test = "query.submissionType != null and query.submissionType != ''">
  2318. AND a.submission_type = #{query.submissionType}
  2319. </if>
  2320. <if test = "query.invdefinetype != null and query.invdefinetype != ''">
  2321. AND d.invdefinetype LIKE '%' + #{query.invdefinetype} + '%'
  2322. </if>
  2323. </where>
  2324. ORDER BY
  2325. CASE WHEN a.state = '待检验' THEN 1
  2326. WHEN a.state = '待审核' THEN 2
  2327. WHEN a.state = '已完成' THEN 3
  2328. END, a.create_date desc
  2329. </select>
  2330. <!-- IQC明细记录查询 -->
  2331. <select id="iqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2332. SELECT
  2333. a.site,
  2334. a.bu_no,
  2335. a.inspection_no,
  2336. a.template_id,
  2337. a.sampling_level_no,
  2338. a.sampling_level_desc,
  2339. a.sampling_programme_no,
  2340. a.sampling_programme_desc,
  2341. a.AQL,
  2342. a.AC,
  2343. a.RE,
  2344. a.item_no,
  2345. a.item_desc,
  2346. a.object_id,
  2347. a.object_desc,
  2348. a.default_value,
  2349. a.min_value,
  2350. a.max_value,
  2351. a.text_value,
  2352. a.number_value,
  2353. a.value_type_db,
  2354. a.value_type,
  2355. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2356. a.is_submit,
  2357. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2358. dbo.qc_get_iqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2359. c.method_no,
  2360. c.method_name,
  2361. c.method_remark,
  2362. a.sampling_qty
  2363. FROM qc_iqc_detailed_record as a
  2364. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  2365. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  2366. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2367. order by a.order_id
  2368. </select>
  2369. <!-- 查询IQC的子明细 -->
  2370. <select id="selectIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2371. SELECT
  2372. site,
  2373. bu_no,
  2374. sub_detail_value,
  2375. sampling_location,
  2376. is_submit,
  2377. sampling_location_b,
  2378. num,
  2379. sub_detail_value_b,
  2380. sub_detail_value_c,
  2381. sub_detail_value_d,
  2382. sub_detail_value_e
  2383. FROM qc_iqc_sub_detail_record
  2384. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2385. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2386. AND sub_detail_value ${collectionDataContent}
  2387. </if>
  2388. </select>
  2389. <!-- 获取该项目的子明细值 -->
  2390. <select id="selectIQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2391. SELECT sub_detail_value,
  2392. sampling_location,
  2393. is_submit
  2394. FROM qc_iqc_sub_detail_record
  2395. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2396. </select>
  2397. <!-- 修改IQC主记录信息 -->
  2398. <update id="updateIQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2399. UPDATE qc_iqc_record
  2400. SET disposal_measures = #{disposalMeasures},
  2401. disposal_remark = #{disposalRemark},
  2402. inspection_result = #{inspectionResult},
  2403. inspector_no = #{inspectorNo},
  2404. state = #{state},
  2405. inspection_remark = #{inspectionRemark},
  2406. inspector_date = getDate(),
  2407. roll_count = #{rollCount,jdbcType=DECIMAL},
  2408. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2409. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2410. pass_qty = #{passQty,jdbcType=DECIMAL},
  2411. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2412. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2413. submit_date = getDate()
  2414. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2415. </update>
  2416. <!-- 修改IQC明细记录信息 -->
  2417. <update id="updateIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2418. UPDATE qc_iqc_detailed_record
  2419. SET item_result = #{itemResult},
  2420. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2421. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2422. text_value = #{textValue},
  2423. number_value = #{numberValue,jdbcType=DECIMAL}
  2424. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2425. </update>
  2426. <!-- 查询该记录明细是否已存在 -->
  2427. <select id="checkIQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2428. SELECT inspection_no,
  2429. template_id
  2430. FROM qc_iqc_detailed_record
  2431. WHERE inspection_no = #{inspectionNo} and site = #{site}
  2432. </select>
  2433. <!-- 查询IQC检验记录是否已提交 -->
  2434. <select id="checkIQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2435. SELECT submit_flag
  2436. FROM qc_iqc_record
  2437. WHERE inspection_no = #{inspectionNo} and site = #{site}
  2438. </select>
  2439. <!-- 删除IQC子明细的老数据 -->
  2440. <delete id="delIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2441. DELETE FROM qc_iqc_sub_detail_record
  2442. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2443. </delete>
  2444. <!-- 新增IQC子明细信息 -->
  2445. <insert id="saveIQCSubDetailed">
  2446. INSERT INTO qc_iqc_sub_detail_record
  2447. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  2448. VALUES
  2449. <foreach collection="list" item="item" separator=",">
  2450. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2451. </foreach>
  2452. </insert>
  2453. <!-- 修改IQC主记录标识为已提交 -->
  2454. <update id="updateIQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2455. UPDATE qc_iqc_record
  2456. SET submit_flag = 'Y',
  2457. state = '已完成',
  2458. submit_date = getDate()
  2459. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2460. </update>
  2461. <!-- 修改IQC明细记录标识为已提交 -->
  2462. <update id="updateIQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2463. UPDATE qc_iqc_detailed_record
  2464. SET is_submit = 'Y'
  2465. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2466. </update>
  2467. <!-- 修改IQC子明细记录标识为已提交 -->
  2468. <update id="updateIQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2469. UPDATE qc_iqc_sub_detail_record
  2470. SET is_submit = 'Y'
  2471. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2472. </update>
  2473. <!-- 删除IQC检验记录 -->
  2474. <delete id="deleteIQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2475. DELETE FROM qc_iqc_record
  2476. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2477. </delete>
  2478. <!-- 删除IQC明细记录信息 -->
  2479. <delete id="deleteIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2480. DELETE FROM qc_iqc_detailed_record
  2481. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2482. </delete>
  2483. <!-- 删除IQC子明细记录信息 -->
  2484. <delete id="deleteIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2485. DELETE FROM qc_iqc_sub_detail_record
  2486. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2487. </delete>
  2488. <!-- 查询文件ID -->
  2489. <select id="queryFileId" parameterType="SysOssEntity" resultType="SysOssEntity">
  2490. SELECT id, file_name
  2491. FROM sys_oss
  2492. WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
  2493. </select>
  2494. <!-- 获取工序列表 -->
  2495. <select id="getOperationDescList" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  2496. SELECT distinct
  2497. operation_desc
  2498. FROM so_routing
  2499. <where>
  2500. <if test = "operationDesc != null and operationDesc != ''">
  2501. AND operation_desc LIKE '%' + #{operationDesc} + '%'
  2502. </if>
  2503. </where>
  2504. </select>
  2505. <!-- 获取供应商列表 -->
  2506. <select id="getManufacturerList" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  2507. SELECT
  2508. supplierID as manufacturerID,
  2509. supplierName as manufacturerName
  2510. FROM view_Supplier
  2511. <where>
  2512. site = #{site}
  2513. <if test = "manufacturerID != null and manufacturerID != ''">
  2514. AND supplierID LIKE '%' + #{manufacturerID} + '%'
  2515. </if>
  2516. <if test = "manufacturerName != null and manufacturerName != ''">
  2517. AND supplierName LIKE '%' + #{manufacturerName} + '%'
  2518. </if>
  2519. </where>
  2520. </select>
  2521. <!-- 获取机台列表 -->
  2522. <select id="getAllResourceList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2523. SELECT distinct
  2524. resource_id,
  2525. resource_desc
  2526. FROM resource
  2527. <where>
  2528. site = #{site}
  2529. <if test = "resourceId != null and resourceId != ''">
  2530. AND resource_id LIKE '%' + #{resourceId} + '%'
  2531. </if>
  2532. <if test = "resourceDesc != null and resourceDesc != ''">
  2533. AND resource_desc LIKE '%' + #{resourceDesc} + '%'
  2534. </if>
  2535. </where>
  2536. </select>
  2537. <!-- 获取工单列表 -->
  2538. <select id="getOrderNoList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2539. SELECT DISTINCT
  2540. a.orderno as orderNo
  2541. FROM soscheduledrouting as a
  2542. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  2543. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2544. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2545. <where>
  2546. a.site = #{site}
  2547. AND b.approve_qty is not null
  2548. <if test = "orderNo != null and orderNo != ''">
  2549. AND a.orderno LIKE '%' + #{orderNo} + '%'
  2550. </if>
  2551. </where>
  2552. order by a.orderno DESC
  2553. </select>
  2554. <!-- 查询FQC主记录信息 -->
  2555. <select id="qcFQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2556. SELECT
  2557. a.inspection_no,
  2558. a.site,
  2559. a.bu_no,
  2560. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  2561. a.state,
  2562. a.inspection_result,
  2563. a.task_date,
  2564. a.inspection_type_no,
  2565. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  2566. a.inspection_cycle,
  2567. a.order_no,
  2568. a.operation_desc,
  2569. a.resource_id,
  2570. r.resource_desc,
  2571. a.part_no,
  2572. d.part_desc,
  2573. d.cinv_source_code as cinvSourceCode,
  2574. d.sku as sku,
  2575. d.invdefinetype as invdefinetype,
  2576. a.inspection_remark,
  2577. a.roll_qty,
  2578. a.sampling_qty,
  2579. a.disposal_measures,
  2580. a.disposal_remark,
  2581. a.inspector_date,
  2582. a.inspector_no,
  2583. u.user_display as inspectorName,
  2584. a.ssr_id,
  2585. a.unqualified_qty,
  2586. a.submit_flag,
  2587. a.seq_no,
  2588. a.batch_roll_no,
  2589. a.special_requirements,
  2590. a.work_center_no,
  2591. a.roll_no,
  2592. a.um_id,
  2593. um.UMName as umName,
  2594. a.action_date,
  2595. a.action_by,
  2596. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2597. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2598. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2599. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2600. a.pass_qty,
  2601. a.not_pass_qty,
  2602. a.batch_qualified_qty
  2603. FROM qc_fqc_record as a
  2604. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  2605. left join sys_user as u on a.inspector_no = u.username
  2606. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  2607. left join UM as um on a.site = um.site and a.um_id = um.UMID
  2608. <where>
  2609. a.site in (select site from eam_access_site where username = #{query.userName})
  2610. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  2611. <if test="query.buNo != null and query.buNo != ''">
  2612. AND a.bu_no = #{query.buNo}
  2613. </if>
  2614. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2615. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2616. </if>
  2617. <if test = "query.partNo != null and query.partNo != ''">
  2618. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2619. </if>
  2620. <if test = "query.partDesc != null and query.partDesc != ''">
  2621. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  2622. </if>
  2623. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2624. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2625. </if>
  2626. <if test = "query.sku != null and query.sku != ''">
  2627. AND d.sku LIKE '%' + #{query.sku} + '%'
  2628. </if>
  2629. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2630. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2631. </if>
  2632. <if test = "query.states != null and query.states.size > 0">
  2633. AND a.state in
  2634. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2635. #{item}
  2636. </foreach>
  2637. </if>
  2638. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2639. AND a.inspection_result = #{query.inspectionResult}
  2640. </if>
  2641. <if test = "query.orderNo != null and query.orderNo != ''">
  2642. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  2643. </if>
  2644. <if test = "query.seqNo != null and query.seqNo != ''">
  2645. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  2646. </if>
  2647. <if test = "query.operationDesc != null and query.operationDesc != ''">
  2648. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  2649. </if>
  2650. <if test="query.startDate != null">
  2651. AND a.inspector_date >= #{query.startDate}
  2652. </if>
  2653. <if test="query.endDate != null">
  2654. AND #{query.endDate} >= a.inspector_date
  2655. </if>
  2656. <if test="query.startDate2 != null">
  2657. AND a.task_date >= #{query.startDate2}
  2658. </if>
  2659. <if test="query.endDate2 != null">
  2660. AND #{query.endDate2} >= a.task_date
  2661. </if>
  2662. </where>
  2663. ORDER BY
  2664. CASE WHEN a.state = '待检验' THEN 1
  2665. WHEN a.state = '待审核' THEN 2
  2666. WHEN a.state = '已完成' THEN 3
  2667. END, a.task_date desc
  2668. </select>
  2669. <insert id="saveFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2670. INSERT INTO qc_fqc_detailed_record
  2671. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2672. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2673. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  2674. VALUES
  2675. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  2676. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  2677. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  2678. </insert>
  2679. <!-- 新增FQC明细记录信息 -->
  2680. <insert id="saveFQCDetailedRecords">
  2681. INSERT INTO qc_fqc_detailed_record
  2682. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2683. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2684. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  2685. VALUES
  2686. <foreach collection="list" item="item" separator=",">
  2687. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  2688. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  2689. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  2690. </foreach>
  2691. </insert>
  2692. <!-- 新增FQC主记录信息 -->
  2693. <insert id="saveFQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2694. INSERT INTO qc_fqc_record
  2695. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  2696. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  2697. VALUES
  2698. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  2699. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  2700. </insert>
  2701. <!-- FQC明细记录查询 -->
  2702. <select id="fqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2703. SELECT
  2704. a.site,
  2705. a.bu_no,
  2706. a.inspection_no,
  2707. a.order_no,
  2708. a.template_id,
  2709. a.sampling_level_no,
  2710. a.sampling_level_desc,
  2711. a.sampling_programme_no,
  2712. a.sampling_programme_desc,
  2713. a.AQL,
  2714. a.AC,
  2715. a.RE,
  2716. a.item_no,
  2717. a.item_desc,
  2718. a.object_id,
  2719. a.object_desc,
  2720. a.default_value,
  2721. a.min_value,
  2722. a.max_value,
  2723. a.text_value,
  2724. a.number_value,
  2725. a.value_type_db,
  2726. a.value_type,
  2727. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2728. a.is_submit,
  2729. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2730. a.sampling_qty,
  2731. dbo.qc_get_fqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2732. c.method_no,
  2733. c.method_name,
  2734. c.method_remark
  2735. FROM qc_fqc_detailed_record as a
  2736. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  2737. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  2738. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2739. order by a.order_id
  2740. </select>
  2741. <!-- 删除FQC检验记录 -->
  2742. <delete id="deleteFQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2743. DELETE FROM qc_fqc_record
  2744. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2745. </delete>
  2746. <!-- 删除FQC明细记录信息 -->
  2747. <delete id="deleteFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2748. DELETE FROM qc_fqc_detailed_record
  2749. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2750. </delete>
  2751. <!-- 删除FQC子明细记录信息 -->
  2752. <delete id="deleteFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2753. DELETE FROM qc_fqc_sub_detail_record
  2754. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2755. </delete>
  2756. <!-- 修改FQC主记录信息 -->
  2757. <update id="updateFQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2758. UPDATE qc_fqc_record
  2759. SET disposal_measures = #{disposalMeasures},
  2760. disposal_remark = #{disposalRemark},
  2761. inspection_result = #{inspectionResult},
  2762. inspector_no = #{inspectorNo},
  2763. state = #{state},
  2764. inspection_remark = #{inspectionRemark},
  2765. inspector_date = getDate(),
  2766. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2767. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2768. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2769. pass_qty = #{passQty,jdbcType=DECIMAL},
  2770. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2771. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2772. submit_date = getDate()
  2773. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2774. </update>
  2775. <!-- 修改FQC明细记录信息 -->
  2776. <update id="updateFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2777. UPDATE qc_fqc_detailed_record
  2778. SET item_result = #{itemResult},
  2779. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2780. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2781. text_value = #{textValue},
  2782. number_value = #{numberValue,jdbcType=DECIMAL}
  2783. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2784. </update>
  2785. <!-- 修改FQC主记录标识为已提交 -->
  2786. <update id="updateFQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2787. UPDATE qc_fqc_record
  2788. SET submit_flag = 'Y',
  2789. state = '已完成',
  2790. submit_date = getDate()
  2791. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2792. </update>
  2793. <!-- 修改FAI明细记录标识为已提交 -->
  2794. <update id="updateFQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2795. UPDATE qc_fqc_detailed_record
  2796. SET is_submit = 'Y'
  2797. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2798. </update>
  2799. <!-- 修改子明细记录标识为已提交 -->
  2800. <update id="updateFQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2801. UPDATE qc_fqc_sub_detail_record
  2802. SET is_submit = 'Y'
  2803. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2804. </update>
  2805. <!-- 删除子明细的老数据 -->
  2806. <delete id="delFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2807. DELETE FROM qc_fqc_sub_detail_record
  2808. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2809. </delete>
  2810. <!-- 新增子明细信息 -->
  2811. <insert id="saveFQCSubDetailed">
  2812. INSERT INTO qc_fqc_sub_detail_record
  2813. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  2814. VALUES
  2815. <foreach collection="list" item="item" separator=",">
  2816. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2817. </foreach>
  2818. </insert>
  2819. <!-- 查询FQC的子明细 -->
  2820. <select id="selectFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2821. SELECT
  2822. site,
  2823. bu_no,
  2824. sub_detail_value,
  2825. sampling_location,
  2826. is_submit,
  2827. sampling_location_b,
  2828. num,
  2829. sub_detail_value_b,
  2830. sub_detail_value_c,
  2831. sub_detail_value_d,
  2832. sub_detail_value_e
  2833. FROM qc_fqc_sub_detail_record
  2834. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2835. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2836. AND sub_detail_value ${collectionDataContent}
  2837. </if>
  2838. </select>
  2839. <!-- 查询FQC检验记录是否已提交 -->
  2840. <select id="checkFQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2841. SELECT submit_flag
  2842. FROM qc_fqc_record
  2843. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2844. </select>
  2845. <!-- 获取该项目的子明细值 -->
  2846. <select id="selectFQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2847. SELECT sub_detail_value,
  2848. sampling_location,
  2849. is_submit
  2850. FROM qc_fqc_sub_detail_record
  2851. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2852. </select>
  2853. <!-- 生成FQC检验单号 -->
  2854. <select id="selectFQCInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2855. SELECT
  2856. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  2857. FROM qc_fqc_record
  2858. WHERE site = #{site} and bu_no = #{buNo}
  2859. </select>
  2860. <!-- 生成IPQC检验单号 -->
  2861. <select id="selectIPQCInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2862. SELECT
  2863. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
  2864. FROM qc_ipqc_record
  2865. WHERE site = #{site} and bu_no = #{buNo}
  2866. </select>
  2867. <!-- 生成FAI检验单号 -->
  2868. <select id="selectFAIInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2869. SELECT
  2870. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  2871. FROM qc_fai_record
  2872. WHERE site = #{site} and bu_no = #{buNo}
  2873. </select>
  2874. <!-- 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 -->
  2875. <select id="queryDataFromViewPoOrder" resultType="com.xujie.sys.modules.pms.data.PoOrderData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2876. SELECT
  2877. site,
  2878. order_no,
  2879. item_no,
  2880. part_no,
  2881. part_desc,
  2882. spec,
  2883. supplier_id,
  2884. supplier_name,
  2885. order_qty,
  2886. created_date,
  2887. status,
  2888. citem_code,
  2889. citem_class,
  2890. sendto_address,
  2891. order_type
  2892. FROM view_po_order
  2893. WHERE site = #{site} and order_no = #{poOrderNo} and item_no = #{poItemNo}
  2894. </select>
  2895. <!-- 向收货任务表里添加数据 -->
  2896. <insert id="saveReceivingTask" parameterType="com.xujie.sys.modules.pms.data.PoOrderData">
  2897. INSERT INTO receiving_task (site, order_no, item_no, part_no, part_desc, spec, supplier_id, supplier_name, order_qty, created_date, status, citem_code, citem_class, sendto_address, order_type, inspection_no, batch_no, production_date, expiration_warning_date, expiration_date)
  2898. VALUES (#{site}, #{orderNo}, #{itemNo}, #{partNo}, #{partDesc}, #{spec}, #{supplierId}, #{supplierName}, #{orderQty}, getDate(), #{status}, #{citemCode}, #{citemClass}, #{sendtoAddress}, #{orderType}, #{inspectionNo}, #{batchNo}, #{productionDate}, #{expirationWarningDate}, #{expirationDate})
  2899. </insert>
  2900. <!-- 检查动控是否开启 -->
  2901. <select id="queryController" parameterType="com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity" resultType="com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity">
  2902. SELECT
  2903. type,
  2904. base_data,
  2905. base_desc,
  2906. status,
  2907. remark,
  2908. third_type,
  2909. second_type,
  2910. page_control,
  2911. control_style
  2912. FROM sys_scene_dynamic_control_model
  2913. where site = #{site} and control_no = #{controlNo}
  2914. </select>
  2915. <!-- 查询检验模板列表 -->
  2916. <select id="queryTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  2917. SELECT
  2918. site,
  2919. bu_no,
  2920. template_id as templateId,
  2921. template_name as templateName,
  2922. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  2923. FROM qc_template
  2924. <where>
  2925. site = #{site} and bu_no = #{buNo} and dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  2926. <if test = "templateId != null and templateId != ''">
  2927. AND template_id LIKE '%' + #{templateId}+'%'
  2928. </if>
  2929. <if test = "templateName != null and templateName != ''">
  2930. AND template_name LIKE '%' + #{templateName}+'%'
  2931. </if>
  2932. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  2933. AND inspection_type_no = #{inspectionTypeNo}
  2934. </if>
  2935. </where>
  2936. </select>
  2937. <!-- 查询检验模板列表 -->
  2938. <select id="getPartInformation" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2939. select
  2940. part_no,
  2941. part_desc,
  2942. spec,
  2943. sku,
  2944. control_mes,
  2945. DefaultWarehouseID as defaultWarehouseId
  2946. from part
  2947. where site = #{site} and part_no = #{partNo}
  2948. </select>
  2949. <!-- 获取特殊工序列表 -->
  2950. <select id="getSpecialOperationList" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2951. select
  2952. site,
  2953. operation_no,
  2954. operation_desc
  2955. from qc_special_task_operation
  2956. where site = #{site}
  2957. </select>
  2958. <!-- 获取处置措施列表 -->
  2959. <select id="disposalMeasuresSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2960. SELECT
  2961. id,
  2962. disposal_measures
  2963. FROM qc_disposal_measures
  2964. <where>
  2965. <if test = "inspectionTypeNo != '101'">
  2966. inspection_type != 'IPQC'
  2967. </if>
  2968. </where>
  2969. </select>
  2970. <!-- 查询文件路径 -->
  2971. <select id="searchItemFileUrl" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2972. SELECT
  2973. id,
  2974. url,
  2975. file_name
  2976. FROM sys_oss
  2977. WHERE order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref3 = #{itemNo} and order_ref4 = #{buNo}
  2978. </select>
  2979. <!-- 删除图片-->
  2980. <delete id="imageDelete" parameterType="SysOssEntity">
  2981. DELETE FROM sys_oss
  2982. WHERE id = #{id}
  2983. </delete>
  2984. <!-- 模糊查询标签号 -->
  2985. <select id="getRollNo" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2986. SELECT DISTINCT top 3
  2987. a.seqno,
  2988. a.orderno,
  2989. b.roll_no
  2990. FROM soscheduledrouting AS a
  2991. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  2992. WHERE a.site = #{site} and b.roll_no like '%' + #{rollNo} + '%'
  2993. </select>
  2994. <!-- 标签号回车事件 -->
  2995. <select id="rollNoEnter" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2996. SELECT
  2997. a.site,
  2998. a.seqno as seqNo,
  2999. a.orderno as orderNo,
  3000. b.roll_no,
  3001. #{inspectionTypeNo} as inspectionTypeNo
  3002. FROM soscheduledrouting AS a
  3003. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  3004. WHERE a.site = #{site} and b.roll_no = #{rollNo}
  3005. </select>
  3006. <!-- 查询物料列表 -->
  3007. <select id="queryPartList" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3008. SELECT
  3009. site,
  3010. part_no,
  3011. part_desc,
  3012. sku,
  3013. spec
  3014. FROM part
  3015. <where>
  3016. site = #{site}
  3017. <if test = "partNo != null and partNo != ''">
  3018. AND part_no LIKE '%' + #{partNo} + '%'
  3019. </if>
  3020. <if test = "partDesc != null and partDesc != ''">
  3021. AND part_desc LIKE '%' + #{partDesc} + '%'
  3022. </if>
  3023. <if test = "sku != null and sku != ''">
  3024. AND sku LIKE '%' + #{sku} + '%'
  3025. </if>
  3026. </where>
  3027. </select>
  3028. <!-- 查询单位列表 -->
  3029. <select id="umSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3030. SELECT
  3031. site,
  3032. UMID as umId,
  3033. UMName as umName
  3034. FROM UM
  3035. WHERE site = #{site} and active = #{active}
  3036. </select>
  3037. <!-- 查询单位列表 -->
  3038. <select id="checkItem" resultType="com.xujie.sys.modules.pms.data.SubDetailValues" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3039. SELECT
  3040. site,
  3041. bu_no,
  3042. inspection_no,
  3043. item_no,
  3044. value_type_db,
  3045. min_value,
  3046. max_value
  3047. <if test = "flag == 'IPQC'">
  3048. FROM qc_ipqc_detailed_record
  3049. </if>
  3050. <if test = "flag == 'IQC'">
  3051. FROM qc_iqc_detailed_record
  3052. </if>
  3053. <if test = "flag == 'FQC'">
  3054. FROM qc_fqc_detailed_record
  3055. </if>
  3056. <if test = "flag == 'FAI'">
  3057. FROM qc_fai_detailed_record
  3058. </if>
  3059. WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo} and bu_no = #{buNo}
  3060. order by order_id
  3061. </select>
  3062. <!-- 查询检验方法列表 -->
  3063. <select id="queryMethodList" resultType="com.xujie.sys.modules.pms.data.QcMethodData" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  3064. SELECT
  3065. site,
  3066. bu_no,
  3067. method_no,
  3068. method_name,
  3069. inspection_type_no,
  3070. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  3071. FROM qc_method
  3072. <where>
  3073. site = #{site} and bu_no = #{buNo}
  3074. <if test = "methodNo != null and methodNo != ''">
  3075. AND method_no LIKE '%' + #{methodNo} + '%'
  3076. </if>
  3077. <if test = "methodName != null and methodName != ''">
  3078. AND method_name LIKE '%' + #{methodName} + '%'
  3079. </if>
  3080. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  3081. AND inspection_type_no = #{inspectionTypeNo}
  3082. </if>
  3083. <if test="inspectionTypeName != null and inspectionTypeName != ''">
  3084. AND dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  3085. </if>
  3086. </where>
  3087. </select>
  3088. <!-- 修改detailFlag字段为N -->
  3089. <update id="updateIQCDetailFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3090. UPDATE qc_iqc_record
  3091. SET detail_flag = 'N'
  3092. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3093. </update>
  3094. <!-- 查询检验方法唯一 -->
  3095. <select id="checkMethodOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcMethodData" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  3096. SELECT
  3097. site,
  3098. bu_no,
  3099. method_no
  3100. FROM qc_method
  3101. <where>
  3102. site = #{site} and bu_no = #{buNo} and method_no = #{methodNo}
  3103. </where>
  3104. </select>
  3105. <!-- 查询检验项目唯一 -->
  3106. <select id="checkItemOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcItemData" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  3107. SELECT
  3108. site,
  3109. bu_no,
  3110. ItemNo,
  3111. ItemDesc
  3112. FROM eam_properties_item
  3113. <where>
  3114. site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ItemType = #{itemType} and inspection_type_no = #{inspectionTypeNo}
  3115. </where>
  3116. </select>
  3117. <!-- 查询检验项目唯一 -->
  3118. <select id="checkTemplateOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3119. SELECT
  3120. site,
  3121. bu_no,
  3122. template_id,
  3123. template_name
  3124. FROM qc_template
  3125. <where>
  3126. site = #{site} and bu_no = #{buNo} and template_id = #{templateId}
  3127. </where>
  3128. </select>
  3129. <select id="searchSeqInfo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3130. SELECT DISTINCT
  3131. a.seqno,
  3132. a.orderno,
  3133. J.part_no,
  3134. J.part_desc,
  3135. t.lotsize,
  3136. a.qtyrequired,
  3137. c.operation_desc,
  3138. J.sku,
  3139. sum(roll_qty) as sjzs
  3140. FROM soscheduledrouting AS a
  3141. inner JOIN so_routing AS c ON c.site = a.site AND c.order_no = a.orderno AND a.itemno = c.item_no
  3142. inner JOIN part AS J ON a.site = J.site AND a.part_no = J.part_no
  3143. inner JOIN shoporder AS t ON a.site = t.site AND t.orderno = a.orderno
  3144. left join qc_ipqc_record as r on a.site = r.site and a.seqno = r.seq_no
  3145. WHERE
  3146. a.site = #{query.site} and J.sourceBu = #{query.buNo}
  3147. <if test="query.status != null and query.status != ''">
  3148. AND t.status = #{query.status}
  3149. </if>
  3150. <if test="query.orderNo != null and query.orderNo != ''">
  3151. AND a.orderno LIKE '%' + #{query.orderNo} + '%'
  3152. </if>
  3153. <if test="query.seqNo != null and query.seqNo != ''">
  3154. AND a.seqno LIKE '%' + #{query.seqNo} + '%'
  3155. </if>
  3156. <if test="query.sku != null and query.sku != ''">
  3157. AND j.sku LIKE '%' + #{query.sku} + '%'
  3158. </if>
  3159. <if test="query.partNo != null and query.partNo != ''">
  3160. AND J.part_no LIKE '%' + #{query.partNo} + '%'
  3161. </if>
  3162. <if test="query.partDesc != null and query.partDesc != ''">
  3163. AND J.part_desc LIKE '%' + #{query.partDesc} + '%'
  3164. </if>
  3165. <if test="query.operationDesc != null and query.operationDesc != ''">
  3166. AND c.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  3167. </if>
  3168. group by a.seqno, a.orderno, J.part_no, J.part_desc, t.lotsize, a.qtyrequired, c.operation_desc, J.sku
  3169. </select>
  3170. <select id="searchPartInfo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3171. select
  3172. part_no,
  3173. part_desc,
  3174. sku,
  3175. cinv_source_code,
  3176. sourceBu
  3177. from
  3178. part
  3179. where
  3180. sourceBu = #{query.buNo}
  3181. <if test="query.partNo != null and query.partNo != ''">
  3182. AND part_no LIKE '%' + #{query.partNo} + '%'
  3183. </if>
  3184. <if test="query.partDesc != null and query.partDesc != ''">
  3185. AND part_desc LIKE '%' + #{query.partDesc} + '%'
  3186. </if>
  3187. <if test="query.sku != null and query.sku != ''">
  3188. AND sku LIKE '%' + #{query.sku} + '%'
  3189. </if>
  3190. <if test="query.cinvSourceCode != null and query.cinvSourceCode != ''">
  3191. AND cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  3192. </if>
  3193. </select>
  3194. <select id="getInterfaceTimeData" parameterType="String" resultType="com.xujie.sys.modules.pms.data.InterfaceTimeData">
  3195. SELECT
  3196. id,
  3197. start_time,
  3198. end_time,
  3199. del_flag
  3200. FROM interface_time
  3201. WHERE del_flag = 'N' and site = #{site}
  3202. </select>
  3203. <update id="updateInterfaceTimeData" parameterType="com.xujie.sys.modules.pms.data.InterfaceTimeData">
  3204. UPDATE interface_time
  3205. set
  3206. updated_by = #{updatedBy},
  3207. updated_date = #{updatedDate},
  3208. del_flag = #{delFlag}
  3209. </update>
  3210. <select id="getInterfaceRdStyleData" parameterType="String" resultType="com.xujie.sys.modules.pms.data.RdStyleData">
  3211. SELECT
  3212. crdcode,
  3213. crdname,
  3214. iRdGrade,
  3215. rdtype,
  3216. brdend
  3217. FROM view_custdev_mes_rdstyle
  3218. WHERE crdname = #{crdName}
  3219. </select>
  3220. <insert id="insertHardtagPurchaseInStorageData" parameterType="com.xujie.sys.modules.pms.data.HardtagPurchaseInStorageCountData" useGeneratedKeys="true" keyProperty="id">
  3221. INSERT INTO purchase_in_storage_count
  3222. (site, trans_no, created_date, created_by, erp_flag, toacc, logindate, cordercode, cdepcode, cwhcode, crdcode, coutcode, ddate, bredvouch,
  3223. cmemo, verify, irowno, cinvcode, iquantity, citemcode, erp_remark, trans_date, csource, trans_type)
  3224. values (#{site}, #{transNo}, #{createdDate}, #{createdBy}, #{erpFlag}, #{toacc}, #{logindate}, #{cordercode}, #{cdepcode}, #{cwhcode}, #{crdcode}, #{coutcode}, #{ddate}, #{bredvouch},
  3225. #{cmemo}, #{verify}, #{irowno}, #{cinvcode}, #{iquantity}, #{citemcode}, #{erpRemark}, #{transDate}, #{csource}, #{transType})
  3226. </insert>
  3227. <insert id="batchSaveHrdtagTransHeader" parameterType="com.xujie.sys.modules.pms.data.HardtagTransHeaderData">
  3228. insert into TransHeader
  3229. (TransNo, Site, WarehouseID, TransDate, TransType_DB, TransType, UserName, Receiver, TransYear, TransMonth, PartnerID, PartnerType, AuthorizeFlag, AuthorizeDate, Authorizor, TransferFlag, TransferDate,
  3230. TransferGuys, VoucherDate, ProjectID, EnterDate, Remark, UseLocation, OrderRef1, LinkOrderFlag, DelAddID, Status, ProjectName, PartnerName, erp_warehouse_id, ERP,
  3231. department_no, picking_status, scan_type, inCategory, pmProject, remarks, item_no_mat, remark3, location_id, count_id)
  3232. values (#{TransNo}, #{Site}, #{WarehouseID}, #{TransDate}, #{TransTypeDB}, #{TransType}, #{UserName}, #{Receiver}, #{TransYear}, #{TransMonth}, #{PartnerID}, #{PartnerType}, #{AuthorizeFlag}, #{AuthorizeDate}, #{Authorizor}, #{TransferFlag}, #{TransferDate},
  3233. #{TransferGuys}, #{VoucherDate}, #{ProjectID}, #{EnterDate}, #{Remark}, #{UseLocation}, #{OrderRef1}, #{LinkOrderFlag}, #{DelAddID}, #{Status}, #{ProjectName}, #{PartnerName}, #{erpWarehouseId}, #{ERP},
  3234. #{departmentNo}, #{pickingStatus}, #{scanType}, #{inCategory}, #{pmProject}, #{remarks}, #{itemNoMat}, #{remark3}, #{locationId}, #{countId})
  3235. </insert>
  3236. <insert id="batchSaveHardtagTransDetail" parameterType="com.xujie.sys.modules.pms.data.HardtagTransDetailData">
  3237. INSERT INTO TransDetail
  3238. (TransNo, Site, PartNo, LocationID, TransQty, Direction, OrderRef1, ItemNo, OrderRef2, OrderRef3, OrderRef5, Remark, citem_code)
  3239. values
  3240. (#{TransNo}, #{Site}, #{PartNo}, #{LocationID}, #{TransQty}, #{Direction}, #{OrderRef1}, #{ItemNo}, #{OrderRef2}, #{OrderRef3}, #{OrderRef5}, #{Remark}, #{citemCode})
  3241. </insert>
  3242. <select id="getSendMailAddress" parameterType="String" resultType="com.xujie.sys.modules.pms.data.MailAddressData">
  3243. SELECT
  3244. id,
  3245. site,
  3246. bu_no,
  3247. mail_address,
  3248. send_type,
  3249. del_flag,
  3250. created_by,
  3251. created_date,
  3252. orderref1
  3253. FROM mailAddress
  3254. WHERE site = #{site} and send_type = #{type} and del_flag = 'N'
  3255. <if test="buNo != null and buNo != ''">
  3256. AND bu_no = #{buNo}
  3257. </if>
  3258. </select>
  3259. <select id="getSendMailFromAddress" resultType="com.xujie.sys.modules.pms.data.MailSendAddressData">
  3260. SELECT
  3261. port,
  3262. host,
  3263. username,
  3264. password,
  3265. emailForm,
  3266. timeout,
  3267. personal,
  3268. id
  3269. FROM mailSendAddress
  3270. where delFlag = 'N'
  3271. </select>
  3272. <!-- 新增发送邮件记录 -->
  3273. <insert id="saveSendMailRecord" parameterType="com.xujie.sys.modules.pms.data.SendMailRecord">
  3274. insert into send_mail_record
  3275. (site, bu_no, document_no, sender, recipient, send_date, type)
  3276. values
  3277. (#{site}, #{buNo}, #{documentNo}, #{sender}, #{recipient}, getDate(), #{type})
  3278. </insert>
  3279. <select id="orderTypeSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3280. SELECT distinct
  3281. order_type
  3282. FROM view_po_order
  3283. </select>
  3284. <update id="actionIQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3285. update qc_iqc_record
  3286. set action_date = getDate(),
  3287. action_by = #{actionBy},
  3288. state = #{state}
  3289. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3290. </update>
  3291. <update id="actionFAIInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3292. update qc_fai_record
  3293. set action_date = getDate(),
  3294. action_by = #{actionBy},
  3295. state = #{state}
  3296. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3297. </update>
  3298. <update id="actionIPQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3299. update qc_ipqc_record
  3300. set action_date = getDate(),
  3301. action_by = #{actionBy},
  3302. state = #{state}
  3303. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3304. </update>
  3305. <update id="actionFQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3306. update qc_fqc_record
  3307. set action_date = getDate(),
  3308. action_by = #{actionBy},
  3309. state = #{state}
  3310. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3311. </update>
  3312. <insert id="addEquipmentDataAcquisition">
  3313. insert into Equipment_data_acquisition
  3314. (site, bu_no, equipment_no, inspection_no, create_date, create_by, item_no, collection_source, collection_method)
  3315. values
  3316. <foreach collection="list" item="item" separator=",">
  3317. (#{item.site}, #{item.buNo}, #{item.equipmentNo}, #{item.inspectionNo}, getDate(), #{item.actionBy}, #{item.itemNo}, #{item.collectionSource}, #{item.collectionMethod})
  3318. </foreach>
  3319. </insert>
  3320. <!-- 新增人员信息 -->
  3321. <insert id="saveOperator" >
  3322. INSERT INTO eam_actual_operator
  3323. (site, order_no, function_type, operator, bu_no)
  3324. VALUES
  3325. <foreach collection="list" item="item" separator=",">
  3326. (#{item.site}, #{item.orderNo}, #{item.functionType}, #{item.operator}, #{item.buNo})
  3327. </foreach>
  3328. </insert>
  3329. <!-- 删除之前的人员-->
  3330. <delete id="delOperator" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3331. DELETE FROM eam_actual_operator
  3332. WHERE site = #{site} and order_no = #{inspectionNo} and bu_no = #{buNo}
  3333. </delete>
  3334. <select id="getInspectionNo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3335. select distinct
  3336. site,
  3337. bu_no,
  3338. equipment_no,
  3339. inspection_no,
  3340. item_no,
  3341. collection_source,
  3342. collection_method
  3343. from Equipment_data_acquisition
  3344. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3345. </select>
  3346. <select id="getInspectionNoByItem" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3347. select distinct
  3348. site,
  3349. bu_no,
  3350. equipment_no,
  3351. inspection_no,
  3352. item_no,
  3353. collection_source,
  3354. collection_method
  3355. from Equipment_data_acquisition
  3356. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
  3357. </select>
  3358. <select id="dataAcquisition" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3359. select
  3360. id,
  3361. site,
  3362. bu_no,
  3363. #{inspectionNo} as inspectionNo,
  3364. #{itemNo} as itemNo,
  3365. <if test='subDetailValueType == 0'>
  3366. ${collectionSource} as subDetailValue,
  3367. </if>
  3368. <if test='subDetailValueType == 1'>
  3369. ${collectionSource} as subDetailValueB,
  3370. </if>
  3371. <if test='subDetailValueType == 2'>
  3372. ${collectionSource} as subDetailValueC,
  3373. </if>
  3374. <if test='subDetailValueType == 3'>
  3375. ${collectionSource} as subDetailValueD,
  3376. </if>
  3377. <if test='subDetailValueType == 4'>
  3378. ${collectionSource} as subDetailValueE,
  3379. </if>
  3380. num,
  3381. #{collectionSource} as collectionSource,
  3382. #{collectionMethod} as collectionMethod
  3383. from Equipment_data_detail
  3384. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3385. <if test='collectionMethod == "plc"'>
  3386. AND inspection_no = #{inspectionNo}
  3387. </if>
  3388. <if test='collectionMethod == "RS232"'>
  3389. AND (inspection_no is null or inspection_no = '')
  3390. </if>
  3391. <if test = "collectionDataContent != null and collectionDataContent != ''">
  3392. AND ${collectionSource} ${collectionDataContent}
  3393. </if>
  3394. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3395. </select>
  3396. <select id="dataAcquisitionB" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3397. select
  3398. id,
  3399. site,
  3400. bu_no,
  3401. #{inspectionNo} as inspectionNo,
  3402. #{itemNo} as itemNo,
  3403. ${collectionSource} as subDetailValueB,
  3404. num,
  3405. #{collectionSource} as collectionSource
  3406. from Equipment_data_detail
  3407. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3408. <if test='collectionMethod == "plc"'>
  3409. AND inspection_no = #{inspectionNo}
  3410. </if>
  3411. <if test='collectionMethod == "RS232"'>
  3412. AND (inspection_no is null or inspection_no = '')
  3413. </if>
  3414. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3415. </select>
  3416. <select id="dataAcquisition2" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="SysOssEntity">
  3417. select
  3418. site as orderRef1,
  3419. bu_no as orderRef4,
  3420. #{inspectionNo} as orderRef2,
  3421. #{itemNo} as orderRef3,
  3422. ${collectionSource} as url
  3423. from Equipment_data_detail
  3424. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3425. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3426. </select>
  3427. <select id="getIQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3428. select
  3429. a.site,
  3430. a.bu_no,
  3431. b.collection_condition as equipmentNo,
  3432. #{inspectionNo} as inspectionNo,
  3433. a.item_no,
  3434. b.collection_source,
  3435. #{actionBy} as actionBy,
  3436. b.collection_method
  3437. from qc_iqc_detailed_record as a
  3438. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3439. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
  3440. order by a.order_id
  3441. </select>
  3442. <select id="getFAIDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3443. select
  3444. a.site,
  3445. a.bu_no,
  3446. b.collection_condition as equipmentNo,
  3447. #{inspectionNo} as inspectionNo,
  3448. a.item_no,
  3449. b.collection_source,
  3450. #{actionBy} as actionBy,
  3451. b.collection_method
  3452. from qc_fai_detailed_record as a
  3453. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3454. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
  3455. order by order_id
  3456. </select>
  3457. <select id="getIPQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3458. select
  3459. a.site,
  3460. a.bu_no,
  3461. b.collection_condition as equipmentNo,
  3462. #{inspectionNo} as inspectionNo,
  3463. a.item_no,
  3464. b.collection_source,
  3465. #{actionBy} as actionBy,
  3466. b.collection_method
  3467. from qc_ipqc_detailed_record as a
  3468. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3469. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
  3470. order by a.order_id
  3471. </select>
  3472. <select id="getFQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3473. select
  3474. a.site,
  3475. a.bu_no,
  3476. b.collection_condition as equipmentNo,
  3477. #{inspectionNo} as inspectionNo,
  3478. a.item_no,
  3479. b.collection_source,
  3480. #{actionBy} as actionBy,
  3481. b.collection_method
  3482. from qc_fqc_detailed_record as a
  3483. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3484. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
  3485. order by a.order_id
  3486. </select>
  3487. <select id="querySubDetails" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3488. select
  3489. b.site,
  3490. b.bu_no,
  3491. b.inspection_no,
  3492. b.item_no,
  3493. b.default_value,
  3494. b.min_value,
  3495. b.max_value,
  3496. b.value_type_db,
  3497. a.sub_detail_value
  3498. <if test="flag == 'iqc'">
  3499. from qc_iqc_sub_detail_record as a
  3500. left join qc_iqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  3501. </if>
  3502. <if test="flag == 'ipqc'">
  3503. from qc_ipqc_sub_detail_record as a
  3504. left join qc_ipqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  3505. </if>
  3506. <if test="flag == 'fqc'">
  3507. from qc_fqc_sub_detail_record as a
  3508. left join qc_fqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  3509. </if>
  3510. <if test="flag == 'fai'">
  3511. from qc_fai_sub_detail_record as a
  3512. left join qc_fai_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  3513. </if>
  3514. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and a.item_no = #{itemNo}
  3515. order by b.order_id
  3516. </select>
  3517. <insert id="saveFileList">
  3518. INSERT INTO sys_oss
  3519. (url, create_date, file_name, new_file_name, order_ref1, order_ref2, order_ref3, order_ref4)
  3520. VALUES
  3521. <foreach collection="list" item="item" separator=",">
  3522. (#{item.url}, getDate(), #{item.fileName}, #{item.newFileName}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4})
  3523. </foreach>
  3524. </insert>
  3525. <select id="getEquipmentNoList" parameterType="com.xujie.sys.modules.pms.data.EquipmentFolderLocationData" resultType="com.xujie.sys.modules.pms.data.EquipmentFolderLocationData">
  3526. select
  3527. equipment_no
  3528. from Equipment_folder_location
  3529. where site = #{site} and bu_no = #{buNo}
  3530. </select>
  3531. <!-- 获取责任人员列表 -->
  3532. <select id="getResponsibleOperatorList" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
  3533. SELECT
  3534. operator_id as adminID,
  3535. operator_name as adminName
  3536. FROM operator
  3537. <where>
  3538. site in (select site from eam_access_site where username = #{userName})
  3539. <if test = "adminID != null and adminID != ''">
  3540. AND operator_id LIKE '%' + #{adminID} + '%'
  3541. </if>
  3542. <if test = "adminName != null and adminName != ''">
  3543. AND operator_name LIKE '%' + #{adminName} + '%'
  3544. </if>
  3545. </where>
  3546. </select>
  3547. <select id="getDataContentList" parameterType="com.xujie.sys.modules.pms.data.QcCollectionDataContentData" resultType="com.xujie.sys.modules.pms.data.QcCollectionDataContentData">
  3548. select
  3549. content_desc
  3550. from qc_collection_data_content
  3551. where site = #{site} and bu_no = #{buNo} and active = 'Y'
  3552. </select>
  3553. <select id="getItemCollectionDataContent" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="string">
  3554. select
  3555. collection_data_content
  3556. from eam_properties_item
  3557. where site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo}
  3558. </select>
  3559. <!-- 获取当前项目不包含的设备 -->
  3560. <select id="getObjectList1" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3561. SELECT
  3562. a.site,
  3563. a.bu_no,
  3564. a.ObjectID,
  3565. a.ObjectDesc
  3566. FROM eam_object as a
  3567. left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
  3568. where a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  3569. </select>
  3570. <!-- 获取当前项目所包含的设备 -->
  3571. <select id="getObjectList2" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3572. SELECT
  3573. a.site,
  3574. a.bu_no,
  3575. a.ObjectID,
  3576. b.ObjectDesc,
  3577. a.default_flag
  3578. FROM qc_item_object a
  3579. LEFT JOIN eam_object b ON a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID
  3580. WHERE a.site = #{site} and a.bu_no = #{buNo} and a.ItemNo = #{itemNo}
  3581. </select>
  3582. <!-- 获取当前项目不包含的设备 -->
  3583. <select id="getObjectListBy" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3584. SELECT
  3585. a.site,
  3586. a.bu_no,
  3587. a.ObjectID,
  3588. a.ObjectDesc
  3589. FROM eam_object as a
  3590. left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
  3591. <where>
  3592. a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  3593. <if test = "objectID != null and objectID != ''">
  3594. AND a.ObjectID LIKE '%' + #{objectID} + '%'
  3595. </if>
  3596. <if test = "objectDesc != null and objectDesc != ''">
  3597. AND a.ObjectDesc LIKE '%' + #{objectDesc} + '%'
  3598. </if>
  3599. </where>
  3600. </select>
  3601. <!-- 新增项目设备 -->
  3602. <insert id="addItemObject">
  3603. INSERT INTO qc_item_object
  3604. (site, bu_no, ItemNo, ObjectID, default_flag)
  3605. VALUES
  3606. <foreach collection="list" item="item" separator=",">
  3607. (#{item.site}, #{item.buNo}, #{item.itemNo}, #{item.objectID}, #{item.defaultFlag})
  3608. </foreach>
  3609. </insert>
  3610. <delete id="deleteItemObject">
  3611. DELETE FROM qc_item_object
  3612. WHERE
  3613. <foreach collection="list" item="item" separator=" or " index="index">
  3614. (site = #{item.site} and bu_no = #{item.buNo} and ItemNo = #{item.itemNo} and ObjectID = #{item.objectID})
  3615. </foreach>
  3616. </delete>
  3617. <update id="updateItemObject">
  3618. UPDATE qc_item_object
  3619. SET default_flag = #{defaultFlag}
  3620. WHERE site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ObjectID = #{objectID}
  3621. </update>
  3622. <select id="getIQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3623. select
  3624. a.site,
  3625. a.bu_no,
  3626. a.inspection_no,
  3627. a.item_no,
  3628. a.item_desc,
  3629. b.collection_source,
  3630. b.collection_method
  3631. from qc_iqc_detailed_record as a
  3632. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3633. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
  3634. order by a.order_id
  3635. </select>
  3636. <select id="getFAIInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3637. select
  3638. a.site,
  3639. a.bu_no,
  3640. a.inspection_no,
  3641. a.item_no,
  3642. a.item_desc,
  3643. b.collection_source,
  3644. b.collection_method
  3645. from qc_fai_detailed_record as a
  3646. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3647. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
  3648. order by a.order_id
  3649. </select>
  3650. <select id="getFQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3651. select
  3652. a.site,
  3653. a.bu_no,
  3654. a.inspection_no,
  3655. a.item_no,
  3656. a.item_desc,
  3657. b.collection_source,
  3658. b.collection_method
  3659. from qc_fqc_detailed_record as a
  3660. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3661. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
  3662. order by a.order_id
  3663. </select>
  3664. <select id="getIPQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3665. select
  3666. a.site,
  3667. a.bu_no,
  3668. a.inspection_no,
  3669. a.item_no,
  3670. a.item_desc,
  3671. b.collection_source,
  3672. b.collection_method
  3673. from qc_ipqc_detailed_record as a
  3674. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  3675. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
  3676. order by a.order_id
  3677. </select>
  3678. <delete id="deleteEquipmentDataAcquisition" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3679. delete from Equipment_data_acquisition
  3680. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3681. </delete>
  3682. <select id="getInspectionStandards" parameterType="com.xujie.sys.modules.pms.data.QcInspectionStandardData" resultType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3683. select
  3684. site,
  3685. bu_no,
  3686. template_id,
  3687. item_no,
  3688. default_value,
  3689. min_value,
  3690. max_value,
  3691. condition,
  3692. collection_source,
  3693. seq_no
  3694. from qc_inspection_standards
  3695. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3696. </select>
  3697. <delete id="deleteInspectionStandard" parameterType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3698. delete from qc_inspection_standards
  3699. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3700. </delete>
  3701. <delete id="deleteInspectionStandard2" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3702. delete from qc_inspection_standards
  3703. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3704. </delete>
  3705. <insert id="saveInspectionStandard">
  3706. INSERT INTO qc_inspection_standards
  3707. (site, bu_no, template_id, item_no, default_value, min_value, max_value, condition, collection_source, seq_no)
  3708. VALUES
  3709. <foreach collection="list" item="item" separator=",">
  3710. (#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.minValue}, #{item.maxValue}, #{item.condition}, #{item.collectionSource}, #{item.seqNo})
  3711. </foreach>
  3712. </insert>
  3713. <insert id="saveEquipmentFolderLocationList">
  3714. insert into Equipment_folder_location
  3715. (folder_path,equipment_no,site,bu_no,file_no,backup_folder_path,IP,suffix,equipment_desc,backup_photo_path,batch_date,port,register_address,
  3716. register_num,register_num_columntype,register_address_inspection,register_num_inspection,register_num_inspection_columntype,unit_id,
  3717. excel_compare_fields_x,excel_compare_fields_y,initial_line,data_row,skip_line,cutting_symbol,transparent_flag,Formula_calculation,
  3718. Formula,Group_calculation,regexp,repair_type,buzzer,create_by,create_time)
  3719. values (#{folderPath}, #{equipmentNo}, #{site}, #{buNo}, #{fileNo}, #{backupFolderPath}, #{IP}, #{suffix}, #{equipmentDesc}, #{backupPhotoPath}, #{batchDate}, #{port}, #{registerAddress},
  3720. #{registerNum}, #{registerNumColumntype}, #{registerAddressInspection}, #{registerNumInspection}, #{registerNumInspectionColumntype}, #{unitId},
  3721. #{excelCompareFieldsX}, #{excelCompareFieldsY}, #{initialLine}, #{dataRow}, #{skipLine}, #{cuttingSymbol}, #{transparentFlag}, #{formulaCalculation},
  3722. #{formula}, #{groupCalculation}, #{regexp}, #{repairType}, #{buzzer}, #{createBy}, getDate())
  3723. </insert>
  3724. <select id="getInspectionTemplateDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3725. select
  3726. site,
  3727. bu_no,
  3728. template_id,
  3729. item_no
  3730. <if test="flag == 'iqc'">
  3731. from qc_iqc_detailed_record
  3732. </if>
  3733. <if test="flag == 'ipqc'">
  3734. from qc_ipqc_detailed_record
  3735. </if>
  3736. <if test="flag == 'fqc'">
  3737. from qc_fqc_detailed_record
  3738. </if>
  3739. <if test="flag == 'fai'">
  3740. from qc_fai_detailed_record
  3741. </if>
  3742. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3743. order by order_id
  3744. </select>
  3745. <update id="updateEquipmentDataDetailInspectionNo" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3746. update Equipment_data_detail
  3747. set inspection_no = #{inspectionNo}
  3748. where id = #{id}
  3749. </update>
  3750. <delete id="deleteInspectionFiles" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3751. delete sys_oss
  3752. where order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref4 = #{buNo}
  3753. </delete>
  3754. <select id="getUpItemdata" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3755. select
  3756. top 1
  3757. site,
  3758. bu_no,
  3759. template_id,
  3760. ItemNo,
  3761. order_id
  3762. from qc_template_detailed
  3763. where #{orderId} > order_id
  3764. and site = #{site}
  3765. and bu_no= #{buNo}
  3766. and template_id = #{templateId}
  3767. order by order_id desc
  3768. </select>
  3769. <select id="getDownItemdata" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3770. select
  3771. top 1
  3772. site,
  3773. bu_no,
  3774. template_id,
  3775. ItemNo,
  3776. order_id
  3777. from qc_template_detailed
  3778. where order_id > #{orderId}
  3779. and site = #{site}
  3780. and bu_no= #{buNo}
  3781. and template_id = #{templateId}
  3782. order by order_id
  3783. </select>
  3784. <update id="updateQcItemOrder">
  3785. update qc_template_detailed
  3786. set order_id=#{orderId}
  3787. where site = #{site}
  3788. and bu_no= #{buNo}
  3789. and template_id = #{templateId}
  3790. and ItemNo = #{itemNo}
  3791. </update>
  3792. <select id="getQCDetailOrderId" resultType="Integer">
  3793. SELECT isnull(max(order_id), 0) + 1
  3794. from qc_template_detailed
  3795. where site = #{site}
  3796. and bu_no= #{buNo}
  3797. and template_id = #{templateId}
  3798. </select>
  3799. <select id="updateQCDetailOrderIdNull">
  3800. UPDATE qc_template_detailed
  3801. SET qc_template_detailed.order_id = oi.rn
  3802. FROM (SELECT
  3803. site,
  3804. bu_no,
  3805. template_id,
  3806. ItemNo,
  3807. ROW_NUMBER() OVER (PARTITION BY site,bu_no,template_id ORDER BY ItemNo) AS rn
  3808. FROM qc_template_detailed
  3809. ) as oi
  3810. where qc_template_detailed.template_id = oi.template_id
  3811. AND qc_template_detailed.ItemNo = oi.ItemNo
  3812. and qc_template_detailed.order_id is null
  3813. </select>
  3814. <select id="selectInfoByInspectionNo" resultType="com.xujie.sys.modules.pms.data.PoOrderRollNoData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3815. select
  3816. site,
  3817. citem_code,
  3818. inspection_no
  3819. from po_order_roll_no
  3820. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  3821. </select>
  3822. <update id="updateIQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3823. UPDATE qc_iqc_record
  3824. SET submit_flag = 'N',
  3825. state = '待检验',
  3826. cancel_check_by = #{updateBy},
  3827. cancel_check_date = getDate()
  3828. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3829. </update>
  3830. <update id="updateIQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3831. UPDATE qc_iqc_detailed_record
  3832. SET is_submit = 'N'
  3833. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3834. </update>
  3835. <update id="updateIQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3836. UPDATE qc_iqc_sub_detail_record
  3837. SET is_submit = 'N'
  3838. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3839. </update>
  3840. <update id="updateFAIMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3841. UPDATE qc_fai_record
  3842. SET submit_flag = 'N',
  3843. state = '待检验',
  3844. cancel_check_by = #{updateBy},
  3845. cancel_check_date = getDate()
  3846. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3847. </update>
  3848. <update id="updateFAIDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3849. UPDATE qc_fai_detailed_record
  3850. SET is_submit = 'N'
  3851. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3852. </update>
  3853. <update id="updateFAISubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3854. UPDATE qc_fai_sub_detail_record
  3855. SET is_submit = 'N'
  3856. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3857. </update>
  3858. <update id="updateIPQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3859. UPDATE qc_ipqc_record
  3860. SET submit_flag = 'N',
  3861. state = '待检验',
  3862. cancel_check_by = #{updateBy},
  3863. cancel_check_date = getDate()
  3864. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3865. </update>
  3866. <update id="updateIPQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3867. UPDATE qc_ipqc_detailed_record
  3868. SET is_submit = 'N'
  3869. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3870. </update>
  3871. <update id="updateIPQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3872. UPDATE qc_ipqc_sub_detail_record
  3873. SET is_submit = 'N'
  3874. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3875. </update>
  3876. <update id="updateFQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3877. UPDATE qc_fqc_record
  3878. SET submit_flag = 'N',
  3879. state = '待检验',
  3880. cancel_check_by = #{updateBy},
  3881. cancel_check_date = getDate()
  3882. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3883. </update>
  3884. <update id="updateFQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3885. UPDATE qc_fqc_detailed_record
  3886. SET is_submit = 'N'
  3887. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3888. </update>
  3889. <update id="updateFQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3890. UPDATE qc_fqc_sub_detail_record
  3891. SET is_submit = 'N'
  3892. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3893. </update>
  3894. <update id="updatePQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3895. UPDATE qc_pqc_record
  3896. SET submit_flag = 'N',
  3897. state = '待检验',
  3898. cancel_check_by = #{updateBy},
  3899. cancel_check_date = getDate()
  3900. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3901. </update>
  3902. <update id="updatePQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3903. UPDATE qc_pqc_detailed_record
  3904. SET is_submit = 'N'
  3905. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3906. </update>
  3907. <update id="updatePQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3908. UPDATE qc_pqc_sub_detail_record
  3909. SET is_submit = 'N'
  3910. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3911. </update>
  3912. <delete id="deleteReceivingTaskByInspectionNo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3913. delete receiving_task
  3914. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  3915. </delete>
  3916. <delete id="deleteEquipmentFolderLocationList">
  3917. delete from Equipment_folder_location
  3918. where id = #{id}
  3919. </delete>
  3920. <select id="getQMSTask" resultType="com.xujie.sys.modules.pms.data.QmsTaskData">
  3921. select
  3922. id,
  3923. site,
  3924. bu_no,
  3925. part_no,
  3926. operation_desc,
  3927. s_resourceid,
  3928. qtyrequired,
  3929. create_date,
  3930. create_by,
  3931. inspection_type,
  3932. type,
  3933. order_no,
  3934. seqno,
  3935. template_id,
  3936. um_id,
  3937. work_center_no
  3938. from QMS_soscheduledrouting_TASK
  3939. where ISNULL(delete_flag, '') <![CDATA[<>]]> 'Y'
  3940. </select>
  3941. <select id="getSuffixList" resultType="java.lang.String">
  3942. select distinct suffix from Equipment_folder_location
  3943. </select>
  3944. <select id="checkEquipmentFolderLocation" resultType="java.lang.Integer">
  3945. select count(1)
  3946. from Equipment_folder_location
  3947. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}
  3948. </select>
  3949. <update id="updateQMSTaskById">
  3950. UPDATE QMS_soscheduledrouting_TASK
  3951. SET delete_flag = 'Y'
  3952. WHERE id = #{id}
  3953. </update>
  3954. <select id="queryEquipmentFolderLocationList"
  3955. resultType="com.xujie.sys.modules.pms.data.QCEquipmentFolderLocation">
  3956. select efl.*,
  3957. dbo.get_bu_desc(efl.site, efl.bu_no) as buDesc
  3958. from Equipment_folder_location efl
  3959. <where>
  3960. <if test="params.site != null and params.site != ''">
  3961. and efl.site = #{params.site}
  3962. </if>
  3963. <if test="params.buNo != null and params.buNo != ''">
  3964. and efl.bu_no = #{params.buNo}
  3965. </if>
  3966. <if test="params.equipmentNo != null and params.equipmentNo != ''">
  3967. and efl.equipment_no like '%'+ #{params.equipmentNo} +'%'
  3968. </if>
  3969. <if test="params.equipmentDesc != null and params.equipmentDesc != ''">
  3970. and efl.equipment_desc like '%'+ #{params.equipmentDesc} +'%'
  3971. </if>
  3972. <if test="params.IP != null and params.IP != ''">
  3973. and efl.IP like '%'+ #{params.IP} +'%'
  3974. </if>
  3975. <if test="params.suffix != null and params.suffix != ''">
  3976. and efl.suffix like '%'+ #{params.suffix} +'%'
  3977. </if>
  3978. </where>
  3979. </select>
  3980. <update id="updateEquipmentFolderLocation">
  3981. UPDATE Equipment_folder_location
  3982. SET
  3983. folder_path = #{folderPath},
  3984. equipment_no = #{equipmentNo},
  3985. bu_no = #{buNo},
  3986. file_no = #{fileNo},
  3987. backup_folder_path = #{backupFolderPath},
  3988. IP = #{IP},
  3989. suffix = #{suffix},
  3990. equipment_desc = #{equipmentDesc},
  3991. backup_photo_path = #{backupPhotoPath},
  3992. batch_date = #{batchDate},
  3993. port = #{port},
  3994. register_address = #{registerAddress},
  3995. register_num = #{registerNum},
  3996. register_num_columntype = #{registerNumColumntype},
  3997. register_address_inspection = #{registerAddressInspection},
  3998. register_num_inspection = #{registerNumInspection},
  3999. register_num_inspection_columntype = #{registerNumInspectionColumntype},
  4000. unit_id = #{unitId},
  4001. excel_compare_fields_x = #{excelCompareFieldsX},
  4002. excel_compare_fields_y = #{excelCompareFieldsY},
  4003. initial_line = #{initialLine},
  4004. data_row = #{dataRow},
  4005. skip_line = #{skipLine},
  4006. cutting_symbol = #{cuttingSymbol},
  4007. transparent_flag = #{transparentFlag},
  4008. Formula_calculation = #{formulaCalculation},
  4009. Formula = #{formula},
  4010. Group_calculation = #{groupCalculation},
  4011. regexp = #{regexp},
  4012. repair_type = #{repairType},
  4013. buzzer = #{buzzer},
  4014. update_by = #{updateBy},
  4015. update_time = getDate()
  4016. WHERE id = #{id}
  4017. </update>
  4018. </mapper>