TmstruckEnfactoryResultMapper.xml 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  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.steerinfo.dil.mapper.TmstruckEnfactoryResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  7. <result column="GATEPOST_ID" jdbcType="DECIMAL" property="gatepostId" />
  8. <result column="RESULT_ENTRY_MODE" jdbcType="VARCHAR" property="resultEntryMode" />
  9. <result column="RESULT_ENTRY_GATE_TIME" jdbcType="TIMESTAMP" property="resultEntryGateTime" />
  10. <result column="RESULT_MEMO" jdbcType="VARCHAR" property="resultMemo" />
  11. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  12. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  13. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  14. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  15. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  16. <result column="DELETE_USERNAME" jdbcType="VARCHAR" property="deleteUsername" />
  17. <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
  18. <result column="SEGMEN_SQE" jdbcType="DECIMAL" property="segmenSqe" />
  19. </resultMap>
  20. <sql id="columns">
  21. RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  22. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  23. DELETE_USERNAME, DELETE_TIME, SEGMEN_SQE
  24. </sql>
  25. <sql id="columns_alias">
  26. t.RESULT_ID, t.RESULT_TOTAL_ID, t.GATEPOST_ID, t.RESULT_ENTRY_MODE, t.RESULT_ENTRY_GATE_TIME,
  27. t.RESULT_MEMO, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  28. t.INSERT_UPDATE_REMARK, t.DELETE_USERNAME, t.DELETE_TIME, t.SEGMEN_SQE
  29. </sql>
  30. <sql id="select">
  31. SELECT <include refid="columns"/> FROM TMSTRUCK_ENFACTORY_RESULT
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_ENFACTORY_RESULT t
  35. </sql>
  36. <sql id="where">
  37. <where>
  38. <if test="resultId != null">
  39. and RESULT_ID = #{resultId}
  40. </if>
  41. <if test="resultTotalId != null">
  42. and RESULT_TOTAL_ID = #{resultTotalId}
  43. </if>
  44. <if test="gatepostId != null">
  45. and GATEPOST_ID = #{gatepostId}
  46. </if>
  47. <if test="resultEntryMode != null and resultEntryMode != ''">
  48. and RESULT_ENTRY_MODE = #{resultEntryMode}
  49. </if>
  50. <if test="resultEntryGateTime != null">
  51. and TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = #{resultEntryGateTime}
  52. </if>
  53. <if test="resultMemo != null and resultMemo != ''">
  54. and RESULT_MEMO = #{resultMemo}
  55. </if>
  56. <if test="insertUsername != null and insertUsername != ''">
  57. and INSERT_USERNAME = #{insertUsername}
  58. </if>
  59. <if test="insertTime != null">
  60. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  61. </if>
  62. <if test="updateUsername != null and updateUsername != ''">
  63. and UPDATE_USERNAME = #{updateUsername}
  64. </if>
  65. <if test="updateTime != null">
  66. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  67. </if>
  68. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  69. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  70. </if>
  71. <if test="deleteUsername != null and deleteUsername != ''">
  72. and DELETE_USERNAME = #{deleteUsername}
  73. </if>
  74. <if test="deleteTime != null">
  75. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  76. </if>
  77. <if test="segmenSqe != null">
  78. and SEGMEN_SQE = #{segmenSqe}
  79. </if>
  80. </where>
  81. </sql>
  82. <sql id="whereLike">
  83. <where>
  84. <if test="resultId != null">
  85. and RESULT_ID = #{resultId}
  86. </if>
  87. <if test="resultTotalId != null">
  88. and RESULT_TOTAL_ID = #{resultTotalId}
  89. </if>
  90. <if test="gatepostId != null">
  91. and GATEPOST_ID = #{gatepostId}
  92. </if>
  93. <if test="resultEntryMode != null and resultEntryMode != ''">
  94. and RESULT_ENTRY_MODE LIKE '%${resultEntryMode}%'
  95. </if>
  96. <if test="resultEntryGateTime != null">
  97. and TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = #{resultEntryGateTime}
  98. </if>
  99. <if test="resultMemo != null and resultMemo != ''">
  100. and RESULT_MEMO LIKE '%${resultMemo}%'
  101. </if>
  102. <if test="insertUsername != null and insertUsername != ''">
  103. and INSERT_USERNAME LIKE '%${insertUsername}%'
  104. </if>
  105. <if test="insertTime != null">
  106. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  107. </if>
  108. <if test="updateUsername != null and updateUsername != ''">
  109. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  110. </if>
  111. <if test="updateTime != null">
  112. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  113. </if>
  114. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  115. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  116. </if>
  117. <if test="deleteUsername != null and deleteUsername != ''">
  118. and DELETE_USERNAME LIKE '%${deleteUsername}%'
  119. </if>
  120. <if test="deleteTime != null">
  121. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  122. </if>
  123. <if test="segmenSqe != null">
  124. and SEGMEN_SQE = #{segmenSqe}
  125. </if>
  126. </where>
  127. </sql>
  128. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  129. delete from TMSTRUCK_ENFACTORY_RESULT
  130. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  131. </delete>
  132. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  133. delete from TMSTRUCK_ENFACTORY_RESULT
  134. where 1!=1
  135. <if test="resultTotalId != null">
  136. or RESULT_TOTAL_ID = #{resultTotalId}
  137. </if>
  138. <if test="gatepostId != null">
  139. or GATEPOST_ID = #{gatepostId}
  140. </if>
  141. <if test="resultEntryMode != null and resultEntryMode != ''">
  142. or RESULT_ENTRY_MODE = #{resultEntryMode}
  143. </if>
  144. <if test="resultEntryGateTime != null">
  145. or TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = '#{resultEntryGateTime}'
  146. </if>
  147. <if test="resultMemo != null and resultMemo != ''">
  148. or RESULT_MEMO = #{resultMemo}
  149. </if>
  150. <if test="insertUsername != null and insertUsername != ''">
  151. or INSERT_USERNAME = #{insertUsername}
  152. </if>
  153. <if test="insertTime != null">
  154. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  155. </if>
  156. <if test="updateUsername != null and updateUsername != ''">
  157. or UPDATE_USERNAME = #{updateUsername}
  158. </if>
  159. <if test="updateTime != null">
  160. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  161. </if>
  162. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  163. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  164. </if>
  165. <if test="deleteUsername != null and deleteUsername != ''">
  166. or DELETE_USERNAME = #{deleteUsername}
  167. </if>
  168. <if test="deleteTime != null">
  169. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  170. </if>
  171. <if test="segmenSqe != null">
  172. or SEGMEN_SQE = #{segmenSqe}
  173. </if>
  174. </delete>
  175. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  176. insert into TMSTRUCK_ENFACTORY_RESULT (RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID,
  177. RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  178. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME,
  179. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  180. DELETE_USERNAME, DELETE_TIME, SEGMEN_SQE
  181. )
  182. values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{gatepostId,jdbcType=DECIMAL},
  183. #{resultEntryMode,jdbcType=VARCHAR}, #{resultEntryGateTime,jdbcType=TIMESTAMP},
  184. #{resultMemo,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  185. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
  186. #{deleteUsername,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{segmenSqe,jdbcType=DECIMAL}
  187. )
  188. </insert>
  189. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  190. insert into TMSTRUCK_ENFACTORY_RESULT
  191. <trim prefix="(" suffix=")" suffixOverrides=",">
  192. <if test="resultId != null">
  193. RESULT_ID,
  194. </if>
  195. <if test="resultTotalId != null">
  196. RESULT_TOTAL_ID,
  197. </if>
  198. <if test="gatepostId != null">
  199. GATEPOST_ID,
  200. </if>
  201. <if test="resultEntryMode != null">
  202. RESULT_ENTRY_MODE,
  203. </if>
  204. <if test="resultEntryGateTime != null">
  205. RESULT_ENTRY_GATE_TIME,
  206. </if>
  207. <if test="resultMemo != null">
  208. RESULT_MEMO,
  209. </if>
  210. <if test="insertUsername != null">
  211. INSERT_USERNAME,
  212. </if>
  213. <if test="insertTime != null">
  214. INSERT_TIME,
  215. </if>
  216. <if test="updateUsername != null">
  217. UPDATE_USERNAME,
  218. </if>
  219. <if test="updateTime != null">
  220. UPDATE_TIME,
  221. </if>
  222. <if test="insertUpdateRemark != null">
  223. INSERT_UPDATE_REMARK,
  224. </if>
  225. <if test="deleteUsername != null">
  226. DELETE_USERNAME,
  227. </if>
  228. <if test="deleteTime != null">
  229. DELETE_TIME,
  230. </if>
  231. <if test="segmenSqe != null">
  232. SEGMEN_SQE,
  233. </if>
  234. </trim>
  235. <trim prefix="values (" suffix=")" suffixOverrides=",">
  236. <if test="resultId != null">
  237. #{resultId,jdbcType=DECIMAL},
  238. </if>
  239. <if test="resultTotalId != null">
  240. #{resultTotalId,jdbcType=DECIMAL},
  241. </if>
  242. <if test="gatepostId != null">
  243. #{gatepostId,jdbcType=DECIMAL},
  244. </if>
  245. <if test="resultEntryMode != null">
  246. #{resultEntryMode,jdbcType=VARCHAR},
  247. </if>
  248. <if test="resultEntryGateTime != null">
  249. #{resultEntryGateTime,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="resultMemo != null">
  252. #{resultMemo,jdbcType=VARCHAR},
  253. </if>
  254. <if test="insertUsername != null">
  255. #{insertUsername,jdbcType=VARCHAR},
  256. </if>
  257. <if test="insertTime != null">
  258. #{insertTime,jdbcType=TIMESTAMP},
  259. </if>
  260. <if test="updateUsername != null">
  261. #{updateUsername,jdbcType=VARCHAR},
  262. </if>
  263. <if test="updateTime != null">
  264. #{updateTime,jdbcType=TIMESTAMP},
  265. </if>
  266. <if test="insertUpdateRemark != null">
  267. #{insertUpdateRemark,jdbcType=VARCHAR},
  268. </if>
  269. <if test="deleteUsername != null">
  270. #{deleteUsername,jdbcType=VARCHAR},
  271. </if>
  272. <if test="deleteTime != null">
  273. #{deleteTime,jdbcType=TIMESTAMP},
  274. </if>
  275. <if test="segmenSqe != null">
  276. #{segmenSqe,jdbcType=DECIMAL},
  277. </if>
  278. </trim>
  279. </insert>
  280. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  281. update TMSTRUCK_ENFACTORY_RESULT
  282. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  283. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  284. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  285. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  286. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  287. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  288. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  289. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  290. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  291. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  292. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  293. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  294. SEGMEN_SQE = #{segmenSqe,jdbcType=DECIMAL}
  295. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  296. </update>
  297. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  298. update TMSTRUCK_ENFACTORY_RESULT
  299. <set>
  300. <if test="resultTotalId != null">
  301. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  302. </if>
  303. <if test="gatepostId != null">
  304. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  305. </if>
  306. <if test="resultEntryMode != null">
  307. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  308. </if>
  309. <if test="resultEntryGateTime != null">
  310. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  311. </if>
  312. <if test="resultMemo != null">
  313. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  314. </if>
  315. <if test="insertUsername != null">
  316. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  317. </if>
  318. <if test="insertTime != null">
  319. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  320. </if>
  321. <if test="updateUsername != null">
  322. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  323. </if>
  324. <if test="updateTime != null">
  325. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  326. </if>
  327. <if test="insertUpdateRemark != null">
  328. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  329. </if>
  330. <if test="deleteUsername != null">
  331. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  332. </if>
  333. <if test="deleteTime != null">
  334. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  335. </if>
  336. <if test="segmenSqe != null">
  337. SEGMEN_SQE = #{segmenSqe,jdbcType=DECIMAL},
  338. </if>
  339. </set>
  340. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  341. </update>
  342. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  343. <include refid="select"/>
  344. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  345. </select>
  346. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  347. <include refid="select"/>
  348. <include refid="where"/>
  349. </select>
  350. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  351. <include refid="select"/>
  352. <include refid="whereLike"/>
  353. </select>
  354. <insert id="batchInsert" parameterType="java.util.List">
  355. insert into TMSTRUCK_ENFACTORY_RESULT
  356. (RESULT_ID,
  357. RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE,
  358. RESULT_ENTRY_GATE_TIME, RESULT_MEMO,
  359. INSERT_USERNAME, INSERT_TIME,
  360. UPDATE_USERNAME, UPDATE_TIME,
  361. INSERT_UPDATE_REMARK, DELETE_USERNAME,
  362. DELETE_TIME, SEGMEN_SQE)
  363. ( <foreach collection="list" item="item" separator="union all">
  364. select
  365. #{item.resultId,jdbcType=DECIMAL},
  366. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.gatepostId,jdbcType=DECIMAL}, #{item.resultEntryMode,jdbcType=VARCHAR},
  367. #{item.resultEntryGateTime,jdbcType=TIMESTAMP}, #{item.resultMemo,jdbcType=VARCHAR},
  368. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  369. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  370. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteUsername,jdbcType=VARCHAR},
  371. #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.segmenSqe,jdbcType=DECIMAL} from dual
  372. </foreach> )
  373. </insert>
  374. <update id="batchUpdate" parameterType="java.util.List">
  375. update TMSTRUCK_ENFACTORY_RESULT
  376. set
  377. RESULT_ID=
  378. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  379. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  380. </foreach>
  381. ,RESULT_TOTAL_ID=
  382. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  383. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  384. </foreach>
  385. ,GATEPOST_ID=
  386. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  387. when #{item.resultId,jdbcType=DECIMAL} then #{item.gatepostId,jdbcType=DECIMAL}
  388. </foreach>
  389. ,RESULT_ENTRY_MODE=
  390. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  391. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEntryMode,jdbcType=VARCHAR}
  392. </foreach>
  393. ,RESULT_ENTRY_GATE_TIME=
  394. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  395. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEntryGateTime,jdbcType=TIMESTAMP}
  396. </foreach>
  397. ,RESULT_MEMO=
  398. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  399. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMemo,jdbcType=VARCHAR}
  400. </foreach>
  401. ,INSERT_USERNAME=
  402. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  403. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  404. </foreach>
  405. ,INSERT_TIME=
  406. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  407. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  408. </foreach>
  409. ,UPDATE_USERNAME=
  410. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  411. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  412. </foreach>
  413. ,UPDATE_TIME=
  414. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  415. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  416. </foreach>
  417. ,INSERT_UPDATE_REMARK=
  418. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  419. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  420. </foreach>
  421. ,DELETE_USERNAME=
  422. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  423. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteUsername,jdbcType=VARCHAR}
  424. </foreach>
  425. ,DELETE_TIME=
  426. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  427. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  428. </foreach>
  429. ,SEGMEN_SQE=
  430. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  431. when #{item.resultId,jdbcType=DECIMAL} then #{item.segmenSqe,jdbcType=DECIMAL}
  432. </foreach>
  433. where RESULT_ID in
  434. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  435. #{item.resultId,jdbcType=DECIMAL}
  436. </foreach>
  437. </update>
  438. <delete id="batchDelete" parameterType="java.util.List">
  439. delete from TMSTRUCK_ENFACTORY_RESULT
  440. where RESULT_ID in
  441. <foreach collection="list" item="id" open="(" close=")" separator=",">
  442. #{id}
  443. </foreach>
  444. </delete>
  445. <!-- 友情提示!!!-->
  446. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  447. <!-- 按照进厂时间进行排序 -->
  448. <sql id="orderByEnterTime">
  449. <if test="orderField != null and orderField != ''">
  450. order by "${orderField}"
  451. <if test="orderType != null and orderType != ''">
  452. ${orderType}
  453. </if>
  454. </if>
  455. <if test="orderField == null ">
  456. order by "resultEntryGateTime" desc
  457. </if>
  458. </sql>
  459. <!-- 查询所有的采购进厂作业实绩 -->
  460. <select id="getCGJKEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  461. select *
  462. from (
  463. select
  464. TER.RESULT_ID "resultId",
  465. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  466. RM.MATERIAL_NAME "materialName",
  467. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  468. OO.ORDER_NUMBER "orderNumber",
  469. RC.CAPACITY_NUMBER "capacityNumber",
  470. RG.GATEPOST_NAME "gatepostName",
  471. TER.RESULT_ENTRY_MODE "resultEntryMode",
  472. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  473. RS.SUPPLIER_NAME "supplierName",
  474. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  475. TER.INSERT_TIME "insertTime",
  476. RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  477. from TMSTRUCK_ENFACTORY_RESULT TER
  478. left join TMSTRUCK_TOTAL_RESULT TTR
  479. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  480. left join OMSTRUCK_ORDER OO
  481. on TTR.ORDER_ID = OO.ORDER_ID
  482. left join AMS_PURCHASE_ORDER APO
  483. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  484. left join DIL_BATCH DB
  485. on DB.BATCH_ID = APO.BATCH_ID
  486. left join RMS_CAPACITY RC
  487. on RC.CAPACITY_ID = OO.CAPACITY_ID
  488. left join RMS_SUPPLIER RS
  489. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  490. left join RMS_CONSIGNEE RCON
  491. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  492. left join OMSTRUCK_ORDER_MATERIAL OOM
  493. on OOM.ORDER_ID = OO.ORDER_ID
  494. left join RMS_MATERIAL RM
  495. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  496. left join RMS_GATEPOST RG
  497. on RG.GATEPOST_ID = TER.GATEPOST_ID
  498. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  499. <if test="oneDate != null">
  500. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  501. </if>
  502. <if test="startDate != null">
  503. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  504. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  505. </if>
  506. )
  507. <where>
  508. <if test="purchaseOrderId != null">
  509. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  510. "purchaseOrderId" like '%${item}%'
  511. </foreach>
  512. </if>
  513. <if test="materialName != null">
  514. and
  515. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  516. "materialName" like '%${item}%'
  517. </foreach>
  518. </if>
  519. <if test="resultForeignShipName != null">
  520. and
  521. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  522. "resultForeignShipName" like '%${item}%'
  523. </foreach>
  524. </if>
  525. <if test="orderNumber != null">
  526. and
  527. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  528. "orderNumber" like '%${item}%'
  529. </foreach>
  530. </if>
  531. <if test="capacityNumber != null">
  532. and
  533. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  534. "capacityNumber" like '%${item}%'
  535. </foreach>
  536. </if>
  537. <if test="warehouseName != null">
  538. and
  539. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  540. "warehouseName" like '%${item}%'
  541. </foreach>
  542. </if>
  543. <if test="resultEntryMode != null">
  544. and
  545. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  546. "resultEntryMode" like '%${item}%'
  547. </foreach>
  548. </if>
  549. <if test="supplierName != null">
  550. and
  551. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  552. "supplierName" like '%${item}%'
  553. </foreach>
  554. </if>
  555. <if test="orderMaterialWeight != null">
  556. and
  557. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  558. "orderMaterialWeight" like '%${item}%'
  559. </foreach>
  560. </if>
  561. </where>
  562. <include refid="orderByEnterTime"></include>
  563. </select>
  564. <!-- 查询内转进厂作业实绩 -->
  565. <select id="getAllInwardTurnEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  566. select *
  567. from (
  568. select
  569. RM.MATERIAL_NAME "materialName",
  570. OO.ORDER_NUMBER "orderNumber",
  571. RC.CAPACITY_NUMBER "capacityNumber",
  572. RG.GATEPOST_NAME "gatepostName",
  573. TER.RESULT_ENTRY_MODE "resultEntryMode",
  574. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  575. (
  576. CASE
  577. WHEN OOM.ORDER_MATERIAL_WEIGHT is null
  578. THEN OOM.ORDER_MATERIAL_NUMBER
  579. ELSE OOM.ORDER_MATERIAL_WEIGHT
  580. END
  581. ) "orderMaterialNo"
  582. from TMSTRUCK_ENFACTORY_RESULT TER
  583. left join TMSTRUCK_TOTAL_RESULT TTR
  584. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  585. left join OMSTRUCK_ORDER OO
  586. on TTR.ORDER_ID = OO.ORDER_ID
  587. left join RMS_CAPACITY RC
  588. on RC.CAPACITY_ID = OO.CAPACITY_ID
  589. left join OMSTRUCK_ORDER_MATERIAL OOM
  590. on OOM.ORDER_ID = OO.ORDER_ID
  591. left join RMS_MATERIAL RM
  592. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  593. left join RMS_GATEPOST RG
  594. on RG.GATEPOST_ID = TER.GATEPOST_ID
  595. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = 4
  596. <if test="oneDate != null">
  597. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  598. </if>
  599. <if test="startDate != null">
  600. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  601. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  602. </if>
  603. )
  604. <where>
  605. <if test="materialName != null">
  606. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  607. "materialName" like '%${item}%'
  608. </foreach>
  609. </if>
  610. <if test="orderNumber != null">
  611. and
  612. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  613. "orderNumber" like '%${item}%'
  614. </foreach>
  615. </if>
  616. <if test="capacityNumber != null">
  617. and
  618. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  619. "capacityNumber" like '%${item}%'
  620. </foreach>
  621. </if>
  622. <if test="resultEntryMode != null">
  623. and
  624. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  625. "resultEntryMode" like '%${item}%'
  626. </foreach>
  627. </if>
  628. <if test="orderMaterialNo != null">
  629. and
  630. <foreach collection="orderMaterialNo" item="item" open="(" separator="or" close=")">
  631. "orderMaterialNo" like '%${item}%'
  632. </foreach>
  633. </if>
  634. </where>
  635. <include refid="orderByEnterTime"></include>
  636. </select>
  637. <!-- 通过车牌号并且状态不为2 或 运输订单 或运输订单ID 查询关联的实绩总表ID -->
  638. <select id="selectTotalResultIdByCpAndOn" parameterType="java.util.Map" resultType="java.util.Map">
  639. select TTR.RESULT_TOTAL_ID "resultTotalId",
  640. RC.CAPACITY_NUMBER "capacityNumber",
  641. OO.ORDER_TYPE "orderType",
  642. OO.ORDER_ID "orderId",
  643. OO.LINE_ID "lineId"
  644. from OMSTRUCK_ORDER OO
  645. left join TMSTRUCK_TOTAL_RESULT TTR
  646. on TTR.ORDER_ID = OO.ORDER_ID
  647. left join RMS_CAPACITY RC
  648. on RC.CAPACITY_ID = OO.CAPACITY_ID
  649. <where>
  650. <if test="orderId != null">
  651. OO.ORDER_ID = #{orderId}
  652. </if>
  653. <if test="orderNumber != null and orderId == null">
  654. and OO.ORDER_NUMBER = #{orderNumber}
  655. </if>
  656. </where>
  657. </select>
  658. <!-- 通过门岗名称查询门岗Id-->
  659. <select id="selectGatepostIdByGatepostName" parameterType="java.lang.String" resultType="int">
  660. select GATEPOST_ID "gatepostId"
  661. from RMS_GATEPOST
  662. where GATEPOST_NAME = #{gatepostName}
  663. </select>
  664. <!-- 通过运输订单号查找实绩Id -->
  665. <select id="selectEnFactoryResultId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
  666. select *
  667. from (select TER.RESULT_ID "resultId",
  668. TER.SEGMEN_SQE "segmentSqe", --进厂的路段顺序号
  669. TER.RESULT_ENTRY_GATE_TIME,
  670. TER.INSERT_UPDATE_REMARK "insertUpdateRemark"
  671. from TMSTRUCK_ENFACTORY_RESULT TER
  672. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  673. and TER.RESULT_ENTRY_GATE_TIME is null
  674. order by TER.SEGMEN_SQE)
  675. where rownum = 1
  676. </select>
  677. <!-- 查找排队序号 -->
  678. <select id="selectNodeNumber" resultType="int" parameterType="string">
  679. select (
  680. <![CDATA[
  681. select count(*)
  682. from QMS_QUEUE_LIST QQL2
  683. join QMS_QUEUE_GRID QQG2
  684. on QQG2.GRID_ID = QQL2.GRID_ID
  685. where QQL2.LIST_NODE_ORDER <= QQL.LIST_NODE_ORDER
  686. and QQL2.GRID_ID = QQL.GRID_ID
  687. and QQL2.DELETED = 0
  688. ]]>
  689. ) "listNodeOrder"
  690. from OMSTRUCK_ORDER OO
  691. left join QMS_QUEUE_LIST QQL
  692. on OO.CAPACITY_ID = QQL.CAPACITY_ID
  693. where OO.ORDER_NUMBER = #{orderNumber}
  694. and QQL.DELETED = 1
  695. </select>
  696. <!--查询销售进厂实绩 -->
  697. <select id="getXSEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  698. select *
  699. from (
  700. select
  701. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  702. TER.RESULT_ENTRY_MODE "resultEntryMode",
  703. RG.GATEPOST_NAME "gatepostName",
  704. OO.ORDER_NUMBER "orderNumber",
  705. RC.CAPACITY_NUMBER "capacityNumber",
  706. OO.ORDER_ID "orderId",
  707. ASO.SALE_NUMBER "saleNum",
  708. RS.SUPPLIER_NAME "shipperName",
  709. RCON.CONSIGNEE_COMPANY_NAME "supplierName"
  710. FROM TMSTRUCK_ENFACTORY_RESULT TER
  711. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  712. ON TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  713. LEFT JOIN OMSTRUCK_ORDER OO
  714. ON OO.ORDER_ID = TTR.ORDER_ID
  715. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  716. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  717. LEFT JOIN AMS_SALE_ORDER ASO
  718. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  719. LEFT JOIN RMS_GATEPOST RG
  720. ON RG.GATEPOST_ID = TER.GATEPOST_ID
  721. LEFT JOIN RMS_CAPACITY RC
  722. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  723. LEFT JOIN RMS_SUPPLIER RS
  724. ON RS.SUPPLIER_ID = ASO.SHIPPER_ID
  725. LEFT JOIN RMS_CONSIGNEE RCON
  726. ON RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  727. WHERE TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  728. <if test="oneDate != null">
  729. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  730. </if>
  731. <if test="startDate != null">
  732. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  733. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  734. </if>
  735. AND OO.ORDER_TYPE IN (1, 2, 3)
  736. )
  737. <where>
  738. <if test="saleNum != null">
  739. <foreach collection="saleNum" item="item" open="(" separator="or" close=")">
  740. "saleNum" like '%${item}%'
  741. </foreach>
  742. </if>
  743. <if test="gatepostName != null">
  744. and
  745. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  746. "gatepostName" like '%${item}%'
  747. </foreach>
  748. </if>
  749. <if test="orderNumber != null">
  750. and
  751. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  752. "orderNumber" like '%${item}%'
  753. </foreach>
  754. </if>
  755. <if test="capacityNumber != null">
  756. and
  757. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  758. "capacityNumber" like '%${item}%'
  759. </foreach>
  760. </if>
  761. <if test="shipperName != null">
  762. and
  763. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  764. "shipperName" like '%${item}%'
  765. </foreach>
  766. </if>
  767. <if test="resultEntryMode != null">
  768. and
  769. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  770. "resultEntryMode" like '%${item}%'
  771. </foreach>
  772. </if>
  773. <if test="resultEntryGateTime != null">
  774. and
  775. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  776. "resultEntryGateTime" like '%${item}%'
  777. </foreach>
  778. </if>
  779. <if test="supplierName != null">
  780. and
  781. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  782. "supplierName" like '%${item}%'
  783. </foreach>
  784. </if>
  785. </where>
  786. <include refid="orderByEnterTime"></include>
  787. </select>
  788. <select id="ads">
  789. </select>
  790. <select id="getMaterial" parameterType="int" resultType="java.util.Map">
  791. SELECT RM.MATERIAL_NAME "materialName",
  792. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "specificationModel",
  793. OM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  794. OM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight"
  795. FROM OMSTRUCK_ORDER OO
  796. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OM
  797. ON OO.ORDER_ID = OM.ORDER_ID
  798. LEFT JOIN RMS_MATERIAL RM
  799. ON OM.MATERIAL_ID = RM.MATERIAL_ID
  800. WHERE OO.ORDER_ID = #{orderId}
  801. </select>
  802. <!-- APP查询进厂实绩 -->
  803. <select id="getEnfactoryResultList" resultType="java.util.Map">
  804. SELECT OO.ORDER_NUMBER AS "orderNumber",
  805. TER.RESULT_ENTRY_GATE_TIME AS "resultEntryGateTime",
  806. RC.CAPACITY_NUMBER AS "capacityNumber"
  807. FROM OMSTRUCK_ORDER OO
  808. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  809. ON TTR.ORDER_ID = OO.ORDER_ID
  810. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  811. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  812. LEFT JOIN RMS_CAPACITY RC
  813. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  814. -- WHERE TER
  815. </select>
  816. <!-- APP通过运输订单id查询进厂实绩 -->
  817. <select id="getEnfactoryMessageByOrderId" parameterType="java.lang.String" resultType="java.util.Map">
  818. SELECT OO.ORDER_NUMBER AS "orderNumber",
  819. RCA.CAPACITY_NUMBER AS "capacityNumber"
  820. FROM OMSTRUCK_ORDER OO
  821. LEFT JOIN RMS_CAPACITY RCA
  822. ON RCA.CAPACITY_ID = OO.CAPACITY_ID
  823. WHERE OO.ORDER_NUMBER = #{orderNumber}
  824. </select>
  825. <!-- 查询内转钢材到异地库进厂实绩 -->
  826. <select id="getSteelNZEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  827. SELECT *
  828. FROM (
  829. SELECT
  830. OO.ORDER_ID "orderId",
  831. AROD.DAYPLAN_NO "dayplanNo",
  832. OO.ORDER_NUMBER "orderNumber",
  833. RG.GATEPOST_NAME "gatepostName",
  834. TER.RESULT_ENTRY_MODE "resultEntryMode",
  835. RC.CAPACITY_NUMBER "capacityNumber",
  836. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  837. RS.SHIPPER_NAME "shipperName",
  838. RW.WAREHOUSE_NAME "warehouseName"
  839. FROM OMSTRUCK_ORDER OO
  840. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  841. ON TTR.ORDER_ID = OO.ORDER_ID
  842. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  843. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  844. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  845. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  846. LEFT JOIN RMS_GATEPOST RG
  847. ON RG.GATEPOST_ID = TER.GATEPOST_ID
  848. LEFT JOIN RMS_SHIPPER RS
  849. ON RS.SHIPPER_ID = AROD.SHIPPER_ID
  850. LEFT JOIN RMS_WAREHOUSE RW
  851. ON RW.WAREHOUSE_ID = AROD.RECEIVING_UNIT_ID
  852. LEFT JOIN RMS_CAPACITY RC
  853. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  854. WHERE OO.ORDER_TYPE = 4
  855. AND TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  856. <if test="oneDate != null">
  857. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  858. </if>
  859. <if test="startDate != null">
  860. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  861. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  862. </if>
  863. )
  864. <where>
  865. <if test="dayplanNo != null">
  866. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  867. "dayplanNo" like '%${item}%'
  868. </foreach>
  869. </if>
  870. <if test="orderNumber != null">
  871. and
  872. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  873. "orderNumber" like '%${item}%'
  874. </foreach>
  875. </if>
  876. <if test="gatepostName != null">
  877. and
  878. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  879. "gatepostName" like '%${item}%'
  880. </foreach>
  881. </if>
  882. <if test="resultEntryMode != null">
  883. and
  884. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  885. "resultEntryMode" like '%${item}%'
  886. </foreach>
  887. </if>
  888. <if test="capacityNumber != null">
  889. and
  890. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  891. "capacityNumber" like '%${item}%'
  892. </foreach>
  893. </if>
  894. <if test="resultEntryGateTime != null">
  895. and
  896. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  897. "resultEntryGateTime" like '%${item}%'
  898. </foreach>
  899. </if>
  900. <if test="shipperName != null">
  901. and
  902. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  903. "shipperName" like '%${item}%'
  904. </foreach>
  905. </if>
  906. <if test="warehouseName != null">
  907. and
  908. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  909. "warehouseName" like '%${item}%'
  910. </foreach>
  911. </if>
  912. </where>
  913. <include refid="orderByEnterTime"></include>
  914. </select>
  915. <!-- 查询内转国产矿进口矿 进厂实绩 -->
  916. <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  917. select *
  918. from (
  919. select TER.RESULT_ID "resultId",
  920. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  921. RM.MATERIAL_NAME "materialName",
  922. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  923. OO.ORDER_NUMBER "orderNumber",
  924. RC.CAPACITY_NUMBER "capacityNumber",
  925. RG.GATEPOST_NAME "gatepostName",
  926. TER.RESULT_ENTRY_MODE "resultEntryMode",
  927. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  928. RS.SUPPLIER_NAME "supplierName",
  929. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  930. TER.INSERT_TIME "insertTime",
  931. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  932. from TMSTRUCK_ENFACTORY_RESULT TER
  933. left join TMSTRUCK_TOTAL_RESULT TTR
  934. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  935. left join OMSTRUCK_ORDER OO
  936. on TTR.ORDER_ID = OO.ORDER_ID
  937. left join AMS_PURCHASE_ORDER APO
  938. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  939. left join DIL_BATCH DB
  940. on DB.BATCH_ID = APO.BATCH_ID
  941. left join RMS_CAPACITY RC
  942. on RC.CAPACITY_ID = OO.CAPACITY_ID
  943. left join RMS_SUPPLIER RS
  944. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  945. left join RMS_CONSIGNEE RCON
  946. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  947. left join OMSTRUCK_ORDER_MATERIAL OOM
  948. on OOM.ORDER_ID = OO.ORDER_ID
  949. left join RMS_MATERIAL RM
  950. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  951. left join RMS_GATEPOST RG
  952. on RG.GATEPOST_ID = TER.GATEPOST_ID
  953. where TER.RESULT_ENTRY_GATE_TIME is not null
  954. and OO.ORDER_TYPE = 9
  955. <if test="oneDate != null">
  956. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  957. </if>
  958. <if test="startDate != null">
  959. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  960. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  961. </if>
  962. )
  963. <where>
  964. <if test="purchaseOrderId != null">
  965. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  966. "purchaseOrderId" like '%${item}%'
  967. </foreach>
  968. </if>
  969. <if test="materialName != null">
  970. and
  971. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  972. "materialName" like '%${item}%'
  973. </foreach>
  974. </if>
  975. <if test="resultForeignShipName != null">
  976. and
  977. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  978. "resultForeignShipName" like '%${item}%'
  979. </foreach>
  980. </if>
  981. <if test="orderNumber != null">
  982. and
  983. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  984. "orderNumber" like '%${item}%'
  985. </foreach>
  986. </if>
  987. <if test="capacityNumber != null">
  988. and
  989. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  990. "capacityNumber" like '%${item}%'
  991. </foreach>
  992. </if>
  993. <if test="warehouseName != null">
  994. and
  995. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  996. "warehouseName" like '%${item}%'
  997. </foreach>
  998. </if>
  999. <if test="resultEntryMode != null">
  1000. and
  1001. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1002. "resultEntryMode" like '%${item}%'
  1003. </foreach>
  1004. </if>
  1005. <if test="supplierName != null">
  1006. and
  1007. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1008. "supplierName" like '%${item}%'
  1009. </foreach>
  1010. </if>
  1011. <if test="orderMaterialWeight != null">
  1012. and
  1013. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1014. "orderMaterialWeight" like '%${item}%'
  1015. </foreach>
  1016. </if>
  1017. </where>
  1018. <include refid="orderByEnterTime"></include>
  1019. </select>
  1020. <!-- 查询内转厂内物资进厂实绩 -->
  1021. <select id="getInFactoryMaterialEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1022. select *
  1023. from (
  1024. select TER.RESULT_ID "resultId",
  1025. RM.MATERIAL_NAME "materialName",
  1026. OO.ORDER_NUMBER "orderNumber",
  1027. RC.CAPACITY_NUMBER "capacityNumber",
  1028. RG.GATEPOST_NAME "gatepostName",
  1029. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1030. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1031. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1032. RW1.WAREHOUSE_NAME "loadingName",
  1033. RW2.WAREHOUSE_NAME "unloadingName"
  1034. from TMSTRUCK_ENFACTORY_RESULT TER
  1035. left join TMSTRUCK_TOTAL_RESULT TTR
  1036. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1037. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1038. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1039. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR
  1040. ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1041. LEFT JOIN RMS_WAREHOUSE RW1
  1042. ON RW1.WAREHOUSE_ID = TLR.LOADING_ID
  1043. LEFT JOIN RMS_WAREHOUSE RW2
  1044. ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1045. left join OMSTRUCK_ORDER OO
  1046. on TTR.ORDER_ID = OO.ORDER_ID
  1047. left join RMS_CAPACITY RC
  1048. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1049. left join OMSTRUCK_ORDER_MATERIAL OOM
  1050. on OOM.ORDER_ID = OO.ORDER_ID
  1051. left join RMS_MATERIAL RM
  1052. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1053. left join RMS_GATEPOST RG
  1054. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1055. where TER.RESULT_ENTRY_GATE_TIME is not null
  1056. and OO.ORDER_TYPE = 11
  1057. <if test="oneDate != null">
  1058. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1059. </if>
  1060. <if test="startDate != null">
  1061. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1062. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1063. </if>
  1064. )
  1065. <where>
  1066. <if test="materialName != null">
  1067. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1068. "materialName" like '%${item}%'
  1069. </foreach>
  1070. </if>
  1071. <if test="loadingName != null">
  1072. and
  1073. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1074. "loadingName" like '%${item}%'
  1075. </foreach>
  1076. </if>
  1077. <if test="orderNumber != null">
  1078. and
  1079. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1080. "orderNumber" like '%${item}%'
  1081. </foreach>
  1082. </if>
  1083. <if test="capacityNumber != null">
  1084. and
  1085. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1086. "capacityNumber" like '%${item}%'
  1087. </foreach>
  1088. </if>
  1089. <if test="unloadingName != null">
  1090. and
  1091. <foreach collection="unloadingName" item="item" open="(" separator="or" close=")">
  1092. "unloadingName" like '%${item}%'
  1093. </foreach>
  1094. </if>
  1095. <if test="resultEntryMode != null">
  1096. and
  1097. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1098. "resultEntryMode" like '%${item}%'
  1099. </foreach>
  1100. </if>
  1101. <if test="orderMaterialWeight != null">
  1102. and
  1103. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1104. "orderMaterialWeight" like '%${item}%'
  1105. </foreach>
  1106. </if>
  1107. <if test="loadingName != null">
  1108. and
  1109. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1110. "loadingName" like '%${item}%'
  1111. </foreach>
  1112. </if>
  1113. <if test="resultEntryGateTime != null">
  1114. and
  1115. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1116. "resultEntryGateTime" like '%${item}%'
  1117. </foreach>
  1118. </if>
  1119. </where>
  1120. <include refid="orderByEnterTime"></include>
  1121. </select>
  1122. <select id="getBillOrder" parameterType="java.lang.String" resultType="java.util.Map">
  1123. SELECT
  1124. oo.order_number "orderNumber",
  1125. rc.capacity_number "capacityNumber",
  1126. rce.consignee_company_name "consigeeName",
  1127. rcr.carrier_name "carrierName",
  1128. TO_CHAR( SYSDATE, 'YYYY-MM-DD' ) "billDate"
  1129. FROM
  1130. omstruck_order oo
  1131. LEFT JOIN rms_capacity rc ON rc.capacity_id = oo.capacity_id
  1132. LEFT JOIN ams_sale_order_material asom ON asom.sale_order_material_id = oo.order_plan_id
  1133. LEFT JOIN ams_sale_order aso ON aso.sale_order_id = asom.sale_order_id
  1134. LEFT JOIN rms_consignee rce ON rce.consignee_id = aso.receive_id
  1135. LEFT JOIN ams_dispatch_sale_order adso ON adso.sale_order_material_id = asom.sale_order_material_id
  1136. LEFT JOIN rms_carrier rcr ON rcr.carrier_id = adso.carrier_id
  1137. WHERE
  1138. oo.order_number = #{orderNumber}
  1139. and oo.ORDER_STATUS = 5
  1140. and oo.ORDER_PRINT_STATUS is null
  1141. </select>
  1142. <select id="getBillOrderMaterial" parameterType="java.lang.String" resultType="java.util.Map" >
  1143. SELECT
  1144. rm.material_name "materialName",
  1145. rm.material_specification "materialSpe",
  1146. rm.material_model "materialModel",
  1147. oom.order_material_number "materialNumber",
  1148. oom.order_material_weight "materialWeight",
  1149. RW.WAREHOUSE_NAME "wareHouseName"
  1150. FROM
  1151. omstruck_order oo
  1152. LEFT JOIN omstruck_order_material oom ON oom.order_id = oo.order_id
  1153. LEFT JOIN rms_material rm ON rm.material_id = oom.material_id
  1154. LEFT JOIN RMS_WAREHOUSE RW ON RW.WAREHOUSE_ID = OOM.MATERIAL_PRIORITY
  1155. WHERE
  1156. oo.order_number = #{ orderNumber}
  1157. </select>
  1158. <!-- 通过id获取零星物资id-->
  1159. <select id="getSporadicSuppliesEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1160. select *
  1161. from (
  1162. select distinct TER.RESULT_ID "resultId",
  1163. OO.ORDER_ID "orderId",
  1164. OO.ORDER_NUMBER "orderNumber",
  1165. RC.CAPACITY_NUMBER "capacityNumber",
  1166. RG.GATEPOST_NAME "gatepostName",
  1167. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1168. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1169. RM.MATERIAL_NAME "materialName",
  1170. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1171. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1172. TWR.RESULT_NET_WEIGHT "netWeight"
  1173. from TMSTRUCK_ENFACTORY_RESULT TER
  1174. left join TMSTRUCK_TOTAL_RESULT TTR
  1175. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1176. left join TMSTRUCK_WEIGHT_RESULT TWR
  1177. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1178. left join OMSTRUCK_ORDER OO
  1179. on TTR.ORDER_ID = OO.ORDER_ID
  1180. left join OMSTRUCK_ORDER_MATERIAL OOM
  1181. ON OOM.ORDER_ID=OO.ORDER_ID
  1182. left join RMS_MATERIAL RM
  1183. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1184. left join AMSTRUCK_SPORADIC_ORDER ASO
  1185. on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  1186. left join AMSTRUCK_SPORADIC_MATERIAL ASM
  1187. on ASM.SPORADIC_ORDER_ID=ASO.SPORADIC_ORDER_ID
  1188. left join RMS_GATEPOST RG
  1189. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1190. left join RMS_CAPACITY RC
  1191. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1192. WHERE TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  1193. <if test="orderTypee != 100">
  1194. AND OO.ORDER_TYPE = #{orderTypee}
  1195. </if>
  1196. <if test="orderTypee == 100">
  1197. AND OO.ORDER_TYPE in (12, 13 ,14,19)
  1198. </if>
  1199. <if test="oneDate != null">
  1200. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1201. </if>
  1202. <if test="startDate != null">
  1203. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1204. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1205. </if>
  1206. <if test="userId!=null">
  1207. and ASO.INSERT_USERNAME=#{userId}
  1208. </if>
  1209. <if test="userIds!=null">
  1210. and ASO.UPDATE_USERNAME=#{userIds}
  1211. </if>
  1212. <if test="con!=null">
  1213. where "orderNumber" like #{con} or "capacityNumber" like #{con}
  1214. or "gatepostName" like #{con} or "materialName" like #{con}
  1215. </if>
  1216. )
  1217. <where>
  1218. <if test="orderNumber != null">
  1219. and
  1220. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1221. "orderNumber" like '%${item}%'
  1222. </foreach>
  1223. </if>
  1224. <if test="capacityNumber != null">
  1225. and
  1226. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1227. "capacityNumber" like '%${item}%'
  1228. </foreach>
  1229. </if>
  1230. <if test="gatepostName != null">
  1231. and
  1232. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1233. "capacityNumber" like '%${item}%'
  1234. </foreach>
  1235. </if>
  1236. <if test="gatepostName != null">
  1237. and
  1238. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1239. "resultEntryMode" like '%${item}%'
  1240. </foreach>
  1241. </if>
  1242. <if test="resultEntryGateTime != null">
  1243. and
  1244. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1245. "resultEntryGateTime" like '%${item}%'
  1246. </foreach>
  1247. </if>
  1248. </where>
  1249. <include refid="orderByEnterTime"></include>
  1250. </select>
  1251. <select id="getCGNZEnFactory" resultType="java.util.Map" parameterType="map">
  1252. select
  1253. *
  1254. from(
  1255. select TER.RESULT_ID "resultId",
  1256. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1257. RM.MATERIAL_NAME "materialName",
  1258. OO.ORDER_NUMBER "orderNumber",
  1259. RC.CAPACITY_NUMBER "capacityNumber",
  1260. RG.GATEPOST_NAME "gatepostName",
  1261. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1262. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1263. RS.SUPPLIER_NAME "supplierName",
  1264. TER.INSERT_TIME "insertTime",
  1265. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  1266. from TMSTRUCK_ENFACTORY_RESULT TER
  1267. left join TMSTRUCK_TOTAL_RESULT TTR
  1268. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1269. left join OMSTRUCK_ORDER OO
  1270. on TTR.ORDER_ID = OO.ORDER_ID
  1271. left join amstruck_inward_plan aip
  1272. on aip.plan_id = oo.order_plan_id
  1273. left join amstruck_requirement_plan arp
  1274. on arp.plan_id = aip.plan_id
  1275. left join amstruck_inward_requirement air
  1276. on air.requirement_id = arp.requirement_id
  1277. left join AMS_PURCHASE_ORDER APO
  1278. on apo.purchase_order_id = air.purchase_order_id
  1279. left join DIL_BATCH DB
  1280. on DB.BATCH_ID = APO.BATCH_ID
  1281. left join RMS_CAPACITY RC
  1282. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1283. left join RMS_SUPPLIER RS
  1284. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  1285. left join RMS_CONSIGNEE RCON
  1286. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  1287. left join OMSTRUCK_ORDER_MATERIAL OOM
  1288. on OOM.ORDER_ID = OO.ORDER_ID
  1289. left join RMS_MATERIAL RM
  1290. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1291. left join RMS_GATEPOST RG
  1292. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1293. where TER.RESULT_ENTRY_GATE_TIME is not null
  1294. and OO.ORDER_TYPE in (10,20)
  1295. <if test="userId">
  1296. and air.INSERT_USERNAME=#{userId}
  1297. </if>
  1298. <if test="oneDate != null">
  1299. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1300. </if>
  1301. <if test="startDate != null">
  1302. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1303. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1304. </if>
  1305. )
  1306. <where>
  1307. <if test="purchaseOrderId != null">
  1308. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  1309. "purchaseOrderId" like '%${item}%'
  1310. </foreach>
  1311. </if>
  1312. <if test="materialName != null">
  1313. and
  1314. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1315. "materialName" like '%${item}%'
  1316. </foreach>
  1317. </if>
  1318. <if test="resultForeignShipName != null">
  1319. and
  1320. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  1321. "resultForeignShipName" like '%${item}%'
  1322. </foreach>
  1323. </if>
  1324. <if test="orderNumber != null">
  1325. and
  1326. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1327. "orderNumber" like '%${item}%'
  1328. </foreach>
  1329. </if>
  1330. <if test="capacityNumber != null">
  1331. and
  1332. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1333. "capacityNumber" like '%${item}%'
  1334. </foreach>
  1335. </if>
  1336. <if test="warehouseName != null">
  1337. and
  1338. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1339. "warehouseName" like '%${item}%'
  1340. </foreach>
  1341. </if>
  1342. <if test="resultEntryMode != null">
  1343. and
  1344. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1345. "resultEntryMode" like '%${item}%'
  1346. </foreach>
  1347. </if>
  1348. <if test="supplierName != null">
  1349. and
  1350. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1351. "supplierName" like '%${item}%'
  1352. </foreach>
  1353. </if>
  1354. <if test="orderMaterialWeight != null">
  1355. and
  1356. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1357. "orderMaterialWeight" like '%${item}%'
  1358. </foreach>
  1359. </if>
  1360. </where>
  1361. <include refid="orderByEnterTime"></include>
  1362. </select>
  1363. <select id="getCgNzOutFactory" resultType="java.util.Map">
  1364. select TLFR.RESULT_ID "resultId",
  1365. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1366. RM.MATERIAL_NAME "materialName",
  1367. OO.ORDER_NUMBER "orderNumber",
  1368. RC.CAPACITY_NUMBER "capacityNumber",
  1369. RG.GATEPOST_NAME "gatepostName",
  1370. TLFR.RESULT_OUT_MODE "resultOutMode",
  1371. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1372. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  1373. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1374. left join TMSTRUCK_TOTAL_RESULT TTR
  1375. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1376. left join OMSTRUCK_ORDER OO
  1377. on OO.ORDER_ID = TTR.ORDER_ID
  1378. left join amstruck_inward_plan aip
  1379. on aip.plan_id = oo.order_plan_id
  1380. left join amstruck_requirement_plan arp
  1381. on arp.plan_id = aip.plan_id
  1382. left join amstruck_inward_requirement air
  1383. on air.requirement_id = arp.requirement_id
  1384. left join AMS_PURCHASE_ORDER APO
  1385. on APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
  1386. left join DIL_BATCH DB
  1387. on DB.BATCH_ID = APO.BATCH_ID
  1388. left join OMSTRUCK_ORDER_MATERIAL OOM
  1389. on OOM.ORDER_ID = OO.ORDER_ID
  1390. left join RMS_MATERIAL RM
  1391. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1392. left join RMS_CAPACITY RC
  1393. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1394. left join RMS_GATEPOST RG
  1395. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  1396. where RESULT_OUT_GATE_TIME is not null
  1397. and OO.ORDER_TYPE in (10,20)
  1398. <if test="userId !=null">
  1399. and AIR.INSERT_USERNAME = #{userId}
  1400. </if>
  1401. <if test="oneDate != null">
  1402. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLFR.RESULT_OUT_GATE_TIME
  1403. </if>
  1404. <if test="startDate != null">
  1405. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLFR.RESULT_OUT_GATE_TIME
  1406. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLFR.RESULT_OUT_GATE_TIME
  1407. </if>
  1408. order by tlfr.result_out_gate_time desc
  1409. <where>
  1410. <if test="capacityNumber != null">
  1411. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1412. "capacityNumber" like '%${item}%'
  1413. </foreach>
  1414. </if>
  1415. <if test="materialName != null">
  1416. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1417. "materialName" like '%${item}%'
  1418. </foreach>
  1419. </if>
  1420. <if test="gatepostName != null">
  1421. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1422. "gatepostName" like '%${item}%'
  1423. </foreach>
  1424. </if>
  1425. </where>
  1426. </select>
  1427. <select id="selectAllEnFactoryNum" parameterType="java.math.BigDecimal" resultType="int">
  1428. select count(TER.RESULT_TOTAL_ID)
  1429. from TMSTRUCK_ENFACTORY_RESULT TER
  1430. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  1431. </select>
  1432. <select id="selectEnFactoryNumber" parameterType="java.math.BigDecimal" resultType="int">
  1433. select count(TER.RESULT_TOTAL_ID)
  1434. from TMSTRUCK_ENFACTORY_RESULT TER
  1435. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  1436. and TER.RESULT_ENTRY_GATE_TIME is null
  1437. </select>
  1438. <select id="getEnResult" resultType="java.util.Map">
  1439. SELECT TER.RESULT_ID "resultId", TER.SEGMEN_SQE,TER.INSERT_TIME,oo.ORDER_TYPE
  1440. FROM OMSTRUCK_ORDER OO
  1441. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1442. ON TTR.ORDER_ID = OO.ORDER_ID
  1443. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  1444. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1445. WHERE OO.ORDER_TYPE = 20
  1446. AND TER.SEGMEN_SQE = 5
  1447. </select>
  1448. <select id="getSteelIsSpelling" resultType="map" parameterType="java.math.BigDecimal">
  1449. select LIST_ID "listId",
  1450. IS_SPELLING "isSpelling",
  1451. RESULT_ID "resultId"
  1452. from QMS_QUEUE_RESULT where RESULT_TOTAL_ID = #{resultTotalId}
  1453. </select>
  1454. <delete id="deleteQQSL">
  1455. delete from QMS_QUEUE_SPELLING_LIST where SPELLING_RESULT_ID = #{listId}
  1456. </delete>
  1457. <delete id="deleteQQL">
  1458. delete from QMS_QUEUE_LIST where LIST_ID = #{listId}
  1459. </delete>
  1460. <update id="updateQQR">
  1461. update QMS_QUEUE_RESULT QQR set QQR.RESULT_END_TIME = SYSDATE where QQR.RESULT_ID = #{resultId}
  1462. </update>
  1463. <select id="getSaleOrderStatus" parameterType="DECIMAL" resultType="java.lang.Integer">
  1464. SELECT ASO.SALE_ORDER_STATUS AS "saleOrderStatus"
  1465. FROM OMSTRUCK_ORDER OO
  1466. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1467. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  1468. LEFT JOIN AMS_SALE_ORDER ASO
  1469. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1470. WHERE OO.ORDER_ID = #{orderId}
  1471. </select>
  1472. </mapper>