RingScanInformationMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zkqy.amichi.mapper.RingScanInformationMapper">
  6. <resultMap type="com.zkqy.amichi.domain.RingScanInformation" id="RingScanInformationResult">
  7. <result property="id" column="id" />
  8. <result property="deviceNumber" column="device_number" />
  9. <result property="deviceName" column="device_name" />
  10. <result property="scanningTime" column="scanning_time" />
  11. <result property="contentInformation" column="content_information" />
  12. <result property="stationName" column="station_name" />
  13. <result property="personnelName" column="personnel_name" />
  14. <result property="processName" column="process_name" />
  15. <result property="executionMessage" column="execution_message"/>
  16. <result property="executionMark" column="execution_mark"/>
  17. <result property="orderNumber" column="order_number" />
  18. <result property="productionOrderNumber" column="production_order_number" />
  19. <result property="processName" column="process_name" />
  20. <result property="overNumber" column="over_number" />
  21. </resultMap>
  22. <select id="selectRingScanInformationListScfy" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
  23. select id, device_number, station_name, personnel_name,
  24. process_name,scanning_time, content_information,execution_message,execution_mark,over_number,production_order_number
  25. from
  26. fjqydb.ring_scan_information
  27. <where>
  28. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  29. order by scanning_time desc limit #{offset},#{pageSize}
  30. </where>
  31. </select>
  32. <select id="selectRingScanInformationListScfyCount" resultType="java.lang.Integer" parameterType="com.zkqy.amichi.domain.RingScanInformation">
  33. select count(id) from fjqydb.ring_scan_information
  34. <where>
  35. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  36. and DATE(scanning_time) = CURDATE()
  37. </where>
  38. </select>
  39. <sql id="selectRingScanInformationVo">
  40. select id, device_number, device_name, scanning_time,process_name,station_name, content_information,personnel_name,order_number,production_order_number,execution_message,over_number from fjqydb.ring_scan_information
  41. </sql>
  42. <select id="selectRingScanInformationList" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
  43. <include refid="selectRingScanInformationVo"/>
  44. <where>
  45. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  46. <if test="processName != null and processName != ''"> and process_name = #{processName}</if>
  47. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  48. <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
  49. <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
  50. <if test="productionOrderNumber != null and productionOrderNumber != ''"> and production_order_number = #{productionOrderNumber}</if>
  51. <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
  52. <if test="productionOrderNumber!=null and productionOrderNumber!=''">and production_order_number = #{productionOrderNumber}</if>
  53. <if test="orderNumber!=null and orderNumber!=''">and order_number = #{orderNumber}</if>
  54. <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
  55. <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
  56. </if>
  57. <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[1] != ''">
  58. <![CDATA[ and scanning_time <= #{scanningTimes[1]}]]>
  59. </if>
  60. </where>
  61. order by scanning_time,process_name
  62. </select>
  63. <select id="selectRingScanInformationDownload" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResultNR">
  64. SELECT
  65. rsi.id,
  66. rsi.device_number,
  67. rsi.device_name,
  68. rsi.scanning_time,
  69. rsi.content_information,
  70. rsi.native_numbering,
  71. rsi.personnel_name,
  72. rsi.process_name,
  73. rsi.station_name,
  74. rsi.execution_mark,
  75. rsi.execution_message,
  76. ptd.material_id,
  77. ptd.material_name,
  78. ptd.model_number AS model,
  79. ptd.specification as specification,
  80. ptd.demand_document,
  81. rsi.production_order_number,
  82. rsi.order_number
  83. FROM
  84. fjqydb.ring_scan_information as rsi
  85. LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
  86. <where>
  87. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  88. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  89. <if test="scanningTimeString != null "> and DATE(scanning_time) = DATE(#{scanningTimeString})</if>
  90. <if test="personnelName != null "> and personnel_name = #{personnelName}</if>
  91. <if test="process != null "> and process = #{process}</if>
  92. <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
  93. <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
  94. <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
  95. <if test="productionOrderNumber!=null and productionOrderNumber!=''">and rsi.production_order_number = #{productionOrderNumber}</if>
  96. <if test="orderNumber!=null and orderNumber!=''">and rsi.order_number like concat('%', #{orderNumber}, '%')</if>
  97. <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
  98. <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
  99. </if>
  100. <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[1] != ''">
  101. <![CDATA[ and scanning_time <= #{scanningTimes[1]}]]>
  102. </if>
  103. </where>
  104. order by personnel_name,process_name asc,scanning_time desc
  105. </select>
  106. <resultMap type="com.zkqy.amichi.domain.vo.RingScanInformationVo" id="RingScanInformationResultNR">
  107. <result property="id" column="id" />
  108. <result property="deviceNumber" column="device_number" />
  109. <result property="deviceName" column="device_name" />
  110. <result property="scanningTime" column="scanning_time" />
  111. <result property="contentInformation" column="content_information" />
  112. <result property="nativeNumbering" column="native_numbering" />
  113. <result property="orderNumber" column="production_order_number" />
  114. <result property="serialNumber" column="serial_number" />
  115. <result property="materialCode" column="material_id" />
  116. <result property="materialName" column="material_name" />
  117. <result property="model" column="model" />
  118. <result property="demandDocument" column="order_number" />
  119. <result property="personnelName" column="personnel_name" />
  120. <result property="processName" column="process_name" />
  121. <result property="stationName" column="station_name" />
  122. <result property="executionMessage" column="execution_message"/>
  123. <result property="executionMark" column="execution_mark"/>
  124. <result property="specification" column="specification"/>
  125. </resultMap>
  126. <!--
  127. SELECT
  128. rsi.id,
  129. rsi.device_number,
  130. rsi.device_name,
  131. rsi.scanning_time,
  132. rsi.content_information,
  133. rsi.native_numbering,
  134. rsi.personnel_name,
  135. rsi.process_name,
  136. rsi.station_name,
  137. rsi.execution_mark,
  138. rsi.execution_message,
  139. ptd.material_id,
  140. ptd.material_name,
  141. ptd.model_number AS model,
  142. ptd.specification as specification,
  143. ptd.demand_document,
  144. rsi.production_order_number,
  145. rsi.order_number
  146. FROM
  147. fjqydb.ring_scan_information as rsi
  148. LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
  149. left join fjqydb.production_planning_management as ppm on ptd.plan_id=ppm.id
  150. -->
  151. <select id="selectRingScanInformationListVo" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResultNR">
  152. SELECT
  153. rsi.id,
  154. rsi.device_number,
  155. rsi.device_name,
  156. rsi.scanning_time,
  157. rsi.content_information,
  158. rsi.native_numbering,
  159. rsi.personnel_name,
  160. rsi.process_name,
  161. rsi.station_name,
  162. rsi.execution_mark,
  163. rsi.execution_message,
  164. ptd.material_id,
  165. ptd.material_name,
  166. ptd.model_number AS model,
  167. ptd.specification as specification,
  168. ptd.demand_document,
  169. rsi.production_order_number,
  170. rsi.order_number
  171. FROM
  172. fjqydb.ring_scan_information as rsi
  173. LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
  174. left join fjqydb.production_planning_management as ppm on ptd.plan_id=ppm.id
  175. <where>
  176. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  177. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  178. <if test="scanningTime != null "> and DATE(scanning_time) = #{scanningTime}</if>
  179. <if test="personnelName != null "> and personnel_name like concat('%', #{personnelName}, '%') </if>
  180. <if test="process != null "> and process like concat('%', #{process}, '%')</if>
  181. <if test="contentInformation != null and contentInformation != ''"> and content_information like concat('%', #{contentInformation}, '%')</if>
  182. <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering like concat('%', #{nativeNumbering}, '%')</if>
  183. <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
  184. <if test="productionOrderNumber!=null and productionOrderNumber!=''">and rsi.production_order_number like concat('%', #{productionOrderNumber}, '%')</if>
  185. <if test="orderNumber!=null and orderNumber!=''">and rsi.order_number like concat('%', #{orderNumber}, '%')</if>
  186. <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
  187. <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
  188. </if>
  189. <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[1] != ''">
  190. <![CDATA[ and scanning_time <= #{scanningTimes[1]}]]>
  191. </if>
  192. </where>
  193. order by scanning_time desc
  194. </select>
  195. <select id="selectRingScanInformationById" parameterType="Long" resultMap="RingScanInformationResult">
  196. <include refid="selectRingScanInformationVo"/>
  197. where id = #{id}
  198. </select>
  199. <select id="selectRingScanInformationListDateTimeMax"
  200. parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
  201. <include refid="selectRingScanInformationVo"/>
  202. <where>
  203. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  204. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  205. <if test="scanningTime != null "> and scanning_time = #{scanningTime}</if>
  206. <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
  207. </where>
  208. order by scanning_time DESC
  209. LIMIT 1
  210. </select>
  211. <select id="selectRingScanInformationLog" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
  212. SELECT
  213. count(sub.count) as `count`,
  214. sub.process_name,
  215. sub.order_number,
  216. sub.scanning_time,
  217. sub.production_order_number,
  218. sub.sort,
  219. rsif.`status`,
  220. rsif.start_time,
  221. rsif.end_time,
  222. rsif.total_quantity,
  223. rsif.production_order_total_quantity
  224. FROM
  225. (
  226. SELECT
  227. rsi.process_name,
  228. rsi.native_numbering,
  229. rsi.order_number,
  230. COUNT( rsi.process_name ) AS count,
  231. rsi.production_order_number,
  232. MAX( rsi.scanning_time ) AS scanning_time,
  233. pl.sort
  234. FROM
  235. fjqydb.ring_scan_information AS rsi
  236. LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
  237. WHERE
  238. rsi.execution_mark = '1'
  239. GROUP BY
  240. rsi.order_number,rsi.process_name,rsi.native_numbering
  241. ) AS sub
  242. LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( sub.production_order_number = rsif.production_order_number )
  243. <where>
  244. <if test="list != null and list.size()>0">
  245. sub.order_number IN
  246. <foreach item="id" collection="list" open="(" separator="," close=")">
  247. #{id}
  248. </foreach>
  249. </if>
  250. <if test="list == null or list.size() == 0">
  251. rsi.order_number = 'X'
  252. </if>
  253. </where>
  254. GROUP BY
  255. sub.order_number,
  256. sub.process_name
  257. ORDER BY
  258. sub.sort,
  259. rsif.start_time desc
  260. </select>
  261. <!--
  262. SELECT
  263. count(sub.count) as `count`,
  264. sub.process_name,
  265. sub.order_number,
  266. sub.scanning_time,
  267. sub.production_order_number,
  268. sub.sort,
  269. rsif.`status`,
  270. rsif.start_time,
  271. rsif.end_time,
  272. rsif.total_quantity,
  273. rsif.production_order_total_quantity,
  274. ptd.model_number as modelNumber,
  275. ptd.specification as specification
  276. FROM
  277. (
  278. SELECT
  279. rsi.process_name,
  280. rsi.native_numbering,
  281. rsi.order_number,
  282. COUNT( rsi.process_name ) AS count,
  283. rsi.production_order_number,
  284. MAX( rsi.scanning_time ) AS scanning_time,
  285. pl.sort
  286. FROM
  287. fjqydb.ring_scan_information AS rsi
  288. LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
  289. <where>
  290. <if test="list != null and list.size()>0">
  291. rsi.production_order_number in
  292. <foreach item="id" collection="list" open="(" separator="," close=")">
  293. #{id}
  294. </foreach>
  295. </if>
  296. <if test="list == null or list.size() == 0">
  297. rsi.production_order_number = 'X'
  298. </if>
  299. and rsi.execution_mark = '1'
  300. </where>
  301. GROUP BY
  302. rsi.production_order_number,rsi.process_name,rsi.native_numbering
  303. ) AS sub
  304. LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( sub.production_order_number = rsif.production_order_number )
  305. left join fjqydb.plan_task_details as ptd on ptd.demand_document=sub.production_order_number
  306. <where>
  307. <if test="list != null and list.size()>0">
  308. sub.production_order_number IN
  309. <foreach item="id" collection="list" open="(" separator="," close=")">
  310. #{id}
  311. </foreach>
  312. </if>
  313. <if test="list == null or list.size() == 0">
  314. rsi.production_order_number = 'X'
  315. </if>
  316. </where>
  317. GROUP BY
  318. sub.production_order_number,
  319. sub.process_name
  320. ORDER BY
  321. rsif.start_time desc,sub.sort
  322. -->
  323. <select id="selectRingScanInformationLog2" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
  324. SELECT
  325. sub.process_name,
  326. sub.order_number,
  327. sub.scanning_time,
  328. sub.production_order_number,
  329. sub.sort,
  330. sub.`status`,
  331. sub.start_time,
  332. sub.end_time,
  333. sub.total_quantity,
  334. sub.production_order_total_quantity,
  335. sub.modelNumber AS modelNumber,
  336. sub.specification AS specification,
  337. COUNT(sub.process_name) as `count`
  338. FROM
  339. (
  340. SELECT
  341. rsi.process_name,
  342. rsi.native_numbering,
  343. rsi.order_number,
  344. rsi.production_order_number,
  345. MAX( rsi.scanning_time ) AS scanning_time,
  346. pl.sort,
  347. rsif.`status`,
  348. rsif.start_time,
  349. rsif.end_time,
  350. rsif.total_quantity,
  351. rsif.production_order_total_quantity,
  352. ptd.model_number AS modelNumber,
  353. ptd.specification AS specification
  354. FROM
  355. fjqydb.ring_scan_information AS rsi
  356. LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
  357. LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( rsi.production_order_number = rsif.production_order_number )
  358. LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
  359. <where>
  360. <if test="list != null and list.size()>0">
  361. rsif.production_order_number IN
  362. <foreach item="id" collection="list" open="(" separator="," close=")">
  363. #{id}
  364. </foreach>
  365. </if>
  366. <if test="list == null or list.size() == 0">
  367. rsi.production_order_number = 'X'
  368. </if>
  369. and rsi.execution_mark = '1'
  370. </where>
  371. GROUP BY
  372. rsi.production_order_number,
  373. rsi.process_name,
  374. rsi.native_numbering
  375. ) AS sub
  376. GROUP BY
  377. sub.production_order_number,
  378. sub.process_name
  379. ORDER BY
  380. sub.start_time DESC,
  381. sub.sort
  382. </select>
  383. <select id="selectScanStatistics" resultType="com.zkqy.amichi.domain.vo.ScanStatistics" parameterType="com.zkqy.amichi.domain.RingScanInformation">
  384. SELECT
  385. CONCAT(c.order_number, '/', c.model_number) AS dOrder,
  386. c.dCount,
  387. SUM( CASE WHEN c.execution_mark = 1 THEN 1 ELSE 0 END ) AS dsCount,
  388. SUM( CASE WHEN c.execution_mark = 2 THEN 1 ELSE 0 END ) As dfCount
  389. FROM
  390. (
  391. SELECT
  392. rsi.order_number,
  393. rsi.native_numbering,
  394. rsif.total_quantity AS dCount,
  395. rsi.execution_mark,
  396. ptd.model_number
  397. FROM
  398. fjqydb.ring_scan_information rsi
  399. LEFT JOIN fjqydb.ring_scan_information_first rsif ON rsi.production_order_number = rsif.production_order_number
  400. LEFT JOIN fjqydb.plan_task_details AS ptd ON rsi.production_order_number = ptd.demand_document
  401. <where>
  402. <if test="processName!=null and processName!='' and processName.equals('焊接D')">
  403. rsi.content_information LIKE concat('%','D', '%' ) and rsi.process_name='焊接'
  404. </if>
  405. <if test="processName!=null and processName!='' and processName.equals('焊接Z')">
  406. rsi.content_information LIKE concat('%','Z', '%' ) and rsi.process_name='焊接'
  407. </if>
  408. <if test="productionOrderNumber!=null and productionOrderNumber!=''">
  409. and rsi.production_order_number=#{productionOrderNumber}
  410. </if>
  411. <if test="processName!=null and processName!='' and processName!='焊接D' and processName!='焊接Z'">
  412. and rsi.process_name like concat('%', #{processName}, '%')
  413. </if>
  414. and execution_mark='1'
  415. </where>
  416. GROUP BY native_numbering
  417. ) AS c
  418. GROUP BY
  419. order_number
  420. </select>
  421. <select id="selectRingScanInformationListLike" resultType="java.lang.String" parameterType="com.zkqy.amichi.domain.RingScanInformation">
  422. SELECT
  423. COUNT(1)
  424. FROM
  425. fjqydb.ring_scan_information
  426. <where>
  427. <if test="processName!=null and processName!='' and processName.equals('焊接D')">
  428. content_information LIKE concat('%','D', '%' ) and process_name='焊接'
  429. </if>
  430. <if test="processName!=null and processName!='' and processName.equals('焊接Z')">
  431. content_information LIKE concat('%','Z', '%' ) and process_name='焊接'
  432. </if>
  433. <if test="orderNumber!=null and orderNumber!=''">
  434. and order_number=#{orderNumber}
  435. </if>
  436. <if test="processName!=null and processName!='' and processName!='焊接D' and processName!='焊接Z'">
  437. and process_name like concat('%', #{processName}, '%')
  438. </if>
  439. and execution_mark='1'
  440. </where>
  441. </select>
  442. <select id="handHeldJournal" resultType="map" parameterType="com.zkqy.amichi.domain.RingScanInformation">
  443. SELECT
  444. rsif.total_quantity as Dcount,
  445. concat(rsi.order_number,'/' ,ptd.model_number) as Dorder,
  446. rsi.order_number as DorderName,
  447. rsi.production_order_number ,
  448. rsi.personnel_name as Uname,
  449. rsi.station_name as Ugw,
  450. rsi.process_name as processName,
  451. SUM( CASE WHEN rsi.execution_mark = 1 THEN 1 ELSE 0 END ) AS dsCount,
  452. SUM( CASE WHEN rsi.execution_mark = 2 THEN 1 ELSE 0 END ) As dfCount
  453. FROM
  454. fjqydb.ring_scan_information AS rsi
  455. LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON rsi.production_order_number = rsif.production_order_number
  456. left join fjqydb.plan_task_details as ptd on rsi.production_order_number=ptd.demand_document
  457. where DATE(rsi.scanning_time) = CURDATE() and
  458. rsi.execution_message !='失败-未同步ERP' and rsi.execution_message !='未绑定-人员-扫描失败' and rsi.execution_message !='失败-已结案'
  459. GROUP BY
  460. rsi.order_number,
  461. rsi.personnel_name,
  462. rsi.station_name
  463. </select>
  464. <select id="selectRingScanInformationListisNotNull"
  465. resultType="com.zkqy.amichi.domain.RingScanInformation">
  466. <include refid="selectRingScanInformationVo"/>
  467. <where>
  468. <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
  469. <if test="processName != null and processName != ''"> and process_name = #{processName}</if>
  470. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  471. <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
  472. <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
  473. <if test="productionOrderNumber != null and productionOrderNumber != ''"> and production_order_number = #{productionOrderNumber}</if>
  474. <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
  475. <if test="productionOrderNumber!=null and productionOrderNumber!=''">and production_order_number = #{productionOrderNumber}</if>
  476. <if test="orderNumber!=null and orderNumber!=''">and order_number = #{orderNumber}</if>
  477. <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
  478. <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
  479. </if>
  480. <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[0] != ''">
  481. <![CDATA[ and scanning_time <= #{scanningTimes[0]}]]>
  482. </if>
  483. and order_number is not null
  484. AND execution_message !='失败-已结案'
  485. </where>
  486. order by scanning_time,process_name
  487. </select>
  488. <select id="selectRingScanInfoByUserNameAndOrderNumber" resultType="java.lang.String">
  489. SELECT
  490. COUNT(DISTINCT rsi.native_numbering) AS completedMachines
  491. FROM
  492. fjqydb.ring_scan_information AS rsi
  493. WHERE
  494. rsi.process_name = #{gw}
  495. AND rsi.personnel_name = #{uname}
  496. AND rsi.order_number =#{dorder}
  497. AND rsi.execution_mark = '1'
  498. GROUP BY
  499. rsi.personnel_name,
  500. rsi.order_number;
  501. </select>
  502. <select id="scanCodeLogOrderInfo" resultType="java.util.Map">
  503. SELECT
  504. rsif.order_number AS order_number,
  505. rsif.total_quantity,
  506. rsif.start_time,
  507. COUNT(CASE WHEN rsi.process_name = '入库' THEN rsif.order_number END) AS over_number
  508. FROM
  509. fjqydb.`ring_scan_information_first` AS rsif
  510. LEFT JOIN fjqydb.ring_scan_information AS rsi ON rsif.order_number = rsi.order_number
  511. WHERE
  512. rsi.execution_mark =1
  513. GROUP BY
  514. rsif.order_number
  515. ORDER BY rsif.start_time desc
  516. </select>
  517. <insert id="insertRingScanInformation" parameterType="com.zkqy.amichi.domain.RingScanInformation" useGeneratedKeys="true" keyProperty="id">
  518. insert into fjqydb.ring_scan_information
  519. <trim prefix="(" suffix=")" suffixOverrides=",">
  520. <if test="deviceNumber != null">device_number,</if>
  521. <if test="deviceName != null">device_name,</if>
  522. <if test="scanningTime != null">scanning_time,</if>
  523. <if test="contentInformation != null">content_information,</if>
  524. <if test="nativeNumbering != null">native_numbering,</if>
  525. <if test="personnelName != null">personnel_name,</if>
  526. <if test="process != null">process,</if>
  527. <if test="processName != null">process_name,</if>
  528. <if test="orderNumber != null">order_number,</if>
  529. <if test="productionOrderNumber != null">production_order_number,</if>
  530. <if test="stationId != null">station_id,</if>
  531. <if test="stationName != null">station_name,</if>
  532. <if test="executionMark != null">execution_mark,</if>
  533. <if test="executionMessage != null">execution_message,</if>
  534. <if test="overNumber != null">over_number,</if>
  535. </trim>
  536. <trim prefix="values (" suffix=")" suffixOverrides=",">
  537. <if test="deviceNumber != null">#{deviceNumber},</if>
  538. <if test="deviceName != null">#{deviceName},</if>
  539. <if test="scanningTime != null">#{scanningTime},</if>
  540. <if test="contentInformation != null">#{contentInformation},</if>
  541. <if test="nativeNumbering != null">#{nativeNumbering},</if>
  542. <if test="personnelName != null">#{personnelName},</if>
  543. <if test="process != null">#{process},</if>
  544. <if test="processName != null">#{processName},</if>
  545. <if test="orderNumber != null">#{orderNumber},</if>
  546. <if test="productionOrderNumber != null">#{productionOrderNumber},</if>
  547. <if test="stationId != null">#{stationId},</if>
  548. <if test="stationName != null">#{stationName},</if>
  549. <if test="executionMark != null">#{executionMark},</if>
  550. <if test="executionMessage != null">#{executionMessage},</if>
  551. <if test="overNumber != null">#{overNumber},</if>
  552. </trim>
  553. </insert>
  554. <update id="updateRingScanInformation" parameterType="com.zkqy.amichi.domain.RingScanInformation">
  555. update fjqydb.ring_scan_information
  556. <trim prefix="SET" suffixOverrides=",">
  557. <if test="deviceNumber != null">device_number = #{deviceNumber},</if>
  558. <if test="deviceName != null">device_name = #{deviceName},</if>
  559. <if test="scanningTime != null">scanning_time = #{scanningTime},</if>
  560. <if test="contentInformation != null">content_information = #{contentInformation},</if>
  561. <if test="stationId != null">station_id=#{stationId},</if>
  562. <if test="stationName != null">station_name=#{stationName},</if>
  563. </trim>
  564. where id = #{id}
  565. </update>
  566. <delete id="deleteRingScanInformationById" parameterType="Long">
  567. delete from fjqydb.ring_scan_information where id = #{id}
  568. </delete>
  569. <delete id="deleteRingScanInformationByIds" parameterType="String">
  570. delete from fjqydb.ring_scan_information where id in
  571. <foreach item="id" collection="array" open="(" separator="," close=")">
  572. #{id}
  573. </foreach>
  574. </delete>
  575. </mapper>