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.

4347 lines
202 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
1 year 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
10 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
10 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
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
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
3 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. <if test="operation !=null and operation != ''">
  1034. and qat.operation = #{operation}
  1035. </if>
  1036. </where>
  1037. </select>
  1038. <!-- 物料属性模板查重 -->
  1039. <select id="searchPartRepeat" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1040. SELECT
  1041. attribute_no,
  1042. template_id
  1043. FROM qc_attribute_template
  1044. WHERE attribute_no = #{attributeNo}
  1045. AND template_id = #{templateId}
  1046. AND attribute_type = #{attributeType}
  1047. AND special_field = #{specialField}
  1048. </select>
  1049. <!-- 新增物料属性模板 -->
  1050. <insert id="savePartAttributeDetails" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1051. INSERT INTO qc_attribute_template
  1052. (attribute_no, template_id, sampling_level_no, inspection_cycle, sampling_programme_no, AQL, AC, RE,
  1053. attribute_type, operation, manufacturer_id, resource_id, site, bu_no, inspection_type_no)
  1054. VALUES
  1055. (#{attributeNo}, #{templateId}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{samplingProgrammeNo}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  1056. #{attributeType}, #{operation}, #{manufacturerID}, #{resourceID}, #{site}, #{buNo}, #{inspectionTypeNo})
  1057. </insert>
  1058. <!-- 可选模板 -->
  1059. <select id="getTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1060. SELECT
  1061. qt.template_id,
  1062. qt.template_name,
  1063. qit.inspection_type_name
  1064. FROM qc_template as qt
  1065. LEFT JOIN qc_attribute_template as qat ON qat.template_id = qt.template_id and qat.attribute_no = #{attributeNo}
  1066. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
  1067. <where>
  1068. qt.site = #{site}
  1069. AND qat.attribute_no is null
  1070. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1071. AND qt.inspection_type_no = #{inspectionTypeNo}
  1072. </if>
  1073. <if test = "templateId != null and templateId != ''">
  1074. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1075. </if>
  1076. <if test = "templateName != null and templateName != ''">
  1077. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1078. </if>
  1079. </where>
  1080. </select>
  1081. <!-- 已有模板 -->
  1082. <select id="getPartTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1083. SELECT
  1084. qt.template_id,
  1085. qt.template_name,
  1086. qit.inspection_type_name,
  1087. qat.operation,
  1088. qat.manufacturer_id,
  1089. dbo.qc_get_supplier_name(qt.site, qat.manufacturer_id) as manufacturerName,
  1090. qat.resource_id
  1091. FROM qc_attribute_template as qat
  1092. 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
  1093. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1094. WHERE qt.site = #{site} AND qat.attribute_no = #{attributeNo} and qt.bu_no = #{buNo}
  1095. </select>
  1096. <!-- 物料可选模板 -->
  1097. <select id="getTemplateListAll" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1098. SELECT
  1099. qt.template_id,
  1100. qt.template_name,
  1101. qit.inspection_type_name
  1102. FROM qc_template as qt
  1103. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1104. <where>
  1105. qt.site = #{site} and qt.bu_no = #{buNo}
  1106. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1107. AND qt.inspection_type_no = #{inspectionTypeNo}
  1108. </if>
  1109. <if test = "templateId != null and templateId != ''">
  1110. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1111. </if>
  1112. <if test = "templateName != null and templateName != ''">
  1113. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1114. </if>
  1115. </where>
  1116. </select>
  1117. <!-- 删除物料属性模板 -->
  1118. <delete id="deletePartAttributeDetails" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1119. DELETE FROM qc_attribute_template
  1120. <where>
  1121. site = #{site} and bu_no = #{buNo} and attribute_no = #{attributeNo} and template_id = #{templateId} and attribute_type = #{attributeType}
  1122. <if test = "operation != null and operation != ''">
  1123. and operation = #{operation}
  1124. </if>
  1125. <if test = "resourceID != null and resourceID != ''">
  1126. and resource_id = #{resourceID}
  1127. </if>
  1128. <if test = "manufacturerID != null and manufacturerID != ''">
  1129. and manufacturer_id = #{manufacturerID}
  1130. </if>
  1131. </where>
  1132. </delete>
  1133. <!-- 查询模板的基础数据 -->
  1134. <select id="selectTemplateData" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1135. SELECT
  1136. template_id,
  1137. template_name,
  1138. sampling_programme_no,
  1139. sampling_level_no,
  1140. inspection_cycle,
  1141. AQL,
  1142. AC,
  1143. RE,
  1144. inspection_type_no
  1145. FROM qc_template
  1146. WHERE site = #{site} AND template_id = #{templateId} and bu_no = #{buNo}
  1147. </select>
  1148. <!-- 新增物料属性模板详情 -->
  1149. <update id="saveAttributeDetailed" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1150. UPDATE qc_attribute_template
  1151. SET sampling_level_no = #{samplingLevelNo},
  1152. inspection_cycle = #{inspectionCycle,jdbcType=DECIMAL},
  1153. sampling_programme_no = #{samplingProgrammeNo},
  1154. AQL = #{aql,jdbcType=DECIMAL},
  1155. AC = #{ac,jdbcType=DECIMAL},
  1156. RE = #{re,jdbcType=DECIMAL}
  1157. <where>
  1158. site = #{site} and attribute_no = #{attributeNo} AND template_id = #{templateId} AND attribute_type = #{attributeType} and bu_no = #{buNo}
  1159. <if test = "operation != null and operation != ''">
  1160. AND operation = #{operation}
  1161. </if>
  1162. <if test = "resourceID != null and resourceID != ''">
  1163. AND resource_id = #{resourceID}
  1164. </if>
  1165. <if test = "manufacturerID != null and manufacturerID != ''">
  1166. AND manufacturer_id = #{manufacturerID}
  1167. </if>
  1168. </where>
  1169. </update>
  1170. <!-- 更新物料属性修改时间 -->
  1171. <update id="updatePartAttributeTime" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  1172. UPDATE qc_part_attribute
  1173. SET update_date = getDate(),
  1174. update_by = #{updateBy}
  1175. WHERE site = #{site} and attribute_no = #{attributeNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1176. </update>
  1177. <!-- ================================================= 类别属性设置维护 ================================================= -->
  1178. <!-- 查询类别属性 -->
  1179. <select id="qcFamilyAttributeSearch" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1180. SELECT
  1181. qa.site,
  1182. qa.bu_no,
  1183. dbo.get_bu_desc(qa.site, qa.bu_no) as buDesc,
  1184. qa.attribute_no as familyID,
  1185. pf.FamilyName,
  1186. qa.supplier_no,
  1187. qa.attribute_remark,
  1188. qa.create_time,
  1189. qa.create_by,
  1190. qa.update_date,
  1191. qa.update_by,
  1192. qa.attribute_type
  1193. FROM qc_part_attribute as qa
  1194. LEFT JOIN PartFamily as pf on qa.attribute_no = pf.FamilyID and qa.site = pf.site
  1195. <where>
  1196. qa.site in (select site from eam_access_site where username = #{query.userName})
  1197. and (qa.site + '-' + qa.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1198. and qa.attribute_type = #{query.attributeType}
  1199. <if test="query.buDesc != null and query.buDesc != ''">
  1200. AND dbo.get_bu_desc ( qa.site, qa.bu_no ) = #{query.buDesc}
  1201. </if>
  1202. <if test = "query.familyID != null and query.familyID != ''">
  1203. AND qa.attribute_no LIKE '%' + #{query.familyID}+'%'
  1204. </if>
  1205. <if test = "query.familyName != null and query.familyName != ''">
  1206. AND pf.FamilyName LIKE '%' + #{query.familyName}+'%'
  1207. </if>
  1208. </where>
  1209. </select>
  1210. <!-- 新增类别属性 -->
  1211. <insert id="qcFamilyAttributeSave" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1212. INSERT INTO qc_part_attribute (attribute_no, attribute_remark, create_time, create_by, attribute_type, site, bu_no)
  1213. VALUES(#{familyID}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{buNo})
  1214. </insert>
  1215. <!-- 删除分类属性 -->
  1216. <delete id="qcFamilyAttributeDelete" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1217. DELETE FROM qc_part_attribute
  1218. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1219. </delete>
  1220. <!-- 删除分类属性模板 -->
  1221. <delete id="deleteFamilyAttributeTemplate" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  1222. DELETE FROM qc_attribute_template
  1223. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1224. </delete>
  1225. <!-- ================================================= 抽样方案维护 ================================================= -->
  1226. <!-- 查询类别属性 -->
  1227. <select id="samplingProgrammeSearch" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1228. SELECT
  1229. site,
  1230. bu_no,
  1231. dbo.get_bu_desc(site, bu_no) as buDesc,
  1232. sampling_programme_no,
  1233. sampling_programme_desc,
  1234. sampling_programme_code,
  1235. create_time,
  1236. create_by,
  1237. dbo.getOperatorDesc(site, create_by) as createByDesc,
  1238. update_date,
  1239. update_by,
  1240. dbo.getOperatorDesc(site, update_by) as updateByDesc
  1241. FROM qc_sampling_inspection_programme
  1242. <where>
  1243. site in (select site from eam_access_site where username = #{query.userName})
  1244. and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1245. <if test="query.buDesc != null and query.buDesc != ''">
  1246. AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
  1247. </if>
  1248. <if test = "query.samplingProgrammeNo != null and query.samplingProgrammeNo != ''">
  1249. AND sampling_programme_no LIKE '%' + #{query.samplingProgrammeNo}+'%'
  1250. </if>
  1251. <if test = "query.samplingProgrammeCode != null and query.samplingProgrammeCode != ''">
  1252. AND sampling_programme_code LIKE '%' + #{query.samplingProgrammeCode}+'%'
  1253. </if>
  1254. <if test = "query.samplingProgrammeDesc != null and query.samplingProgrammeDesc != ''">
  1255. AND sampling_programme_desc LIKE '%' + #{query.samplingProgrammeDesc}+'%'
  1256. </if>
  1257. </where>
  1258. </select>
  1259. <!-- 新增抽样方案 -->
  1260. <insert id="samplingProgrammeSave" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1261. 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)
  1262. VALUES(#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{samplingProgrammeCode}, getDate(), #{createBy}, getDate(), #{updateBy})
  1263. </insert>
  1264. <!-- 删除抽样方案 -->
  1265. <delete id="samplingProgrammeDelete" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1266. DELETE FROM qc_sampling_inspection_programme
  1267. WHERE site = #{site} and bu_no = #{buNo}
  1268. AND sampling_programme_no = #{samplingProgrammeNo}
  1269. </delete>
  1270. <!-- 删除抽样方案中的矩阵 -->
  1271. <delete id="deletePlanByProgrammeNo" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1272. DELETE FROM qc_programme_plan
  1273. WHERE sampling_programme_no = #{samplingProgrammeNo} and site = #{site} and bu_no = #{buNo}
  1274. </delete>
  1275. <!-- 根据名称查询抽样方案 -->
  1276. <select id="selectSamplingProgrammeByDesc" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1277. SELECT
  1278. site,
  1279. bu_no,
  1280. sampling_programme_no,
  1281. sampling_programme_desc
  1282. FROM qc_sampling_inspection_programme
  1283. WHERE sampling_programme_desc = #{samplingProgrammeDesc} AND site = #{site} and bu_no = #{buNo}
  1284. </select>
  1285. <!-- 获取最大抽样方案编码 -->
  1286. <select id="queryLastSamplingProgrammeNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1287. SELECT top 1 sampling_programme_no
  1288. FROM qc_sampling_inspection_programme
  1289. where site = #{site} and bu_no = #{buNo}
  1290. ORDER BY sampling_programme_no Desc
  1291. </select>
  1292. <!-- 搜索抽样方案中的矩阵 -->
  1293. <select id="searchSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1294. SELECT
  1295. qpp.site,
  1296. qpp.bu_no,
  1297. qpp.sampling_programme_no,
  1298. qsip.sampling_plan_no,
  1299. qsip.sampling_plan_Desc,
  1300. qsip.sampling_qty_no,
  1301. qsiq.sampling_qty_desc,
  1302. qsiq.sampling_qty,
  1303. qsip.sampling_qty_rank_no,
  1304. qsiqr.sampling_qty_rank_desc,
  1305. qsiqr.min_qty,
  1306. qsiqr.max_qty,
  1307. qsip.sampling_level_no,
  1308. qsil.sampling_level_desc,
  1309. qsip.sampling_plan_active
  1310. FROM qc_programme_plan as qpp
  1311. 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
  1312. 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
  1313. 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
  1314. 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
  1315. WHERE qpp.sampling_programme_no = #{samplingProgrammeNo} and qpp.site = #{site} and qpp.bu_no = #{buNo}
  1316. </select>
  1317. <!-- 获取该方案不包含的矩阵 -->
  1318. <select id="getPlanList" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1319. SELECT
  1320. qip.sampling_plan_no,
  1321. qip.sampling_plan_desc
  1322. FROM qc_sampling_inspection_plan as qip
  1323. 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
  1324. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no is null
  1325. </select>
  1326. <!-- 获取当前方案所包含的矩阵 -->
  1327. <select id="getProgrammePlanList" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1328. SELECT
  1329. qip.sampling_plan_no,
  1330. qip.sampling_plan_desc
  1331. FROM qc_programme_plan as qpp
  1332. 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
  1333. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no = #{samplingProgrammeNo}
  1334. </select>
  1335. <!-- 查重 -->
  1336. <select id="searchPlanRepeat" resultType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1337. SELECT
  1338. sampling_plan_no,
  1339. sampling_programme_no
  1340. FROM qc_programme_plan
  1341. WHERE sampling_programme_no = #{samplingProgrammeNo} AND sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1342. </select>
  1343. <!-- 新增抽样方案中的矩阵 -->
  1344. <insert id="saveSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1345. INSERT INTO qc_programme_plan (site, bu_no, sampling_programme_no, sampling_plan_no)
  1346. VALUES (#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingPlanNo})
  1347. </insert>
  1348. <!-- 更新抽样方案修改时间 -->
  1349. <update id="updateSamplingInspectionProgrammeDate" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1350. UPDATE qc_sampling_inspection_programme
  1351. SET update_date = getDate(),
  1352. update_by = #{updateBy}
  1353. WHERE site = #{site} AND sampling_programme_no = #{samplingProgrammeNo} and bu_no = #{buNo}
  1354. </update>
  1355. <!-- 删除抽样方案中的矩阵 -->
  1356. <delete id="deleteSamplingProgrammeDetails" parameterType="com.xujie.sys.modules.pms.data.QcSamplingInspectionProgrammeData">
  1357. DELETE FROM qc_programme_plan
  1358. WHERE sampling_programme_no = #{samplingProgrammeNo} and sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1359. </delete>
  1360. <!-- ================================================= FAI检验维护 ================================================= -->
  1361. <!-- 查询FAI基础数据 -->
  1362. <select id="selectFAIBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1363. SELECT
  1364. top 1
  1365. a.orderno as orderNo,
  1366. j.part_no,
  1367. j.part_desc,
  1368. c.operation_desc,
  1369. b.approve_qty as rollQty,
  1370. a.s_resourceid as resourceId,
  1371. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  1372. a.itemno as itemNo,
  1373. a.id as ssrId
  1374. FROM soscheduledrouting as a
  1375. LEFT JOIN sfdc as b
  1376. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  1377. select min(sfdc.id)
  1378. from sfdc
  1379. group by sfdc.assjob_seq_no, site
  1380. )
  1381. LEFT JOIN so_routing as c
  1382. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  1383. LEFT JOIN part j
  1384. ON a.site = j.site and a.part_no = j.part_no
  1385. WHERE a.itemno = '10'
  1386. AND a.id not in (select ssr_id from qc_fai_record)
  1387. AND b.approve_qty is not null
  1388. ORDER BY a.id desc
  1389. </select>
  1390. <!-- 获取该物料属性下维护的iqc -->
  1391. <select id="selectPartAttributeByPartNo" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1392. SELECT
  1393. qat.site,
  1394. qat.bu_no,
  1395. qat.attribute_no,
  1396. qat.template_id,
  1397. qat.sampling_level_no,
  1398. qsil.sampling_level_desc,
  1399. qat.inspection_cycle,
  1400. qat.sampling_programme_no,
  1401. qsip.sampling_programme_desc,
  1402. qat.AQL,
  1403. qat.AC,
  1404. qat.RE,
  1405. qt.default_sampling_quantity,
  1406. qt.default_sampling_proportion
  1407. FROM qc_attribute_template as qat
  1408. 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
  1409. 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
  1410. 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
  1411. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1412. AND qat.attribute_no = #{partNo}
  1413. AND qat.attribute_type = #{attributeType}
  1414. AND qt.inspection_type_no = #{inspectionTypeNo}
  1415. AND qat.manufacturer_id = #{supplierNo}
  1416. </select>
  1417. <!-- 获取该物料属性下维护的ipqc -->
  1418. <select id="selectPartAttributeByOperationAndResource" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1419. SELECT
  1420. qat.site,
  1421. qat.bu_no,
  1422. qat.attribute_no,
  1423. qat.template_id,
  1424. qat.sampling_level_no,
  1425. qsil.sampling_level_desc,
  1426. qat.inspection_cycle,
  1427. qat.sampling_programme_no,
  1428. qsip.sampling_programme_desc,
  1429. qat.AQL,
  1430. qat.AC,
  1431. qat.RE,
  1432. qt.default_sampling_quantity,
  1433. qt.default_sampling_proportion
  1434. FROM qc_attribute_template as qat
  1435. 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
  1436. 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
  1437. 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
  1438. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1439. AND qat.attribute_no = #{partNo}
  1440. AND qat.attribute_type = #{attributeType1}
  1441. AND qt.inspection_type_no = #{inspectionTypeNo}
  1442. AND qat.operation = #{operationDesc}
  1443. AND qat.resource_id = #{resourceId}
  1444. </select>
  1445. <!-- 获取模板详情 -->
  1446. <select id="selectTemplate" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1447. SELECT
  1448. qt.site,
  1449. qt.bu_no,
  1450. qt.template_id,
  1451. qt.sampling_level_no,
  1452. qsil.sampling_level_desc,
  1453. qt.inspection_cycle,
  1454. qt.sampling_programme_no,
  1455. qsip.sampling_programme_desc,
  1456. qt.AQL,
  1457. qt.AC,
  1458. qt.RE,
  1459. qt.default_sampling_quantity,
  1460. qt.default_sampling_proportion
  1461. FROM qc_template as qt
  1462. 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
  1463. 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
  1464. WHERE qt.site = #{site} and qt.template_id = #{templateId} and qt.bu_no = #{buNo}
  1465. </select>
  1466. <!-- 新增FAI主记录信息 -->
  1467. <insert id="saveFAIRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1468. 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)
  1469. 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})
  1470. </insert>
  1471. <insert id="saveFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1472. INSERT INTO qc_fai_detailed_record
  1473. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1474. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1475. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  1476. VALUES
  1477. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  1478. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  1479. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  1480. </insert>
  1481. <!-- 新增FAI明细记录信息 -->
  1482. <insert id="saveFAIDetailedRecords">
  1483. INSERT INTO qc_fai_detailed_record
  1484. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1485. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1486. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  1487. VALUES
  1488. <foreach collection="list" item="item" separator=",">
  1489. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  1490. #{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},
  1491. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  1492. </foreach>
  1493. </insert>
  1494. <!-- 查询FAI主记录信息 -->
  1495. <select id="qcFAIInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1496. SELECT
  1497. a.inspection_no,
  1498. a.site,
  1499. a.bu_no,
  1500. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  1501. a.state,
  1502. a.inspection_result,
  1503. a.task_date,
  1504. a.inspection_type_no,
  1505. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  1506. a.inspection_cycle,
  1507. a.order_no,
  1508. a.operation_desc,
  1509. a.resource_id,
  1510. r.resource_desc,
  1511. a.part_no,
  1512. d.part_desc,
  1513. d.cinv_source_code as cinvSourceCode,
  1514. d.sku as sku,
  1515. d.invdefinetype as invdefinetype,
  1516. a.inspection_remark,
  1517. a.roll_qty,
  1518. a.sampling_qty,
  1519. a.disposal_measures,
  1520. a.disposal_remark,
  1521. a.inspector_date,
  1522. a.inspector_no,
  1523. u.user_display as inspectorName,
  1524. a.ssr_id,
  1525. a.unqualified_qty,
  1526. a.submit_flag,
  1527. a.seq_no,
  1528. a.batch_roll_no,
  1529. a.special_requirements,
  1530. a.work_center_no,
  1531. a.roll_no,
  1532. a.um_id,
  1533. um.UMName as umName,
  1534. a.action_date,
  1535. a.action_by,
  1536. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  1537. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  1538. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  1539. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  1540. a.pass_qty,
  1541. a.not_pass_qty,
  1542. a.batch_qualified_qty
  1543. FROM qc_fai_record as a
  1544. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  1545. left join sys_user as u on a.inspector_no = u.username
  1546. 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
  1547. left join UM as um on a.site = um.site and a.um_id = um.UMID
  1548. <where>
  1549. a.site in (select site from eam_access_site where username = #{query.userName})
  1550. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1551. <if test="query.buNo != null and query.buNo != ''">
  1552. AND a.bu_no = #{query.buNo}
  1553. </if>
  1554. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  1555. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  1556. </if>
  1557. <if test = "query.partNo != null and query.partNo != ''">
  1558. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  1559. </if>
  1560. <if test = "query.partDesc != null and query.partDesc != ''">
  1561. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  1562. </if>
  1563. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  1564. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  1565. </if>
  1566. <if test = "query.sku != null and query.sku != ''">
  1567. AND d.sku LIKE '%' + #{query.sku} + '%'
  1568. </if>
  1569. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  1570. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  1571. </if>
  1572. <if test = "query.states != null and query.states.size > 0">
  1573. AND a.state in
  1574. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  1575. #{item}
  1576. </foreach>
  1577. </if>
  1578. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  1579. AND a.inspection_result = #{query.inspectionResult}
  1580. </if>
  1581. <if test = "query.orderNo != null and query.orderNo != ''">
  1582. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  1583. </if>
  1584. <if test = "query.seqNo != null and query.seqNo != ''">
  1585. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  1586. </if>
  1587. <if test = "query.operationDesc != null and query.operationDesc != ''">
  1588. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  1589. </if>
  1590. <if test="query.startDate != null">
  1591. AND a.inspector_date >= #{query.startDate}
  1592. </if>
  1593. <if test="query.endDate != null">
  1594. AND #{query.endDate} >= a.inspector_date
  1595. </if>
  1596. <if test="query.startDate2 != null">
  1597. AND a.task_date >= #{query.startDate2}
  1598. </if>
  1599. <if test="query.endDate2 != null">
  1600. AND #{query.endDate2} >= a.task_date
  1601. </if>
  1602. </where>
  1603. ORDER BY
  1604. CASE WHEN a.state = '待检验' THEN 1
  1605. WHEN a.state = '待审核' THEN 2
  1606. WHEN a.state = '已完成' THEN 3
  1607. END, a.task_date desc
  1608. </select>
  1609. <!-- 获取物料的类别编码 -->
  1610. <select id="selectFamilyIdByPartNo" parameterType="string" resultType="string">
  1611. SELECT FamilyID
  1612. FROM part
  1613. WHERE part_no = #{partNo} AND site = #{site}
  1614. </select>
  1615. <!-- FAI明细记录查询 -->
  1616. <select id="faiDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1617. SELECT
  1618. a.site,
  1619. a.bu_no,
  1620. a.inspection_no,
  1621. a.order_no,
  1622. a.template_id,
  1623. a.sampling_level_no,
  1624. a.sampling_level_desc,
  1625. a.sampling_programme_no,
  1626. a.sampling_programme_desc,
  1627. a.AQL,
  1628. a.AC,
  1629. a.RE,
  1630. a.item_no,
  1631. a.item_desc,
  1632. a.object_id,
  1633. a.object_desc,
  1634. a.default_value,
  1635. a.min_value,
  1636. a.max_value,
  1637. a.text_value,
  1638. a.number_value,
  1639. a.value_type_db,
  1640. a.value_type,
  1641. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  1642. a.is_submit,
  1643. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  1644. a.sampling_qty,
  1645. dbo.qc_get_fai_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  1646. c.method_no,
  1647. c.method_name,
  1648. c.method_remark
  1649. FROM qc_fai_detailed_record as a
  1650. 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
  1651. 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
  1652. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  1653. order by a.order_id
  1654. </select>
  1655. <!-- 修改FAI主记录信息 -->
  1656. <update id="updateFAIMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1657. UPDATE qc_fai_record
  1658. SET disposal_measures = #{disposalMeasures},
  1659. disposal_remark = #{disposalRemark},
  1660. inspection_result = #{inspectionResult},
  1661. inspector_no = #{inspectorNo},
  1662. state = #{state},
  1663. inspection_remark = #{inspectionRemark},
  1664. inspector_date = getDate(),
  1665. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  1666. roll_qty = #{rollQty,jdbcType=DECIMAL},
  1667. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  1668. pass_qty = #{passQty,jdbcType=DECIMAL},
  1669. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  1670. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  1671. submit_date = getDate()
  1672. WHERE site = #{site} AND inspection_no = #{inspectionNo} and bu_no = #{buNo}
  1673. </update>
  1674. <!-- 修改FAI明细记录信息 -->
  1675. <update id="updateFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1676. UPDATE qc_fai_detailed_record
  1677. SET item_result = #{itemResult},
  1678. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  1679. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  1680. text_value = #{textValue},
  1681. number_value = #{numberValue,jdbcType=DECIMAL}
  1682. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1683. </update>
  1684. <!-- 修改子明细提交标识 -->
  1685. <update id="updateSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1686. UPDATE qc_fai_sub_detail_record
  1687. SET is_submit = 'Y'
  1688. WHERE inspection_no = #{inspectionNo}
  1689. </update>
  1690. <!-- 删除FAI检验记录 -->
  1691. <delete id="deleteFAIRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1692. DELETE FROM qc_fai_record
  1693. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1694. </delete>
  1695. <!-- 删除FAI明细记录信息 -->
  1696. <delete id="deleteFAIDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1697. DELETE FROM qc_fai_detailed_record
  1698. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1699. </delete>
  1700. <!-- 删除FAI子明细记录信息 -->
  1701. <delete id="deleteFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1702. DELETE FROM qc_fai_sub_detail_record
  1703. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1704. </delete>
  1705. <!-- 修改FAI主记录标识为已提交 -->
  1706. <update id="updateFAIMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1707. UPDATE qc_fai_record
  1708. SET submit_flag = 'Y',
  1709. state = '已完成',
  1710. submit_date = getDate()
  1711. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1712. </update>
  1713. <!-- 修改FAI明细记录标识为已提交 -->
  1714. <update id="updateFAIDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1715. UPDATE qc_fai_detailed_record
  1716. SET is_submit = 'Y'
  1717. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1718. </update>
  1719. <!-- 修改子明细记录标识为已提交 -->
  1720. <update id="updateFAISubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1721. UPDATE qc_fai_sub_detail_record
  1722. SET is_submit = 'Y'
  1723. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1724. </update>
  1725. <!-- 查询FAI检验记录是否已提交 -->
  1726. <select id="checkFAIIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1727. SELECT submit_flag
  1728. FROM qc_fai_record
  1729. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  1730. </select>
  1731. <!-- 删除子明细的老数据 -->
  1732. <delete id="delFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  1733. DELETE FROM qc_fai_sub_detail_record
  1734. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1735. </delete>
  1736. <!-- 新增FAI子明细信息 -->
  1737. <insert id="saveFAISubDetailed">
  1738. INSERT INTO qc_fai_sub_detail_record
  1739. (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)
  1740. VALUES
  1741. <foreach collection="list" item="item" separator=",">
  1742. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  1743. </foreach>
  1744. </insert>
  1745. <!-- 查询FAI的子明细 -->
  1746. <select id="selectFAISubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  1747. SELECT
  1748. site,
  1749. bu_no,
  1750. sub_detail_value,
  1751. sampling_location,
  1752. is_submit,
  1753. sampling_location_b,
  1754. num,
  1755. sub_detail_value_b,
  1756. sub_detail_value_c,
  1757. sub_detail_value_d,
  1758. sub_detail_value_e
  1759. FROM qc_fai_sub_detail_record
  1760. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  1761. <if test = "collectionDataContent != null and collectionDataContent != ''">
  1762. AND sub_detail_value ${collectionDataContent}
  1763. </if>
  1764. </select>
  1765. <!-- 获取该项目的子明细值 -->
  1766. <select id="selectFAISubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  1767. SELECT sub_detail_value,
  1768. sampling_location,
  1769. is_submit
  1770. FROM qc_fai_sub_detail_record
  1771. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  1772. </select>
  1773. <!-- ================================================= IPQC检验维护 ================================================= -->
  1774. <!-- 查询IPQC基础数据 -->
  1775. <select id="selectIPQCBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1776. SELECT
  1777. top 1
  1778. a.orderno as orderNo,
  1779. j.part_no,
  1780. j.part_desc,
  1781. c.operation_desc,
  1782. b.approve_qty as rollQty,
  1783. a.s_resourceid as resourceId,
  1784. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  1785. a.itemno as itemNo,
  1786. a.id as ssrId
  1787. FROM soscheduledrouting as a
  1788. LEFT JOIN sfdc as b
  1789. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  1790. select max(sfdc.id)
  1791. from sfdc
  1792. group by sfdc.assjob_seq_no, site
  1793. )
  1794. LEFT JOIN so_routing as c
  1795. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  1796. LEFT JOIN part j
  1797. ON a.site = j.site and a.part_no = j.part_no
  1798. LEFT JOIN (select ssr_id from qc_ipqc_record where check_type = '末件检') as temp
  1799. ON a.id = temp.ssr_id
  1800. WHERE b.approve_qty is not null and temp.ssr_id is null
  1801. ORDER BY a.id desc
  1802. </select>
  1803. <select id="qcExec" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="string" statementType="CALLABLE">
  1804. {CALL
  1805. getIpqcRecord(#{site,mode=IN,jdbcType=VARCHAR})
  1806. }
  1807. </select>
  1808. <insert id="saveIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1809. INSERT INTO qc_ipqc_detailed_record
  1810. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1811. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1812. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  1813. VALUES
  1814. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  1815. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  1816. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  1817. </insert>
  1818. <!-- 新增IPQC明细记录信息 -->
  1819. <insert id="saveIPQCDetailedRecords">
  1820. INSERT INTO qc_ipqc_detailed_record
  1821. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1822. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1823. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  1824. VALUES
  1825. <foreach collection="list" item="item" separator=",">
  1826. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  1827. #{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},
  1828. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  1829. </foreach>
  1830. </insert>
  1831. <!-- 新增IPQC主记录信息 -->
  1832. <insert id="saveIPQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1833. INSERT INTO qc_ipqc_record
  1834. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  1835. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  1836. VALUES
  1837. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  1838. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  1839. </insert>
  1840. <!-- 查询IPQC主记录信息 -->
  1841. <select id="qcIPQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1842. SELECT
  1843. a.inspection_no,
  1844. a.site,
  1845. a.bu_no,
  1846. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  1847. a.state,
  1848. a.inspection_result,
  1849. a.task_date,
  1850. a.inspection_type_no,
  1851. a.inspection_cycle,
  1852. a.order_no,
  1853. a.operation_desc,
  1854. a.resource_id,
  1855. r.resource_desc,
  1856. a.part_no,
  1857. d.part_desc,
  1858. d.cinv_source_code as cinvSourceCode,
  1859. d.sku as sku,
  1860. d.invdefinetype as invdefinetype,
  1861. a.inspection_remark,
  1862. a.roll_qty,
  1863. a.sampling_qty,
  1864. a.disposal_measures,
  1865. a.disposal_remark,
  1866. a.inspector_date,
  1867. a.inspector_no,
  1868. u.user_display as inspectorName,
  1869. a.ssr_id,
  1870. a.unqualified_qty,
  1871. a.submit_flag,
  1872. a.seq_no,
  1873. a.batch_roll_no,
  1874. a.special_requirements,
  1875. a.work_center_no,
  1876. a.roll_no,
  1877. a.um_id,
  1878. um.UMName as umName,
  1879. a.action_date,
  1880. a.action_by,
  1881. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  1882. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  1883. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  1884. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  1885. a.pass_qty,
  1886. a.not_pass_qty,
  1887. a.batch_qualified_qty
  1888. FROM qc_ipqc_record as a
  1889. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  1890. left join sys_user as u on a.inspector_no = u.username
  1891. 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
  1892. left join UM as um on a.site = um.site and a.um_id = um.UMID
  1893. <where>
  1894. a.site in (select site from eam_access_site where username = #{query.userName})
  1895. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  1896. <if test="query.buNo != null and query.buNo != ''">
  1897. AND a.bu_no = #{query.buNo}
  1898. </if>
  1899. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  1900. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  1901. </if>
  1902. <if test = "query.partNo != null and query.partNo != ''">
  1903. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  1904. </if>
  1905. <if test = "query.partDesc != null and query.partDesc != ''">
  1906. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  1907. </if>
  1908. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  1909. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  1910. </if>
  1911. <if test = "query.sku != null and query.sku != ''">
  1912. AND d.sku LIKE '%' + #{query.sku} + '%'
  1913. </if>
  1914. <if test = "query.states != null and query.states.size > 0">
  1915. AND a.state in
  1916. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  1917. #{item}
  1918. </foreach>
  1919. </if>
  1920. <if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  1921. AND a.inspection_type_no = #{query.inspectionTypeNo}
  1922. </if>
  1923. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  1924. AND a.inspection_result = #{query.inspectionResult}
  1925. </if>
  1926. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  1927. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  1928. </if>
  1929. <if test = "query.orderNo != null and query.orderNo != ''">
  1930. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  1931. </if>
  1932. <if test = "query.seqNo != null and query.seqNo != ''">
  1933. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  1934. </if>
  1935. <if test = "query.operationDesc != null and query.operationDesc != ''">
  1936. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  1937. </if>
  1938. <if test="query.startDate != null">
  1939. AND a.inspector_date >= #{query.startDate}
  1940. </if>
  1941. <if test="query.endDate != null">
  1942. AND #{query.endDate} >= a.inspector_date
  1943. </if>
  1944. <if test="query.startDate2 != null">
  1945. AND a.task_date >= #{query.startDate2}
  1946. </if>
  1947. <if test="query.endDate2 != null">
  1948. AND #{query.endDate2} >= a.task_date
  1949. </if>
  1950. </where>
  1951. ORDER BY
  1952. CASE WHEN a.state = '待检验' THEN 1
  1953. WHEN a.state = '待审核' THEN 2
  1954. WHEN a.state = '已完成' THEN 3
  1955. END, a.task_date desc
  1956. </select>
  1957. <!-- IPQC明细记录查询 -->
  1958. <select id="ipqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1959. SELECT
  1960. a.site,
  1961. a.bu_no,
  1962. a.inspection_no,
  1963. a.order_no,
  1964. a.template_id,
  1965. a.sampling_level_no,
  1966. a.sampling_level_desc,
  1967. a.sampling_programme_no,
  1968. a.sampling_programme_desc,
  1969. a.AQL,
  1970. a.AC,
  1971. a.RE,
  1972. a.item_no,
  1973. a.item_desc,
  1974. a.object_id,
  1975. a.object_desc,
  1976. a.default_value,
  1977. a.min_value,
  1978. a.max_value,
  1979. a.text_value,
  1980. a.number_value,
  1981. a.value_type_db,
  1982. a.value_type,
  1983. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  1984. a.is_submit,
  1985. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  1986. a.sampling_qty,
  1987. dbo.qc_get_ipqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  1988. c.method_no,
  1989. c.method_name,
  1990. c.method_remark
  1991. FROM qc_ipqc_detailed_record as a
  1992. 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
  1993. 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
  1994. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  1995. order by a.order_id
  1996. </select>
  1997. <!-- 删除IPQC检验记录 -->
  1998. <delete id="deleteIPQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  1999. DELETE FROM qc_ipqc_record
  2000. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2001. </delete>
  2002. <!-- 删除IPQC明细记录信息 -->
  2003. <delete id="deleteIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2004. DELETE FROM qc_ipqc_detailed_record
  2005. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2006. </delete>
  2007. <!-- 删除IPQC子明细记录信息 -->
  2008. <delete id="deleteIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2009. DELETE FROM qc_ipqc_sub_detail_record
  2010. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2011. </delete>
  2012. <!-- 修改IPQC主记录信息 -->
  2013. <update id="updateIPQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2014. UPDATE qc_ipqc_record
  2015. SET disposal_measures = #{disposalMeasures},
  2016. disposal_remark = #{disposalRemark},
  2017. inspection_result = #{inspectionResult},
  2018. inspector_no = #{inspectorNo},
  2019. state = #{state},
  2020. inspection_remark = #{inspectionRemark},
  2021. inspector_date = getDate(),
  2022. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2023. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2024. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2025. pass_qty = #{passQty,jdbcType=DECIMAL},
  2026. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2027. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2028. submit_date = getDate()
  2029. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2030. </update>
  2031. <!-- 修改IPQC明细记录信息 -->
  2032. <update id="updateIPQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2033. UPDATE qc_ipqc_detailed_record
  2034. SET item_result = #{itemResult},
  2035. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2036. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2037. text_value = #{textValue},
  2038. number_value = #{numberValue,jdbcType=DECIMAL}
  2039. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2040. </update>
  2041. <!-- 修改IPQC主记录标识为已提交 -->
  2042. <update id="updateIPQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2043. UPDATE qc_ipqc_record
  2044. SET submit_flag = 'Y',
  2045. state = '已完成',
  2046. submit_date = getDate()
  2047. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2048. </update>
  2049. <!-- 修改IPQC明细记录标识为已提交 -->
  2050. <update id="updateIPQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2051. UPDATE qc_ipqc_detailed_record
  2052. SET is_submit = 'Y'
  2053. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2054. </update>
  2055. <!-- 修改IPQC子明细记录标识为已提交 -->
  2056. <update id="updateIPQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2057. UPDATE qc_ipqc_sub_detail_record
  2058. SET is_submit = 'Y'
  2059. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2060. </update>
  2061. <!-- 删除IPQC子明细的老数据 -->
  2062. <delete id="delIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2063. DELETE FROM qc_ipqc_sub_detail_record
  2064. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2065. </delete>
  2066. <!-- 新增IPQC子明细信息 -->
  2067. <insert id="saveIPQCSubDetailed">
  2068. INSERT INTO qc_ipqc_sub_detail_record
  2069. (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)
  2070. VALUES
  2071. <foreach collection="list" item="item" separator=",">
  2072. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2073. </foreach>
  2074. </insert>
  2075. <!-- 查询IPQC的子明细 -->
  2076. <select id="selectIPQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2077. SELECT
  2078. site,
  2079. bu_no,
  2080. sub_detail_value,
  2081. sampling_location,
  2082. is_submit,
  2083. sampling_location_b,
  2084. num,
  2085. sub_detail_value_b,
  2086. sub_detail_value_c,
  2087. sub_detail_value_d,
  2088. sub_detail_value_e
  2089. FROM qc_ipqc_sub_detail_record
  2090. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2091. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2092. AND sub_detail_value ${collectionDataContent}
  2093. </if>
  2094. </select>
  2095. <!-- 查询IPQC检验记录是否已提交 -->
  2096. <select id="checkIPQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2097. SELECT submit_flag
  2098. FROM qc_ipqc_record
  2099. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2100. </select>
  2101. <!-- 获取该项目的子明细值 -->
  2102. <select id="selectIPQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2103. SELECT sub_detail_value,
  2104. sampling_location,
  2105. is_submit
  2106. FROM qc_ipqc_sub_detail_record
  2107. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2108. </select>
  2109. <!-- 查询工序列表 -->
  2110. <select id="getOperationList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2111. SELECT
  2112. DISTINCT
  2113. a.seqno as seqNo,
  2114. a.orderno as orderNo,
  2115. j.part_no,
  2116. j.part_desc,
  2117. j.invdefinetype,
  2118. j.sku,
  2119. c.operation_desc as operationDesc,
  2120. a.itemno as operationNo,
  2121. a.s_resourceid as resourceId,
  2122. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2123. c.work_center_no
  2124. FROM soscheduledrouting as a
  2125. LEFT JOIN so_routing as c ON a.site = c.site and c.order_no = a.orderno and a.itemno = c.item_no
  2126. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2127. WHERE a.site = #{site} and a.seqno = #{seqNo}
  2128. </select>
  2129. <!-- 根据工单号和工序号查出所有数据 -->
  2130. <select id="getResourceList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2131. SELECT
  2132. a.s_resourceid as resourceId,
  2133. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2134. c.work_center_no
  2135. FROM soscheduledrouting as a
  2136. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  2137. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2138. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2139. WHERE a.site = #{site} and b.approve_qty is not null and a.seqno = #{seqNo}
  2140. ORDER BY a.id desc
  2141. </select>
  2142. <!-- a.orderno = #{orderNo} and c.operation_desc = #{operationDesc}-->
  2143. <!-- 查询机台名称 -->
  2144. <select id="selectResourceDesc" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2145. SELECT distinct
  2146. resource_desc
  2147. FROM resource
  2148. WHERE site = #{site} and resource_id = #{resourceId}
  2149. </select>
  2150. <!-- 查询物料名称 -->
  2151. <select id="selectPartDesc" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2152. SELECT distinct
  2153. part_desc
  2154. FROM part
  2155. WHERE site = #{site} and part_no = #{partNo}
  2156. </select>
  2157. <!-- ================================================= IQC检验维护 ================================================= -->
  2158. <!-- 查询IQC基础数据 -->
  2159. <select id="selectIQCBasicData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2160. SELECT
  2161. qir.inspection_no,
  2162. qir.state,
  2163. qir.create_date as taskDate,
  2164. qir.roll_no,
  2165. qir.part_no,
  2166. p.part_desc,
  2167. p.cinv_source_code,
  2168. p.sku as sku,
  2169. qir.roll_qty,
  2170. qir.print_flag,
  2171. qir.create_by,
  2172. qir.supplier_no,
  2173. qir.site,
  2174. qir.bu_no,
  2175. qir.po_orderNo,
  2176. qir.po_itemNo,
  2177. qir.roll_count
  2178. FROM qc_iqc_record as qir
  2179. LEFT JOIN part p ON qir.part_no = p.part_no and qir.site = p.site
  2180. WHERE qir.site in (select site from eam_access_site where username = #{userName})
  2181. and (qir.site + '-' + qir.bu_no) in (select * from dbo.query_bu(#{userName}))
  2182. and qir.detail_flag = 'N'
  2183. </select>
  2184. <!-- 新增IQC明细记录信息 -->
  2185. <insert id="saveIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2186. 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)
  2187. 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})
  2188. </insert>
  2189. <!-- 修改IQC检验记录 -->
  2190. <update id="updateIQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2191. UPDATE qc_iqc_record
  2192. SET inspection_type_no = #{inspectionTypeNo},
  2193. sampling_qty = #{samplingQty},
  2194. inspection_cycle = #{inspectionCycle},
  2195. part_no = #{partNo},
  2196. supplier_no = #{supplierNo},
  2197. part_desc = #{partDesc},
  2198. detail_flag = 'Y',
  2199. state = '未开始',
  2200. action_date = '',
  2201. action_by = ''
  2202. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2203. </update>
  2204. <!-- 查询IQC主记录信息 -->
  2205. <select id="qcIQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2206. SELECT
  2207. a.inspection_no,
  2208. a.site,
  2209. a.bu_no,
  2210. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  2211. a.state,
  2212. a.inspection_result,
  2213. a.create_date as taskDate,
  2214. a.inspection_type_no,
  2215. a.inspection_cycle,
  2216. a.part_no,
  2217. a.part_desc,
  2218. d.cinv_source_code as cinvSourceCode,
  2219. d.sku,
  2220. d.umid as umId,
  2221. d.invdefinetype as invdefinetype,
  2222. a.inspection_remark,
  2223. a.roll_qty,
  2224. a.sampling_qty,
  2225. a.disposal_measures,
  2226. a.disposal_remark,
  2227. a.inspector_date,
  2228. a.inspector_no,
  2229. u.user_display as inspectorName,
  2230. a.unqualified_quantity,
  2231. a.submit_flag,
  2232. a.roll_no,
  2233. a.supplier_no,
  2234. s.SupplierName as supplierDesc,
  2235. a.po_orderNo,
  2236. a.po_itemNo,
  2237. a.roll_count,
  2238. dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
  2239. a.action_date,
  2240. a.action_by,
  2241. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2242. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2243. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2244. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2245. a.submission_remark,
  2246. a.submission_type,
  2247. a.batch_no,
  2248. a.production_date,
  2249. a.expiration_warning_date,
  2250. a.expiration_date,
  2251. a.cancel_check_date,
  2252. a.submit_date,
  2253. a.pass_qty,
  2254. a.not_pass_qty,
  2255. a.batch_qualified_qty
  2256. FROM qc_iqc_record as a
  2257. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  2258. left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
  2259. left join sys_user as u on a.inspector_no = u.username
  2260. <where>
  2261. a.site in (select site from eam_access_site where username = #{query.userName})
  2262. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  2263. <if test="query.buNo != null and query.buNo != ''">
  2264. AND a.bu_no = #{query.buNo}
  2265. </if>
  2266. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2267. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2268. </if>
  2269. <if test = "query.states != null and query.states.size > 0">
  2270. AND a.state in
  2271. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2272. #{item}
  2273. </foreach>
  2274. </if>
  2275. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2276. AND a.inspection_result = #{query.inspectionResult}
  2277. </if>
  2278. <if test = "query.partNo != null and query.partNo != ''">
  2279. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2280. </if>
  2281. <if test = "query.partDesc != null and query.partDesc != ''">
  2282. AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
  2283. </if>
  2284. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2285. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2286. </if>
  2287. <if test = "query.sku != null and query.sku != ''">
  2288. AND d.sku LIKE '%' + #{query.sku} + '%'
  2289. </if>
  2290. <if test = "query.supplierDesc != null and query.supplierDesc != ''">
  2291. AND s.SupplierName LIKE '%' + #{query.supplierDesc} + '%'
  2292. </if>
  2293. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2294. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2295. </if>
  2296. <if test = "query.inspectorName != null and query.inspectorName != ''">
  2297. u.user_display LIKE '%' + #{query.inspectorName} + '%'
  2298. </if>
  2299. <if test="query.startDate != null">
  2300. AND a.inspector_date >= #{query.startDate}
  2301. </if>
  2302. <if test="query.endDate != null">
  2303. AND #{query.endDate} >= a.inspector_date
  2304. </if>
  2305. <if test="query.startDate2 != null">
  2306. AND a.create_date >= #{query.startDate2}
  2307. </if>
  2308. <if test="query.endDate2 != null">
  2309. AND #{query.endDate2} >= a.create_date
  2310. </if>
  2311. <if test = "query.poOrderNo != null and query.poOrderNo != ''">
  2312. AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
  2313. </if>
  2314. <if test = "query.poItemNo != null and query.poItemNo != ''">
  2315. AND a.po_itemNo LIKE '%' + #{query.poItemNo} + '%'
  2316. </if>
  2317. <if test = "query.orderType != null and query.orderType != ''">
  2318. AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
  2319. </if>
  2320. <if test = "query.submissionType != null and query.submissionType != ''">
  2321. AND a.submission_type = #{query.submissionType}
  2322. </if>
  2323. <if test = "query.invdefinetype != null and query.invdefinetype != ''">
  2324. AND d.invdefinetype LIKE '%' + #{query.invdefinetype} + '%'
  2325. </if>
  2326. </where>
  2327. ORDER BY
  2328. CASE WHEN a.state = '待检验' THEN 1
  2329. WHEN a.state = '待审核' THEN 2
  2330. WHEN a.state = '已完成' THEN 3
  2331. END, a.create_date desc
  2332. </select>
  2333. <!-- IQC明细记录查询 -->
  2334. <select id="iqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2335. SELECT
  2336. a.site,
  2337. a.bu_no,
  2338. a.inspection_no,
  2339. a.template_id,
  2340. a.sampling_level_no,
  2341. a.sampling_level_desc,
  2342. a.sampling_programme_no,
  2343. a.sampling_programme_desc,
  2344. a.AQL,
  2345. a.AC,
  2346. a.RE,
  2347. a.item_no,
  2348. a.item_desc,
  2349. a.object_id,
  2350. a.object_desc,
  2351. a.default_value,
  2352. a.min_value,
  2353. a.max_value,
  2354. a.text_value,
  2355. a.number_value,
  2356. a.value_type_db,
  2357. a.value_type,
  2358. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2359. a.is_submit,
  2360. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2361. dbo.qc_get_iqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2362. c.method_no,
  2363. c.method_name,
  2364. c.method_remark,
  2365. a.sampling_qty
  2366. FROM qc_iqc_detailed_record as a
  2367. 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
  2368. 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
  2369. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2370. order by a.order_id
  2371. </select>
  2372. <!-- 查询IQC的子明细 -->
  2373. <select id="selectIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2374. SELECT
  2375. site,
  2376. bu_no,
  2377. sub_detail_value,
  2378. sampling_location,
  2379. is_submit,
  2380. sampling_location_b,
  2381. num,
  2382. sub_detail_value_b,
  2383. sub_detail_value_c,
  2384. sub_detail_value_d,
  2385. sub_detail_value_e
  2386. FROM qc_iqc_sub_detail_record
  2387. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2388. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2389. AND sub_detail_value ${collectionDataContent}
  2390. </if>
  2391. </select>
  2392. <!-- 获取该项目的子明细值 -->
  2393. <select id="selectIQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2394. SELECT sub_detail_value,
  2395. sampling_location,
  2396. is_submit
  2397. FROM qc_iqc_sub_detail_record
  2398. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2399. </select>
  2400. <!-- 修改IQC主记录信息 -->
  2401. <update id="updateIQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2402. UPDATE qc_iqc_record
  2403. SET disposal_measures = #{disposalMeasures},
  2404. disposal_remark = #{disposalRemark},
  2405. inspection_result = #{inspectionResult},
  2406. inspector_no = #{inspectorNo},
  2407. state = #{state},
  2408. inspection_remark = #{inspectionRemark},
  2409. inspector_date = getDate(),
  2410. roll_count = #{rollCount,jdbcType=DECIMAL},
  2411. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2412. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2413. pass_qty = #{passQty,jdbcType=DECIMAL},
  2414. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2415. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2416. submit_date = getDate()
  2417. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2418. </update>
  2419. <!-- 修改IQC明细记录信息 -->
  2420. <update id="updateIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2421. UPDATE qc_iqc_detailed_record
  2422. SET item_result = #{itemResult},
  2423. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2424. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2425. text_value = #{textValue},
  2426. number_value = #{numberValue,jdbcType=DECIMAL}
  2427. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2428. </update>
  2429. <!-- 查询该记录明细是否已存在 -->
  2430. <select id="checkIQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2431. SELECT inspection_no,
  2432. template_id
  2433. FROM qc_iqc_detailed_record
  2434. WHERE inspection_no = #{inspectionNo} and site = #{site}
  2435. </select>
  2436. <!-- 查询IQC检验记录是否已提交 -->
  2437. <select id="checkIQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2438. SELECT submit_flag
  2439. FROM qc_iqc_record
  2440. WHERE inspection_no = #{inspectionNo} and site = #{site}
  2441. </select>
  2442. <!-- 删除IQC子明细的老数据 -->
  2443. <delete id="delIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2444. DELETE FROM qc_iqc_sub_detail_record
  2445. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2446. </delete>
  2447. <!-- 新增IQC子明细信息 -->
  2448. <insert id="saveIQCSubDetailed">
  2449. INSERT INTO qc_iqc_sub_detail_record
  2450. (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)
  2451. VALUES
  2452. <foreach collection="list" item="item" separator=",">
  2453. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2454. </foreach>
  2455. </insert>
  2456. <!-- 修改IQC主记录标识为已提交 -->
  2457. <update id="updateIQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2458. UPDATE qc_iqc_record
  2459. SET submit_flag = 'Y',
  2460. state = '已完成',
  2461. submit_date = getDate()
  2462. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2463. </update>
  2464. <!-- 修改IQC明细记录标识为已提交 -->
  2465. <update id="updateIQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2466. UPDATE qc_iqc_detailed_record
  2467. SET is_submit = 'Y'
  2468. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2469. </update>
  2470. <!-- 修改IQC子明细记录标识为已提交 -->
  2471. <update id="updateIQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2472. UPDATE qc_iqc_sub_detail_record
  2473. SET is_submit = 'Y'
  2474. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2475. </update>
  2476. <!-- 删除IQC检验记录 -->
  2477. <delete id="deleteIQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2478. DELETE FROM qc_iqc_record
  2479. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2480. </delete>
  2481. <!-- 删除IQC明细记录信息 -->
  2482. <delete id="deleteIQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2483. DELETE FROM qc_iqc_detailed_record
  2484. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2485. </delete>
  2486. <!-- 删除IQC子明细记录信息 -->
  2487. <delete id="deleteIQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2488. DELETE FROM qc_iqc_sub_detail_record
  2489. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2490. </delete>
  2491. <!-- 查询文件ID -->
  2492. <select id="queryFileId" parameterType="SysOssEntity" resultType="SysOssEntity">
  2493. SELECT id, file_name
  2494. FROM sys_oss
  2495. WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
  2496. </select>
  2497. <!-- 获取工序列表 -->
  2498. <select id="getOperationDescList" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  2499. SELECT distinct
  2500. operation_desc
  2501. FROM so_routing
  2502. <where>
  2503. <if test = "operationDesc != null and operationDesc != ''">
  2504. AND operation_desc LIKE '%' + #{operationDesc} + '%'
  2505. </if>
  2506. </where>
  2507. </select>
  2508. <!-- 获取供应商列表 -->
  2509. <select id="getManufacturerList" parameterType="com.xujie.sys.modules.pms.data.QcPartAttributeData" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  2510. SELECT
  2511. supplierID as manufacturerID,
  2512. supplierName as manufacturerName
  2513. FROM view_Supplier
  2514. <where>
  2515. site = #{site}
  2516. <if test = "manufacturerID != null and manufacturerID != ''">
  2517. AND supplierID LIKE '%' + #{manufacturerID} + '%'
  2518. </if>
  2519. <if test = "manufacturerName != null and manufacturerName != ''">
  2520. AND supplierName LIKE '%' + #{manufacturerName} + '%'
  2521. </if>
  2522. </where>
  2523. </select>
  2524. <!-- 获取机台列表 -->
  2525. <select id="getAllResourceList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2526. SELECT distinct
  2527. resource_id,
  2528. resource_desc
  2529. FROM resource
  2530. <where>
  2531. site = #{site}
  2532. <if test = "resourceId != null and resourceId != ''">
  2533. AND resource_id LIKE '%' + #{resourceId} + '%'
  2534. </if>
  2535. <if test = "resourceDesc != null and resourceDesc != ''">
  2536. AND resource_desc LIKE '%' + #{resourceDesc} + '%'
  2537. </if>
  2538. </where>
  2539. </select>
  2540. <!-- 获取工单列表 -->
  2541. <select id="getOrderNoList" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2542. SELECT DISTINCT
  2543. a.orderno as orderNo
  2544. FROM soscheduledrouting as a
  2545. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  2546. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2547. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2548. <where>
  2549. a.site = #{site}
  2550. AND b.approve_qty is not null
  2551. <if test = "orderNo != null and orderNo != ''">
  2552. AND a.orderno LIKE '%' + #{orderNo} + '%'
  2553. </if>
  2554. </where>
  2555. order by a.orderno DESC
  2556. </select>
  2557. <!-- 查询FQC主记录信息 -->
  2558. <select id="qcFQCInspectionSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2559. SELECT
  2560. a.inspection_no,
  2561. a.site,
  2562. a.bu_no,
  2563. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  2564. a.state,
  2565. a.inspection_result,
  2566. a.task_date,
  2567. a.inspection_type_no,
  2568. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  2569. a.inspection_cycle,
  2570. a.order_no,
  2571. a.operation_desc,
  2572. a.resource_id,
  2573. r.resource_desc,
  2574. a.part_no,
  2575. d.part_desc,
  2576. d.cinv_source_code as cinvSourceCode,
  2577. d.sku as sku,
  2578. d.invdefinetype as invdefinetype,
  2579. a.inspection_remark,
  2580. a.roll_qty,
  2581. a.sampling_qty,
  2582. a.disposal_measures,
  2583. a.disposal_remark,
  2584. a.inspector_date,
  2585. a.inspector_no,
  2586. u.user_display as inspectorName,
  2587. a.ssr_id,
  2588. a.unqualified_qty,
  2589. a.submit_flag,
  2590. a.seq_no,
  2591. a.batch_roll_no,
  2592. a.special_requirements,
  2593. a.work_center_no,
  2594. a.roll_no,
  2595. a.um_id,
  2596. um.UMName as umName,
  2597. a.action_date,
  2598. a.action_by,
  2599. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2600. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2601. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2602. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2603. a.pass_qty,
  2604. a.not_pass_qty,
  2605. a.batch_qualified_qty
  2606. FROM qc_fqc_record as a
  2607. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
  2608. left join sys_user as u on a.inspector_no = u.username
  2609. 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
  2610. left join UM as um on a.site = um.site and a.um_id = um.UMID
  2611. <where>
  2612. a.site in (select site from eam_access_site where username = #{query.userName})
  2613. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  2614. <if test="query.buNo != null and query.buNo != ''">
  2615. AND a.bu_no = #{query.buNo}
  2616. </if>
  2617. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2618. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2619. </if>
  2620. <if test = "query.partNo != null and query.partNo != ''">
  2621. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2622. </if>
  2623. <if test = "query.partDesc != null and query.partDesc != ''">
  2624. AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
  2625. </if>
  2626. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2627. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2628. </if>
  2629. <if test = "query.sku != null and query.sku != ''">
  2630. AND d.sku LIKE '%' + #{query.sku} + '%'
  2631. </if>
  2632. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2633. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2634. </if>
  2635. <if test = "query.states != null and query.states.size > 0">
  2636. AND a.state in
  2637. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2638. #{item}
  2639. </foreach>
  2640. </if>
  2641. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2642. AND a.inspection_result = #{query.inspectionResult}
  2643. </if>
  2644. <if test = "query.orderNo != null and query.orderNo != ''">
  2645. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  2646. </if>
  2647. <if test = "query.seqNo != null and query.seqNo != ''">
  2648. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  2649. </if>
  2650. <if test = "query.operationDesc != null and query.operationDesc != ''">
  2651. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  2652. </if>
  2653. <if test="query.startDate != null">
  2654. AND a.inspector_date >= #{query.startDate}
  2655. </if>
  2656. <if test="query.endDate != null">
  2657. AND #{query.endDate} >= a.inspector_date
  2658. </if>
  2659. <if test="query.startDate2 != null">
  2660. AND a.task_date >= #{query.startDate2}
  2661. </if>
  2662. <if test="query.endDate2 != null">
  2663. AND #{query.endDate2} >= a.task_date
  2664. </if>
  2665. </where>
  2666. ORDER BY
  2667. CASE WHEN a.state = '待检验' THEN 1
  2668. WHEN a.state = '待审核' THEN 2
  2669. WHEN a.state = '已完成' THEN 3
  2670. END, a.task_date desc
  2671. </select>
  2672. <insert id="saveFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2673. INSERT INTO qc_fqc_detailed_record
  2674. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2675. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2676. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  2677. VALUES
  2678. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  2679. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  2680. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  2681. </insert>
  2682. <!-- 新增FQC明细记录信息 -->
  2683. <insert id="saveFQCDetailedRecords">
  2684. INSERT INTO qc_fqc_detailed_record
  2685. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2686. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2687. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  2688. VALUES
  2689. <foreach collection="list" item="item" separator=",">
  2690. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  2691. #{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},
  2692. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  2693. </foreach>
  2694. </insert>
  2695. <!-- 新增FQC主记录信息 -->
  2696. <insert id="saveFQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2697. INSERT INTO qc_fqc_record
  2698. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  2699. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  2700. VALUES
  2701. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  2702. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  2703. </insert>
  2704. <!-- FQC明细记录查询 -->
  2705. <select id="fqcDetailSearch" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2706. SELECT
  2707. a.site,
  2708. a.bu_no,
  2709. a.inspection_no,
  2710. a.order_no,
  2711. a.template_id,
  2712. a.sampling_level_no,
  2713. a.sampling_level_desc,
  2714. a.sampling_programme_no,
  2715. a.sampling_programme_desc,
  2716. a.AQL,
  2717. a.AC,
  2718. a.RE,
  2719. a.item_no,
  2720. a.item_desc,
  2721. a.object_id,
  2722. a.object_desc,
  2723. a.default_value,
  2724. a.min_value,
  2725. a.max_value,
  2726. a.text_value,
  2727. a.number_value,
  2728. a.value_type_db,
  2729. a.value_type,
  2730. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2731. a.is_submit,
  2732. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2733. a.sampling_qty,
  2734. dbo.qc_get_fqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2735. c.method_no,
  2736. c.method_name,
  2737. c.method_remark
  2738. FROM qc_fqc_detailed_record as a
  2739. 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
  2740. 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
  2741. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2742. order by a.order_id
  2743. </select>
  2744. <!-- 删除FQC检验记录 -->
  2745. <delete id="deleteFQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2746. DELETE FROM qc_fqc_record
  2747. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2748. </delete>
  2749. <!-- 删除FQC明细记录信息 -->
  2750. <delete id="deleteFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2751. DELETE FROM qc_fqc_detailed_record
  2752. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2753. </delete>
  2754. <!-- 删除FQC子明细记录信息 -->
  2755. <delete id="deleteFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2756. DELETE FROM qc_fqc_sub_detail_record
  2757. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  2758. </delete>
  2759. <!-- 修改FQC主记录信息 -->
  2760. <update id="updateFQCMasterRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2761. UPDATE qc_fqc_record
  2762. SET disposal_measures = #{disposalMeasures},
  2763. disposal_remark = #{disposalRemark},
  2764. inspection_result = #{inspectionResult},
  2765. inspector_no = #{inspectorNo},
  2766. state = #{state},
  2767. inspection_remark = #{inspectionRemark},
  2768. inspector_date = getDate(),
  2769. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2770. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2771. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2772. pass_qty = #{passQty,jdbcType=DECIMAL},
  2773. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2774. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2775. submit_date = getDate()
  2776. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2777. </update>
  2778. <!-- 修改FQC明细记录信息 -->
  2779. <update id="updateFQCDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2780. UPDATE qc_fqc_detailed_record
  2781. SET item_result = #{itemResult},
  2782. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2783. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2784. text_value = #{textValue},
  2785. number_value = #{numberValue,jdbcType=DECIMAL}
  2786. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2787. </update>
  2788. <!-- 修改FQC主记录标识为已提交 -->
  2789. <update id="updateFQCMasterSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2790. UPDATE qc_pqc_record
  2791. SET submit_flag = 'Y',
  2792. state = '已完成',
  2793. submit_date = getDate()
  2794. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2795. </update>
  2796. <!-- 修改FAI明细记录标识为已提交 -->
  2797. <update id="updateFQCDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2798. UPDATE qc_fqc_detailed_record
  2799. SET is_submit = 'Y'
  2800. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2801. </update>
  2802. <!-- 修改子明细记录标识为已提交 -->
  2803. <update id="updateFQCSubDetailSubmitFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2804. UPDATE qc_fqc_sub_detail_record
  2805. SET is_submit = 'Y'
  2806. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2807. </update>
  2808. <!-- 删除子明细的老数据 -->
  2809. <delete id="delFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.QcSubDetailInformationData">
  2810. DELETE FROM qc_fqc_sub_detail_record
  2811. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2812. </delete>
  2813. <!-- 新增子明细信息 -->
  2814. <insert id="saveFQCSubDetailed">
  2815. INSERT INTO qc_fqc_sub_detail_record
  2816. (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)
  2817. VALUES
  2818. <foreach collection="list" item="item" separator=",">
  2819. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2820. </foreach>
  2821. </insert>
  2822. <!-- 查询FQC的子明细 -->
  2823. <select id="selectFQCSubDetailedRecord" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2824. SELECT
  2825. site,
  2826. bu_no,
  2827. sub_detail_value,
  2828. sampling_location,
  2829. is_submit,
  2830. sampling_location_b,
  2831. num,
  2832. sub_detail_value_b,
  2833. sub_detail_value_c,
  2834. sub_detail_value_d,
  2835. sub_detail_value_e
  2836. FROM qc_fqc_sub_detail_record
  2837. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2838. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2839. AND sub_detail_value ${collectionDataContent}
  2840. </if>
  2841. </select>
  2842. <!-- 查询FQC检验记录是否已提交 -->
  2843. <select id="checkFQCIsSubmit" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2844. SELECT submit_flag
  2845. FROM qc_fqc_record
  2846. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2847. </select>
  2848. <!-- 获取该项目的子明细值 -->
  2849. <select id="selectFQCSubDetailValue" parameterType="string" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  2850. SELECT sub_detail_value,
  2851. sampling_location,
  2852. is_submit
  2853. FROM qc_fqc_sub_detail_record
  2854. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2855. </select>
  2856. <!-- 生成FQC检验单号 -->
  2857. <select id="selectFQCInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2858. SELECT
  2859. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  2860. FROM qc_fqc_record
  2861. WHERE site = #{site} and bu_no = #{buNo}
  2862. </select>
  2863. <!-- 生成IPQC检验单号 -->
  2864. <select id="selectIPQCInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2865. SELECT
  2866. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
  2867. FROM qc_ipqc_record
  2868. WHERE site = #{site} and bu_no = #{buNo}
  2869. </select>
  2870. <!-- 生成FAI检验单号 -->
  2871. <select id="selectFAIInspectionNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2872. SELECT
  2873. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  2874. FROM qc_fai_record
  2875. WHERE site = #{site} and bu_no = #{buNo}
  2876. </select>
  2877. <!-- 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 -->
  2878. <select id="queryDataFromViewPoOrder" resultType="com.xujie.sys.modules.pms.data.PoOrderData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2879. SELECT
  2880. site,
  2881. order_no,
  2882. item_no,
  2883. part_no,
  2884. part_desc,
  2885. spec,
  2886. supplier_id,
  2887. supplier_name,
  2888. order_qty,
  2889. created_date,
  2890. status,
  2891. citem_code,
  2892. citem_class,
  2893. sendto_address,
  2894. order_type
  2895. FROM view_po_order
  2896. WHERE site = #{site} and order_no = #{poOrderNo} and item_no = #{poItemNo}
  2897. </select>
  2898. <!-- 向收货任务表里添加数据 -->
  2899. <insert id="saveReceivingTask" parameterType="com.xujie.sys.modules.pms.data.PoOrderData">
  2900. 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)
  2901. VALUES (#{site}, #{orderNo}, #{itemNo}, #{partNo}, #{partDesc}, #{spec}, #{supplierId}, #{supplierName}, #{orderQty}, getDate(), #{status}, #{citemCode}, #{citemClass}, #{sendtoAddress}, #{orderType}, #{inspectionNo}, #{batchNo}, #{productionDate}, #{expirationWarningDate}, #{expirationDate})
  2902. </insert>
  2903. <!-- 检查动控是否开启 -->
  2904. <select id="queryController" parameterType="com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity" resultType="com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity">
  2905. SELECT
  2906. type,
  2907. base_data,
  2908. base_desc,
  2909. status,
  2910. remark,
  2911. third_type,
  2912. second_type,
  2913. page_control,
  2914. control_style
  2915. FROM sys_scene_dynamic_control_model
  2916. where site = #{site} and control_no = #{controlNo}
  2917. </select>
  2918. <!-- 查询检验模板列表 -->
  2919. <select id="queryTemplateList" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  2920. SELECT
  2921. site,
  2922. bu_no,
  2923. template_id as templateId,
  2924. template_name as templateName,
  2925. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  2926. FROM qc_template
  2927. <where>
  2928. site = #{site} and bu_no = #{buNo} and dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  2929. <if test = "templateId != null and templateId != ''">
  2930. AND template_id LIKE '%' + #{templateId}+'%'
  2931. </if>
  2932. <if test = "templateName != null and templateName != ''">
  2933. AND template_name LIKE '%' + #{templateName}+'%'
  2934. </if>
  2935. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  2936. AND inspection_type_no = #{inspectionTypeNo}
  2937. </if>
  2938. </where>
  2939. </select>
  2940. <!-- 查询检验模板列表 -->
  2941. <select id="getPartInformation" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2942. select
  2943. part_no,
  2944. part_desc,
  2945. spec,
  2946. sku,
  2947. control_mes,
  2948. DefaultWarehouseID as defaultWarehouseId
  2949. from part
  2950. where site = #{site} and part_no = #{partNo}
  2951. </select>
  2952. <!-- 获取特殊工序列表 -->
  2953. <select id="getSpecialOperationList" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2954. select
  2955. site,
  2956. operation_no,
  2957. operation_desc
  2958. from qc_special_task_operation
  2959. where site = #{site}
  2960. </select>
  2961. <!-- 获取处置措施列表 -->
  2962. <select id="disposalMeasuresSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2963. SELECT
  2964. id,
  2965. disposal_measures
  2966. FROM qc_disposal_measures
  2967. <where>
  2968. <if test = "inspectionTypeNo != '101'">
  2969. inspection_type != 'IPQC'
  2970. </if>
  2971. </where>
  2972. </select>
  2973. <!-- 查询文件路径 -->
  2974. <select id="searchItemFileUrl" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2975. SELECT
  2976. id,
  2977. url,
  2978. file_name
  2979. FROM sys_oss
  2980. WHERE order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref3 = #{itemNo} and order_ref4 = #{buNo}
  2981. </select>
  2982. <!-- 删除图片-->
  2983. <delete id="imageDelete" parameterType="SysOssEntity">
  2984. DELETE FROM sys_oss
  2985. WHERE id = #{id}
  2986. </delete>
  2987. <!-- 模糊查询标签号 -->
  2988. <select id="getRollNo" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2989. SELECT DISTINCT top 3
  2990. a.seqno,
  2991. a.orderno,
  2992. b.roll_no
  2993. FROM soscheduledrouting AS a
  2994. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  2995. WHERE a.site = #{site} and b.roll_no like '%' + #{rollNo} + '%'
  2996. </select>
  2997. <!-- 标签号回车事件 -->
  2998. <select id="rollNoEnter" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  2999. SELECT
  3000. a.site,
  3001. a.seqno as seqNo,
  3002. a.orderno as orderNo,
  3003. b.roll_no,
  3004. #{inspectionTypeNo} as inspectionTypeNo
  3005. FROM soscheduledrouting AS a
  3006. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  3007. WHERE a.site = #{site} and b.roll_no = #{rollNo}
  3008. </select>
  3009. <!-- 查询物料列表 -->
  3010. <select id="queryPartList" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3011. SELECT
  3012. site,
  3013. part_no,
  3014. part_desc,
  3015. sku,
  3016. spec
  3017. FROM part
  3018. <where>
  3019. site = #{site}
  3020. <if test = "partNo != null and partNo != ''">
  3021. AND part_no LIKE '%' + #{partNo} + '%'
  3022. </if>
  3023. <if test = "partDesc != null and partDesc != ''">
  3024. AND part_desc LIKE '%' + #{partDesc} + '%'
  3025. </if>
  3026. <if test = "sku != null and sku != ''">
  3027. AND sku LIKE '%' + #{sku} + '%'
  3028. </if>
  3029. </where>
  3030. </select>
  3031. <!-- 查询单位列表 -->
  3032. <select id="umSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3033. SELECT
  3034. site,
  3035. UMID as umId,
  3036. UMName as umName
  3037. FROM UM
  3038. WHERE site = #{site} and active = #{active}
  3039. </select>
  3040. <!-- 查询单位列表 -->
  3041. <select id="checkItem" resultType="com.xujie.sys.modules.pms.data.SubDetailValues" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3042. SELECT
  3043. site,
  3044. bu_no,
  3045. inspection_no,
  3046. item_no,
  3047. value_type_db,
  3048. min_value,
  3049. max_value
  3050. <if test = "flag == 'IPQC'">
  3051. FROM qc_ipqc_detailed_record
  3052. </if>
  3053. <if test = "flag == 'IQC'">
  3054. FROM qc_iqc_detailed_record
  3055. </if>
  3056. <if test = "flag == 'FQC'">
  3057. FROM qc_fqc_detailed_record
  3058. </if>
  3059. <if test = "flag == 'FAI'">
  3060. FROM qc_fai_detailed_record
  3061. </if>
  3062. WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo} and bu_no = #{buNo}
  3063. order by order_id
  3064. </select>
  3065. <!-- 查询检验方法列表 -->
  3066. <select id="queryMethodList" resultType="com.xujie.sys.modules.pms.data.QcMethodData" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  3067. SELECT
  3068. site,
  3069. bu_no,
  3070. method_no,
  3071. method_name,
  3072. inspection_type_no,
  3073. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  3074. FROM qc_method
  3075. <where>
  3076. site = #{site} and bu_no = #{buNo}
  3077. <if test = "methodNo != null and methodNo != ''">
  3078. AND method_no LIKE '%' + #{methodNo} + '%'
  3079. </if>
  3080. <if test = "methodName != null and methodName != ''">
  3081. AND method_name LIKE '%' + #{methodName} + '%'
  3082. </if>
  3083. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  3084. AND inspection_type_no = #{inspectionTypeNo}
  3085. </if>
  3086. <if test="inspectionTypeName != null and inspectionTypeName != ''">
  3087. AND dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  3088. </if>
  3089. </where>
  3090. </select>
  3091. <!-- 修改detailFlag字段为N -->
  3092. <update id="updateIQCDetailFlag" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3093. UPDATE qc_iqc_record
  3094. SET detail_flag = 'N'
  3095. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3096. </update>
  3097. <!-- 查询检验方法唯一 -->
  3098. <select id="checkMethodOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcMethodData" parameterType="com.xujie.sys.modules.pms.data.QcMethodData">
  3099. SELECT
  3100. site,
  3101. bu_no,
  3102. method_no
  3103. FROM qc_method
  3104. <where>
  3105. site = #{site} and bu_no = #{buNo} and method_no = #{methodNo}
  3106. </where>
  3107. </select>
  3108. <!-- 查询检验项目唯一 -->
  3109. <select id="checkItemOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcItemData" parameterType="com.xujie.sys.modules.pms.data.QcItemData">
  3110. SELECT
  3111. site,
  3112. bu_no,
  3113. ItemNo,
  3114. ItemDesc
  3115. FROM eam_properties_item
  3116. <where>
  3117. site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ItemType = #{itemType} and inspection_type_no = #{inspectionTypeNo}
  3118. </where>
  3119. </select>
  3120. <!-- 查询检验项目唯一 -->
  3121. <select id="checkTemplateOnlyOne" resultType="com.xujie.sys.modules.pms.data.QcTemplateData" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3122. SELECT
  3123. site,
  3124. bu_no,
  3125. template_id,
  3126. template_name
  3127. FROM qc_template
  3128. <where>
  3129. site = #{site} and bu_no = #{buNo} and template_id = #{templateId}
  3130. </where>
  3131. </select>
  3132. <select id="searchSeqInfo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3133. SELECT DISTINCT
  3134. a.seqno,
  3135. a.orderno,
  3136. J.part_no,
  3137. J.part_desc,
  3138. t.lotsize,
  3139. a.qtyrequired,
  3140. c.operation_desc,
  3141. J.sku,
  3142. sum(roll_qty) as sjzs
  3143. FROM soscheduledrouting AS a
  3144. inner JOIN so_routing AS c ON c.site = a.site AND c.order_no = a.orderno AND a.itemno = c.item_no
  3145. inner JOIN part AS J ON a.site = J.site AND a.part_no = J.part_no
  3146. inner JOIN shoporder AS t ON a.site = t.site AND t.orderno = a.orderno
  3147. left join qc_ipqc_record as r on a.site = r.site and a.seqno = r.seq_no
  3148. WHERE
  3149. a.site = #{query.site} and J.sourceBu = #{query.buNo}
  3150. <if test="query.status != null and query.status != ''">
  3151. AND t.status = #{query.status}
  3152. </if>
  3153. <if test="query.orderNo != null and query.orderNo != ''">
  3154. AND a.orderno LIKE '%' + #{query.orderNo} + '%'
  3155. </if>
  3156. <if test="query.seqNo != null and query.seqNo != ''">
  3157. AND a.seqno LIKE '%' + #{query.seqNo} + '%'
  3158. </if>
  3159. <if test="query.sku != null and query.sku != ''">
  3160. AND j.sku LIKE '%' + #{query.sku} + '%'
  3161. </if>
  3162. <if test="query.partNo != null and query.partNo != ''">
  3163. AND J.part_no LIKE '%' + #{query.partNo} + '%'
  3164. </if>
  3165. <if test="query.partDesc != null and query.partDesc != ''">
  3166. AND J.part_desc LIKE '%' + #{query.partDesc} + '%'
  3167. </if>
  3168. <if test="query.operationDesc != null and query.operationDesc != ''">
  3169. AND c.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  3170. </if>
  3171. group by a.seqno, a.orderno, J.part_no, J.part_desc, t.lotsize, a.qtyrequired, c.operation_desc, J.sku
  3172. </select>
  3173. <select id="searchPartInfo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3174. select
  3175. part_no,
  3176. part_desc,
  3177. sku,
  3178. cinv_source_code,
  3179. sourceBu
  3180. from
  3181. part
  3182. where
  3183. sourceBu = #{query.buNo}
  3184. <if test="query.partNo != null and query.partNo != ''">
  3185. AND part_no LIKE '%' + #{query.partNo} + '%'
  3186. </if>
  3187. <if test="query.partDesc != null and query.partDesc != ''">
  3188. AND part_desc LIKE '%' + #{query.partDesc} + '%'
  3189. </if>
  3190. <if test="query.sku != null and query.sku != ''">
  3191. AND sku LIKE '%' + #{query.sku} + '%'
  3192. </if>
  3193. <if test="query.cinvSourceCode != null and query.cinvSourceCode != ''">
  3194. AND cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  3195. </if>
  3196. </select>
  3197. <select id="getInterfaceTimeData" parameterType="String" resultType="com.xujie.sys.modules.pms.data.InterfaceTimeData">
  3198. SELECT
  3199. id,
  3200. start_time,
  3201. end_time,
  3202. del_flag
  3203. FROM interface_time
  3204. WHERE del_flag = 'N' and site = #{site}
  3205. </select>
  3206. <update id="updateInterfaceTimeData" parameterType="com.xujie.sys.modules.pms.data.InterfaceTimeData">
  3207. UPDATE interface_time
  3208. set
  3209. updated_by = #{updatedBy},
  3210. updated_date = #{updatedDate},
  3211. del_flag = #{delFlag}
  3212. </update>
  3213. <select id="getInterfaceRdStyleData" parameterType="String" resultType="com.xujie.sys.modules.pms.data.RdStyleData">
  3214. SELECT
  3215. crdcode,
  3216. crdname,
  3217. iRdGrade,
  3218. rdtype,
  3219. brdend
  3220. FROM view_custdev_mes_rdstyle
  3221. WHERE crdname = #{crdName}
  3222. </select>
  3223. <insert id="insertHardtagPurchaseInStorageData" parameterType="com.xujie.sys.modules.pms.data.HardtagPurchaseInStorageCountData" useGeneratedKeys="true" keyProperty="id">
  3224. INSERT INTO purchase_in_storage_count
  3225. (site, trans_no, created_date, created_by, erp_flag, toacc, logindate, cordercode, cdepcode, cwhcode, crdcode, coutcode, ddate, bredvouch,
  3226. cmemo, verify, irowno, cinvcode, iquantity, citemcode, erp_remark, trans_date, csource, trans_type)
  3227. values (#{site}, #{transNo}, #{createdDate}, #{createdBy}, #{erpFlag}, #{toacc}, #{logindate}, #{cordercode}, #{cdepcode}, #{cwhcode}, #{crdcode}, #{coutcode}, #{ddate}, #{bredvouch},
  3228. #{cmemo}, #{verify}, #{irowno}, #{cinvcode}, #{iquantity}, #{citemcode}, #{erpRemark}, #{transDate}, #{csource}, #{transType})
  3229. </insert>
  3230. <insert id="batchSaveHrdtagTransHeader" parameterType="com.xujie.sys.modules.pms.data.HardtagTransHeaderData">
  3231. insert into TransHeader
  3232. (TransNo, Site, WarehouseID, TransDate, TransType_DB, 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, erp_warehouse_id, ERP,
  3234. department_no, picking_status, scan_type, inCategory, pmProject, remarks, item_no_mat, remark3, location_id, count_id)
  3235. values (#{TransNo}, #{Site}, #{WarehouseID}, #{TransDate}, #{TransTypeDB}, #{TransType}, #{UserName}, #{Receiver}, #{TransYear}, #{TransMonth}, #{PartnerID}, #{PartnerType}, #{AuthorizeFlag}, #{AuthorizeDate}, #{Authorizor}, #{TransferFlag}, #{TransferDate},
  3236. #{TransferGuys}, #{VoucherDate}, #{ProjectID}, #{EnterDate}, #{Remark}, #{UseLocation}, #{OrderRef1}, #{LinkOrderFlag}, #{DelAddID}, #{Status}, #{ProjectName}, #{PartnerName}, #{erpWarehouseId}, #{ERP},
  3237. #{departmentNo}, #{pickingStatus}, #{scanType}, #{inCategory}, #{pmProject}, #{remarks}, #{itemNoMat}, #{remark3}, #{locationId}, #{countId})
  3238. </insert>
  3239. <insert id="batchSaveHardtagTransDetail" parameterType="com.xujie.sys.modules.pms.data.HardtagTransDetailData">
  3240. INSERT INTO TransDetail
  3241. (TransNo, Site, PartNo, LocationID, TransQty, Direction, OrderRef1, ItemNo, OrderRef2, OrderRef3, OrderRef5, Remark, citem_code)
  3242. values
  3243. (#{TransNo}, #{Site}, #{PartNo}, #{LocationID}, #{TransQty}, #{Direction}, #{OrderRef1}, #{ItemNo}, #{OrderRef2}, #{OrderRef3}, #{OrderRef5}, #{Remark}, #{citemCode})
  3244. </insert>
  3245. <select id="getSendMailAddress" parameterType="String" resultType="com.xujie.sys.modules.pms.data.MailAddressData">
  3246. SELECT
  3247. id,
  3248. site,
  3249. bu_no,
  3250. mail_address,
  3251. send_type,
  3252. del_flag,
  3253. created_by,
  3254. created_date,
  3255. orderref1
  3256. FROM mailAddress
  3257. WHERE site = #{site} and send_type = #{type} and del_flag = 'N'
  3258. <if test="buNo != null and buNo != ''">
  3259. AND bu_no = #{buNo}
  3260. </if>
  3261. </select>
  3262. <select id="getSendMailFromAddress" resultType="com.xujie.sys.modules.pms.data.MailSendAddressData">
  3263. SELECT
  3264. port,
  3265. host,
  3266. username,
  3267. password,
  3268. emailForm,
  3269. timeout,
  3270. personal,
  3271. id
  3272. FROM mailSendAddress
  3273. where delFlag = 'N'
  3274. </select>
  3275. <!-- 新增发送邮件记录 -->
  3276. <insert id="saveSendMailRecord" parameterType="com.xujie.sys.modules.pms.data.SendMailRecord">
  3277. insert into send_mail_record
  3278. (site, bu_no, document_no, sender, recipient, send_date, type)
  3279. values
  3280. (#{site}, #{buNo}, #{documentNo}, #{sender}, #{recipient}, getDate(), #{type})
  3281. </insert>
  3282. <select id="orderTypeSearch" resultType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3283. SELECT distinct
  3284. order_type
  3285. FROM view_po_order
  3286. </select>
  3287. <update id="actionIQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3288. update qc_iqc_record
  3289. set action_date = getDate(),
  3290. action_by = #{actionBy},
  3291. state = #{state}
  3292. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3293. </update>
  3294. <update id="actionFAIInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3295. update qc_fai_record
  3296. set action_date = getDate(),
  3297. action_by = #{actionBy},
  3298. state = #{state}
  3299. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3300. </update>
  3301. <update id="actionIPQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3302. update qc_ipqc_record
  3303. set action_date = getDate(),
  3304. action_by = #{actionBy},
  3305. state = #{state}
  3306. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3307. </update>
  3308. <update id="actionFQCInspection" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3309. update qc_fqc_record
  3310. set action_date = getDate(),
  3311. action_by = #{actionBy},
  3312. state = #{state}
  3313. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3314. </update>
  3315. <insert id="addEquipmentDataAcquisition">
  3316. insert into Equipment_data_acquisition
  3317. (site, bu_no, equipment_no, inspection_no, create_date, create_by, item_no, collection_source, collection_method)
  3318. values
  3319. <foreach collection="list" item="item" separator=",">
  3320. (#{item.site}, #{item.buNo}, #{item.equipmentNo}, #{item.inspectionNo}, getDate(), #{item.actionBy}, #{item.itemNo}, #{item.collectionSource}, #{item.collectionMethod})
  3321. </foreach>
  3322. </insert>
  3323. <!-- 新增人员信息 -->
  3324. <insert id="saveOperator" >
  3325. INSERT INTO eam_actual_operator
  3326. (site, order_no, function_type, operator, bu_no)
  3327. VALUES
  3328. <foreach collection="list" item="item" separator=",">
  3329. (#{item.site}, #{item.orderNo}, #{item.functionType}, #{item.operator}, #{item.buNo})
  3330. </foreach>
  3331. </insert>
  3332. <!-- 删除之前的人员-->
  3333. <delete id="delOperator" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3334. DELETE FROM eam_actual_operator
  3335. WHERE site = #{site} and order_no = #{inspectionNo} and bu_no = #{buNo}
  3336. </delete>
  3337. <select id="getInspectionNo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3338. select distinct
  3339. site,
  3340. bu_no,
  3341. equipment_no,
  3342. inspection_no,
  3343. item_no,
  3344. collection_source,
  3345. collection_method
  3346. from Equipment_data_acquisition
  3347. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3348. </select>
  3349. <select id="getInspectionNoByItem" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3350. select distinct
  3351. site,
  3352. bu_no,
  3353. equipment_no,
  3354. inspection_no,
  3355. item_no,
  3356. collection_source,
  3357. collection_method
  3358. from Equipment_data_acquisition
  3359. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
  3360. </select>
  3361. <select id="dataAcquisition" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3362. select
  3363. id,
  3364. site,
  3365. bu_no,
  3366. #{inspectionNo} as inspectionNo,
  3367. #{itemNo} as itemNo,
  3368. <if test='subDetailValueType == 0'>
  3369. ${collectionSource} as subDetailValue,
  3370. </if>
  3371. <if test='subDetailValueType == 1'>
  3372. ${collectionSource} as subDetailValueB,
  3373. </if>
  3374. <if test='subDetailValueType == 2'>
  3375. ${collectionSource} as subDetailValueC,
  3376. </if>
  3377. <if test='subDetailValueType == 3'>
  3378. ${collectionSource} as subDetailValueD,
  3379. </if>
  3380. <if test='subDetailValueType == 4'>
  3381. ${collectionSource} as subDetailValueE,
  3382. </if>
  3383. num,
  3384. #{collectionSource} as collectionSource,
  3385. #{collectionMethod} as collectionMethod
  3386. from Equipment_data_detail
  3387. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3388. <if test='collectionMethod == "plc"'>
  3389. AND inspection_no = #{inspectionNo}
  3390. </if>
  3391. <if test='collectionMethod == "RS232"'>
  3392. AND (inspection_no is null or inspection_no = '')
  3393. </if>
  3394. <if test = "collectionDataContent != null and collectionDataContent != ''">
  3395. AND ${collectionSource} ${collectionDataContent}
  3396. </if>
  3397. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3398. </select>
  3399. <select id="dataAcquisitionB" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3400. select
  3401. id,
  3402. site,
  3403. bu_no,
  3404. #{inspectionNo} as inspectionNo,
  3405. #{itemNo} as itemNo,
  3406. ${collectionSource} as subDetailValueB,
  3407. num,
  3408. #{collectionSource} as collectionSource
  3409. from Equipment_data_detail
  3410. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3411. <if test='collectionMethod == "plc"'>
  3412. AND inspection_no = #{inspectionNo}
  3413. </if>
  3414. <if test='collectionMethod == "RS232"'>
  3415. AND (inspection_no is null or inspection_no = '')
  3416. </if>
  3417. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3418. </select>
  3419. <select id="dataAcquisition2" parameterType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData" resultType="SysOssEntity">
  3420. select
  3421. site as orderRef1,
  3422. bu_no as orderRef4,
  3423. #{inspectionNo} as orderRef2,
  3424. #{itemNo} as orderRef3,
  3425. ${collectionSource} as url
  3426. from Equipment_data_detail
  3427. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  3428. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  3429. </select>
  3430. <select id="getIQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3431. select
  3432. a.site,
  3433. a.bu_no,
  3434. b.collection_condition as equipmentNo,
  3435. #{inspectionNo} as inspectionNo,
  3436. a.item_no,
  3437. b.collection_source,
  3438. #{actionBy} as actionBy,
  3439. b.collection_method
  3440. from qc_iqc_detailed_record as a
  3441. 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
  3442. 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'
  3443. order by a.order_id
  3444. </select>
  3445. <select id="getFAIDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3446. select
  3447. a.site,
  3448. a.bu_no,
  3449. b.collection_condition as equipmentNo,
  3450. #{inspectionNo} as inspectionNo,
  3451. a.item_no,
  3452. b.collection_source,
  3453. #{actionBy} as actionBy,
  3454. b.collection_method
  3455. from qc_fai_detailed_record as a
  3456. 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
  3457. 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'
  3458. order by order_id
  3459. </select>
  3460. <select id="getIPQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3461. select
  3462. a.site,
  3463. a.bu_no,
  3464. b.collection_condition as equipmentNo,
  3465. #{inspectionNo} as inspectionNo,
  3466. a.item_no,
  3467. b.collection_source,
  3468. #{actionBy} as actionBy,
  3469. b.collection_method
  3470. from qc_ipqc_detailed_record as a
  3471. 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
  3472. 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'
  3473. order by a.order_id
  3474. </select>
  3475. <select id="getFQCDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.EquipmentDataAcquisitionData">
  3476. select
  3477. a.site,
  3478. a.bu_no,
  3479. b.collection_condition as equipmentNo,
  3480. #{inspectionNo} as inspectionNo,
  3481. a.item_no,
  3482. b.collection_source,
  3483. #{actionBy} as actionBy,
  3484. b.collection_method
  3485. from qc_fqc_detailed_record as a
  3486. 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
  3487. 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'
  3488. order by a.order_id
  3489. </select>
  3490. <select id="querySubDetails" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3491. select
  3492. b.site,
  3493. b.bu_no,
  3494. b.inspection_no,
  3495. b.item_no,
  3496. b.default_value,
  3497. b.min_value,
  3498. b.max_value,
  3499. b.value_type_db,
  3500. a.sub_detail_value
  3501. <if test="flag == 'iqc'">
  3502. from qc_iqc_sub_detail_record as a
  3503. 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
  3504. </if>
  3505. <if test="flag == 'ipqc'">
  3506. from qc_ipqc_sub_detail_record as a
  3507. 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
  3508. </if>
  3509. <if test="flag == 'fqc'">
  3510. from qc_fqc_sub_detail_record as a
  3511. 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
  3512. </if>
  3513. <if test="flag == 'fai'">
  3514. from qc_fai_sub_detail_record as a
  3515. 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
  3516. </if>
  3517. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and a.item_no = #{itemNo}
  3518. order by b.order_id
  3519. </select>
  3520. <insert id="saveFileList">
  3521. INSERT INTO sys_oss
  3522. (url, create_date, file_name, new_file_name, order_ref1, order_ref2, order_ref3, order_ref4)
  3523. VALUES
  3524. <foreach collection="list" item="item" separator=",">
  3525. (#{item.url}, getDate(), #{item.fileName}, #{item.newFileName}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4})
  3526. </foreach>
  3527. </insert>
  3528. <select id="getEquipmentNoList" parameterType="com.xujie.sys.modules.pms.data.EquipmentFolderLocationData" resultType="com.xujie.sys.modules.pms.data.EquipmentFolderLocationData">
  3529. select
  3530. equipment_no
  3531. from Equipment_folder_location
  3532. where site = #{site} and bu_no = #{buNo}
  3533. </select>
  3534. <!-- 获取责任人员列表 -->
  3535. <select id="getResponsibleOperatorList" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
  3536. SELECT
  3537. operator_id as adminID,
  3538. operator_name as adminName
  3539. FROM operator
  3540. <where>
  3541. site in (select site from eam_access_site where username = #{userName})
  3542. <if test = "adminID != null and adminID != ''">
  3543. AND operator_id LIKE '%' + #{adminID} + '%'
  3544. </if>
  3545. <if test = "adminName != null and adminName != ''">
  3546. AND operator_name LIKE '%' + #{adminName} + '%'
  3547. </if>
  3548. </where>
  3549. </select>
  3550. <select id="getDataContentList" parameterType="com.xujie.sys.modules.pms.data.QcCollectionDataContentData" resultType="com.xujie.sys.modules.pms.data.QcCollectionDataContentData">
  3551. select
  3552. content_desc
  3553. from qc_collection_data_content
  3554. where site = #{site} and bu_no = #{buNo} and active = 'Y'
  3555. </select>
  3556. <select id="getItemCollectionDataContent" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues" resultType="string">
  3557. select
  3558. collection_data_content
  3559. from eam_properties_item
  3560. where site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo}
  3561. </select>
  3562. <!-- 获取当前项目不包含的设备 -->
  3563. <select id="getObjectList1" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3564. SELECT
  3565. a.site,
  3566. a.bu_no,
  3567. a.ObjectID,
  3568. a.ObjectDesc
  3569. FROM eam_object as a
  3570. 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}
  3571. where a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  3572. </select>
  3573. <!-- 获取当前项目所包含的设备 -->
  3574. <select id="getObjectList2" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3575. SELECT
  3576. a.site,
  3577. a.bu_no,
  3578. a.ObjectID,
  3579. b.ObjectDesc,
  3580. a.default_flag
  3581. FROM qc_item_object a
  3582. LEFT JOIN eam_object b ON a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID
  3583. WHERE a.site = #{site} and a.bu_no = #{buNo} and a.ItemNo = #{itemNo}
  3584. </select>
  3585. <!-- 获取当前项目不包含的设备 -->
  3586. <select id="getObjectListBy" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3587. SELECT
  3588. a.site,
  3589. a.bu_no,
  3590. a.ObjectID,
  3591. a.ObjectDesc
  3592. FROM eam_object as a
  3593. 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}
  3594. <where>
  3595. a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  3596. <if test = "objectID != null and objectID != ''">
  3597. AND a.ObjectID LIKE '%' + #{objectID} + '%'
  3598. </if>
  3599. <if test = "objectDesc != null and objectDesc != ''">
  3600. AND a.ObjectDesc LIKE '%' + #{objectDesc} + '%'
  3601. </if>
  3602. </where>
  3603. </select>
  3604. <!-- 新增项目设备 -->
  3605. <insert id="addItemObject">
  3606. INSERT INTO qc_item_object
  3607. (site, bu_no, ItemNo, ObjectID, default_flag)
  3608. VALUES
  3609. <foreach collection="list" item="item" separator=",">
  3610. (#{item.site}, #{item.buNo}, #{item.itemNo}, #{item.objectID}, #{item.defaultFlag})
  3611. </foreach>
  3612. </insert>
  3613. <delete id="deleteItemObject">
  3614. DELETE FROM qc_item_object
  3615. WHERE
  3616. <foreach collection="list" item="item" separator=" or " index="index">
  3617. (site = #{item.site} and bu_no = #{item.buNo} and ItemNo = #{item.itemNo} and ObjectID = #{item.objectID})
  3618. </foreach>
  3619. </delete>
  3620. <update id="updateItemObject">
  3621. UPDATE qc_item_object
  3622. SET default_flag = #{defaultFlag}
  3623. WHERE site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ObjectID = #{objectID}
  3624. </update>
  3625. <select id="getIQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3626. select
  3627. a.site,
  3628. a.bu_no,
  3629. a.inspection_no,
  3630. a.item_no,
  3631. a.item_desc,
  3632. b.collection_source,
  3633. b.collection_method
  3634. from qc_iqc_detailed_record as a
  3635. 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
  3636. 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'
  3637. order by a.order_id
  3638. </select>
  3639. <select id="getFAIInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3640. select
  3641. a.site,
  3642. a.bu_no,
  3643. a.inspection_no,
  3644. a.item_no,
  3645. a.item_desc,
  3646. b.collection_source,
  3647. b.collection_method
  3648. from qc_fai_detailed_record as a
  3649. 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
  3650. 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'
  3651. order by a.order_id
  3652. </select>
  3653. <select id="getFQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3654. select
  3655. a.site,
  3656. a.bu_no,
  3657. a.inspection_no,
  3658. a.item_no,
  3659. a.item_desc,
  3660. b.collection_source,
  3661. b.collection_method
  3662. from qc_fqc_detailed_record as a
  3663. 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
  3664. 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'
  3665. order by a.order_id
  3666. </select>
  3667. <select id="getIPQCInspectionDetail" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
  3668. select
  3669. a.site,
  3670. a.bu_no,
  3671. a.inspection_no,
  3672. a.item_no,
  3673. a.item_desc,
  3674. b.collection_source,
  3675. b.collection_method
  3676. from qc_ipqc_detailed_record as a
  3677. 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
  3678. 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'
  3679. order by a.order_id
  3680. </select>
  3681. <delete id="deleteEquipmentDataAcquisition" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3682. delete from Equipment_data_acquisition
  3683. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3684. </delete>
  3685. <select id="getInspectionStandards" parameterType="com.xujie.sys.modules.pms.data.QcInspectionStandardData" resultType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3686. select
  3687. site,
  3688. bu_no,
  3689. template_id,
  3690. item_no,
  3691. default_value,
  3692. min_value,
  3693. max_value,
  3694. condition,
  3695. collection_source,
  3696. seq_no
  3697. from qc_inspection_standards
  3698. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3699. </select>
  3700. <delete id="deleteInspectionStandard" parameterType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3701. delete from qc_inspection_standards
  3702. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3703. </delete>
  3704. <delete id="deleteInspectionStandard2" parameterType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3705. delete from qc_inspection_standards
  3706. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  3707. </delete>
  3708. <insert id="saveInspectionStandard">
  3709. INSERT INTO qc_inspection_standards
  3710. (site, bu_no, template_id, item_no, default_value, min_value, max_value, condition, collection_source, seq_no)
  3711. VALUES
  3712. <foreach collection="list" item="item" separator=",">
  3713. (#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.minValue}, #{item.maxValue}, #{item.condition}, #{item.collectionSource}, #{item.seqNo})
  3714. </foreach>
  3715. </insert>
  3716. <insert id="saveEquipmentFolderLocationList">
  3717. insert into Equipment_folder_location
  3718. (folder_path,equipment_no,site,bu_no,file_no,backup_folder_path,IP,suffix,equipment_desc,backup_photo_path,batch_date,port,register_address,
  3719. register_num,register_num_columntype,register_address_inspection,register_num_inspection,register_num_inspection_columntype,unit_id,
  3720. excel_compare_fields_x,excel_compare_fields_y,initial_line,data_row,skip_line,cutting_symbol,transparent_flag,Formula_calculation,
  3721. Formula,Group_calculation,regexp,repair_type,buzzer,create_by,create_time)
  3722. values (#{folderPath}, #{equipmentNo}, #{site}, #{buNo}, #{fileNo}, #{backupFolderPath}, #{IP}, #{suffix}, #{equipmentDesc}, #{backupPhotoPath}, #{batchDate}, #{port}, #{registerAddress},
  3723. #{registerNum}, #{registerNumColumntype}, #{registerAddressInspection}, #{registerNumInspection}, #{registerNumInspectionColumntype}, #{unitId},
  3724. #{excelCompareFieldsX}, #{excelCompareFieldsY}, #{initialLine}, #{dataRow}, #{skipLine}, #{cuttingSymbol}, #{transparentFlag}, #{formulaCalculation},
  3725. #{formula}, #{groupCalculation}, #{regexp}, #{repairType}, #{buzzer}, #{createBy}, getDate())
  3726. </insert>
  3727. <select id="getInspectionTemplateDetail" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData" resultType="com.xujie.sys.modules.pms.data.QcInspectionStandardData">
  3728. select
  3729. site,
  3730. bu_no,
  3731. template_id,
  3732. item_no
  3733. <if test="flag == 'iqc'">
  3734. from qc_iqc_detailed_record
  3735. </if>
  3736. <if test="flag == 'ipqc'">
  3737. from qc_ipqc_detailed_record
  3738. </if>
  3739. <if test="flag == 'fqc'">
  3740. from qc_fqc_detailed_record
  3741. </if>
  3742. <if test="flag == 'fai'">
  3743. from qc_fai_detailed_record
  3744. </if>
  3745. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3746. order by order_id
  3747. </select>
  3748. <update id="updateEquipmentDataDetailInspectionNo" parameterType="com.xujie.sys.modules.pms.data.SubDetailValues">
  3749. update Equipment_data_detail
  3750. set inspection_no = #{inspectionNo}
  3751. where id = #{id}
  3752. </update>
  3753. <delete id="deleteInspectionFiles" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3754. delete sys_oss
  3755. where order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref4 = #{buNo}
  3756. </delete>
  3757. <select id="getUpItemdata" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3758. select
  3759. top 1
  3760. site,
  3761. bu_no,
  3762. template_id,
  3763. ItemNo,
  3764. order_id
  3765. from qc_template_detailed
  3766. where #{orderId} > order_id
  3767. and site = #{site}
  3768. and bu_no= #{buNo}
  3769. and template_id = #{templateId}
  3770. order by order_id desc
  3771. </select>
  3772. <select id="getDownItemdata" resultType="com.xujie.sys.modules.pms.data.QcTemplateData">
  3773. select
  3774. top 1
  3775. site,
  3776. bu_no,
  3777. template_id,
  3778. ItemNo,
  3779. order_id
  3780. from qc_template_detailed
  3781. where order_id > #{orderId}
  3782. and site = #{site}
  3783. and bu_no= #{buNo}
  3784. and template_id = #{templateId}
  3785. order by order_id
  3786. </select>
  3787. <update id="updateQcItemOrder">
  3788. update qc_template_detailed
  3789. set order_id=#{orderId}
  3790. where site = #{site}
  3791. and bu_no= #{buNo}
  3792. and template_id = #{templateId}
  3793. and ItemNo = #{itemNo}
  3794. </update>
  3795. <select id="getQCDetailOrderId" resultType="Integer">
  3796. SELECT isnull(max(order_id), 0) + 1
  3797. from qc_template_detailed
  3798. where site = #{site}
  3799. and bu_no= #{buNo}
  3800. and template_id = #{templateId}
  3801. </select>
  3802. <select id="updateQCDetailOrderIdNull">
  3803. UPDATE qc_template_detailed
  3804. SET qc_template_detailed.order_id = oi.rn
  3805. FROM (SELECT
  3806. site,
  3807. bu_no,
  3808. template_id,
  3809. ItemNo,
  3810. ROW_NUMBER() OVER (PARTITION BY site,bu_no,template_id ORDER BY ItemNo) AS rn
  3811. FROM qc_template_detailed
  3812. ) as oi
  3813. where qc_template_detailed.template_id = oi.template_id
  3814. AND qc_template_detailed.ItemNo = oi.ItemNo
  3815. and qc_template_detailed.order_id is null
  3816. </select>
  3817. <select id="selectInfoByInspectionNo" resultType="com.xujie.sys.modules.pms.data.PoOrderRollNoData" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3818. select
  3819. site,
  3820. citem_code,
  3821. inspection_no
  3822. from po_order_roll_no
  3823. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  3824. </select>
  3825. <update id="updateIQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3826. UPDATE qc_iqc_record
  3827. SET submit_flag = 'N',
  3828. state = '待检验',
  3829. cancel_check_by = #{updateBy},
  3830. cancel_check_date = getDate()
  3831. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3832. </update>
  3833. <update id="updateIQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3834. UPDATE qc_iqc_detailed_record
  3835. SET is_submit = 'N'
  3836. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3837. </update>
  3838. <update id="updateIQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3839. UPDATE qc_iqc_sub_detail_record
  3840. SET is_submit = 'N'
  3841. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3842. </update>
  3843. <update id="updateFAIMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3844. UPDATE qc_fai_record
  3845. SET submit_flag = 'N',
  3846. state = '待检验',
  3847. cancel_check_by = #{updateBy},
  3848. cancel_check_date = getDate()
  3849. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3850. </update>
  3851. <update id="updateFAIDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3852. UPDATE qc_fai_detailed_record
  3853. SET is_submit = 'N'
  3854. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3855. </update>
  3856. <update id="updateFAISubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3857. UPDATE qc_fai_sub_detail_record
  3858. SET is_submit = 'N'
  3859. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3860. </update>
  3861. <update id="updateIPQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3862. UPDATE qc_ipqc_record
  3863. SET submit_flag = 'N',
  3864. state = '待检验',
  3865. cancel_check_by = #{updateBy},
  3866. cancel_check_date = getDate()
  3867. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3868. </update>
  3869. <update id="updateIPQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3870. UPDATE qc_ipqc_detailed_record
  3871. SET is_submit = 'N'
  3872. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3873. </update>
  3874. <update id="updateIPQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3875. UPDATE qc_ipqc_sub_detail_record
  3876. SET is_submit = 'N'
  3877. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3878. </update>
  3879. <update id="updateFQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3880. UPDATE qc_fqc_record
  3881. SET submit_flag = 'N',
  3882. state = '待检验',
  3883. cancel_check_by = #{updateBy},
  3884. cancel_check_date = getDate()
  3885. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3886. </update>
  3887. <update id="updateFQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3888. UPDATE qc_fqc_detailed_record
  3889. SET is_submit = 'N'
  3890. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3891. </update>
  3892. <update id="updateFQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3893. UPDATE qc_fqc_sub_detail_record
  3894. SET is_submit = 'N'
  3895. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3896. </update>
  3897. <update id="updatePQCMasterSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3898. UPDATE qc_pqc_record
  3899. SET submit_flag = 'N',
  3900. state = '待检验',
  3901. cancel_check_by = #{updateBy},
  3902. cancel_check_date = getDate()
  3903. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3904. </update>
  3905. <update id="updatePQCDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3906. UPDATE qc_pqc_detailed_record
  3907. SET is_submit = 'N'
  3908. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3909. </update>
  3910. <update id="updatePQCSubDetailSubmitFlag2" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3911. UPDATE qc_pqc_sub_detail_record
  3912. SET is_submit = 'N'
  3913. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3914. </update>
  3915. <delete id="deleteReceivingTaskByInspectionNo" parameterType="com.xujie.sys.modules.pms.data.QcFAIRecordData">
  3916. delete receiving_task
  3917. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  3918. </delete>
  3919. <delete id="deleteEquipmentFolderLocationList">
  3920. delete from Equipment_folder_location
  3921. where id = #{id}
  3922. </delete>
  3923. <select id="getQMSTask" resultType="com.xujie.sys.modules.pms.data.QmsTaskData">
  3924. select
  3925. id,
  3926. site,
  3927. bu_no,
  3928. part_no,
  3929. operation_desc,
  3930. s_resourceid,
  3931. qtyrequired,
  3932. create_date,
  3933. create_by,
  3934. inspection_type,
  3935. type,
  3936. order_no,
  3937. seqno,
  3938. template_id,
  3939. um_id,
  3940. work_center_no
  3941. from QMS_soscheduledrouting_TASK
  3942. where ISNULL(delete_flag, '') <![CDATA[<>]]> 'Y'
  3943. </select>
  3944. <select id="getSuffixList" resultType="java.lang.String">
  3945. select distinct suffix from Equipment_folder_location
  3946. </select>
  3947. <select id="checkEquipmentFolderLocation" resultType="java.lang.Integer">
  3948. select count(1)
  3949. from Equipment_folder_location
  3950. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}
  3951. </select>
  3952. <update id="updateQMSTaskById">
  3953. UPDATE QMS_soscheduledrouting_TASK
  3954. SET delete_flag = 'Y'
  3955. WHERE id = #{id}
  3956. </update>
  3957. <select id="queryEquipmentFolderLocationList"
  3958. resultType="com.xujie.sys.modules.pms.data.QCEquipmentFolderLocation">
  3959. select efl.*,
  3960. dbo.get_bu_desc(efl.site, efl.bu_no) as buDesc
  3961. from Equipment_folder_location efl
  3962. <where>
  3963. <if test="params.site != null and params.site != ''">
  3964. and efl.site = #{params.site}
  3965. </if>
  3966. <if test="params.buNo != null and params.buNo != ''">
  3967. and efl.bu_no = #{params.buNo}
  3968. </if>
  3969. <if test="params.equipmentNo != null and params.equipmentNo != ''">
  3970. and efl.equipment_no like '%'+ #{params.equipmentNo} +'%'
  3971. </if>
  3972. <if test="params.equipmentDesc != null and params.equipmentDesc != ''">
  3973. and efl.equipment_desc like '%'+ #{params.equipmentDesc} +'%'
  3974. </if>
  3975. <if test="params.IP != null and params.IP != ''">
  3976. and efl.IP like '%'+ #{params.IP} +'%'
  3977. </if>
  3978. <if test="params.suffix != null and params.suffix != ''">
  3979. and efl.suffix like '%'+ #{params.suffix} +'%'
  3980. </if>
  3981. </where>
  3982. </select>
  3983. <select id="getPqcOperationDescList" resultType="com.xujie.sys.modules.pms.data.QcPartAttributeData">
  3984. select qro.description as operationDesc
  3985. from operation_resource a
  3986. left join qc_pqc_record_operation qro on a.operation = qro.code
  3987. GROUP BY qro.description
  3988. </select>
  3989. <update id="updateEquipmentFolderLocation">
  3990. UPDATE Equipment_folder_location
  3991. SET
  3992. folder_path = #{folderPath},
  3993. equipment_no = #{equipmentNo},
  3994. bu_no = #{buNo},
  3995. file_no = #{fileNo},
  3996. backup_folder_path = #{backupFolderPath},
  3997. IP = #{IP},
  3998. suffix = #{suffix},
  3999. equipment_desc = #{equipmentDesc},
  4000. backup_photo_path = #{backupPhotoPath},
  4001. batch_date = #{batchDate},
  4002. port = #{port},
  4003. register_address = #{registerAddress},
  4004. register_num = #{registerNum},
  4005. register_num_columntype = #{registerNumColumntype},
  4006. register_address_inspection = #{registerAddressInspection},
  4007. register_num_inspection = #{registerNumInspection},
  4008. register_num_inspection_columntype = #{registerNumInspectionColumntype},
  4009. unit_id = #{unitId},
  4010. excel_compare_fields_x = #{excelCompareFieldsX},
  4011. excel_compare_fields_y = #{excelCompareFieldsY},
  4012. initial_line = #{initialLine},
  4013. data_row = #{dataRow},
  4014. skip_line = #{skipLine},
  4015. cutting_symbol = #{cuttingSymbol},
  4016. transparent_flag = #{transparentFlag},
  4017. Formula_calculation = #{formulaCalculation},
  4018. Formula = #{formula},
  4019. Group_calculation = #{groupCalculation},
  4020. regexp = #{regexp},
  4021. repair_type = #{repairType},
  4022. buzzer = #{buzzer},
  4023. update_by = #{updateBy},
  4024. update_time = getDate()
  4025. WHERE id = #{id}
  4026. </update>
  4027. </mapper>