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.

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