TmstruckEnfactoryResultMapper.xml 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  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. from TMSTRUCK_ENFACTORY_RESULT TER
  671. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  672. and TER.RESULT_ENTRY_GATE_TIME is null
  673. order by TER.SEGMEN_SQE)
  674. where rownum = 1
  675. </select>
  676. <!-- 查找排队序号 -->
  677. <select id="selectNodeNumber" resultType="int" parameterType="string">
  678. select (
  679. <![CDATA[
  680. select count(*)
  681. from QMS_QUEUE_LIST QQL2
  682. join QMS_QUEUE_GRID QQG2
  683. on QQG2.GRID_ID = QQL2.GRID_ID
  684. where QQL2.LIST_NODE_ORDER <= QQL.LIST_NODE_ORDER
  685. and QQL2.GRID_ID = QQL.GRID_ID
  686. and QQL2.DELETED = 0
  687. ]]>
  688. ) "listNodeOrder"
  689. from OMSTRUCK_ORDER OO
  690. left join QMS_QUEUE_LIST QQL
  691. on OO.CAPACITY_ID = QQL.CAPACITY_ID
  692. where OO.ORDER_NUMBER = #{orderNumber}
  693. and QQL.DELETED = 1
  694. </select>
  695. <!--查询销售进厂实绩 -->
  696. <select id="getXSEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  697. select *
  698. from (
  699. select
  700. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  701. TER.RESULT_ENTRY_MODE "resultEntryMode",
  702. RG.GATEPOST_NAME "gatepostName",
  703. OO.ORDER_NUMBER "orderNumber",
  704. RC.CAPACITY_NUMBER "capacityNumber",
  705. OO.ORDER_ID "orderId",
  706. ASO.SALE_NUMBER "saleNum",
  707. RS.SUPPLIER_NAME "shipperName",
  708. RCON.CONSIGNEE_COMPANY_NAME "supplierName"
  709. FROM TMSTRUCK_ENFACTORY_RESULT TER
  710. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  711. ON TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  712. LEFT JOIN OMSTRUCK_ORDER OO
  713. ON OO.ORDER_ID = TTR.ORDER_ID
  714. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  715. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  716. LEFT JOIN AMS_SALE_ORDER ASO
  717. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  718. LEFT JOIN RMS_GATEPOST RG
  719. ON RG.GATEPOST_ID = TER.GATEPOST_ID
  720. LEFT JOIN RMS_CAPACITY RC
  721. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  722. LEFT JOIN RMS_SUPPLIER RS
  723. ON RS.SUPPLIER_ID = ASO.SHIPPER_ID
  724. LEFT JOIN RMS_CONSIGNEE RCON
  725. ON RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  726. WHERE TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  727. <if test="oneDate != null">
  728. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  729. </if>
  730. <if test="startDate != null">
  731. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  732. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  733. </if>
  734. AND OO.ORDER_TYPE IN (1, 2, 3)
  735. )
  736. <where>
  737. <if test="saleNum != null">
  738. <foreach collection="saleNum" item="item" open="(" separator="or" close=")">
  739. "saleNum" like '%${item}%'
  740. </foreach>
  741. </if>
  742. <if test="gatepostName != null">
  743. and
  744. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  745. "gatepostName" like '%${item}%'
  746. </foreach>
  747. </if>
  748. <if test="orderNumber != null">
  749. and
  750. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  751. "orderNumber" like '%${item}%'
  752. </foreach>
  753. </if>
  754. <if test="capacityNumber != null">
  755. and
  756. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  757. "capacityNumber" like '%${item}%'
  758. </foreach>
  759. </if>
  760. <if test="shipperName != null">
  761. and
  762. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  763. "shipperName" like '%${item}%'
  764. </foreach>
  765. </if>
  766. <if test="resultEntryMode != null">
  767. and
  768. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  769. "resultEntryMode" like '%${item}%'
  770. </foreach>
  771. </if>
  772. <if test="resultEntryGateTime != null">
  773. and
  774. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  775. "resultEntryGateTime" like '%${item}%'
  776. </foreach>
  777. </if>
  778. <if test="supplierName != null">
  779. and
  780. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  781. "supplierName" like '%${item}%'
  782. </foreach>
  783. </if>
  784. </where>
  785. <include refid="orderByEnterTime"></include>
  786. </select>
  787. <select id="ads">
  788. </select>
  789. <select id="getMaterial" parameterType="int" resultType="java.util.Map">
  790. SELECT RM.MATERIAL_NAME "materialName",
  791. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "specificationModel",
  792. OM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  793. OM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight"
  794. FROM OMSTRUCK_ORDER OO
  795. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OM
  796. ON OO.ORDER_ID = OM.ORDER_ID
  797. LEFT JOIN RMS_MATERIAL RM
  798. ON OM.MATERIAL_ID = RM.MATERIAL_ID
  799. WHERE OO.ORDER_ID = #{orderId}
  800. </select>
  801. <!-- APP查询进厂实绩 -->
  802. <select id="getEnfactoryResultList" resultType="java.util.Map">
  803. SELECT OO.ORDER_NUMBER AS "orderNumber",
  804. TER.RESULT_ENTRY_GATE_TIME AS "resultEntryGateTime",
  805. RC.CAPACITY_NUMBER AS "capacityNumber"
  806. FROM OMSTRUCK_ORDER OO
  807. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  808. ON TTR.ORDER_ID = OO.ORDER_ID
  809. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  810. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  811. LEFT JOIN RMS_CAPACITY RC
  812. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  813. -- WHERE TER
  814. </select>
  815. <!-- APP通过运输订单id查询进厂实绩 -->
  816. <select id="getEnfactoryMessageByOrderId" parameterType="java.lang.String" resultType="java.util.Map">
  817. SELECT OO.ORDER_NUMBER AS "orderNumber",
  818. RCA.CAPACITY_NUMBER AS "capacityNumber"
  819. FROM OMSTRUCK_ORDER OO
  820. LEFT JOIN RMS_CAPACITY RCA
  821. ON RCA.CAPACITY_ID = OO.CAPACITY_ID
  822. WHERE OO.ORDER_NUMBER = #{orderNumber}
  823. </select>
  824. <!-- 查询内转钢材到异地库进厂实绩 -->
  825. <select id="getSteelNZEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  826. SELECT *
  827. FROM (
  828. SELECT
  829. OO.ORDER_ID "orderId",
  830. AROD.DAYPLAN_NO "dayplanNo",
  831. OO.ORDER_NUMBER "orderNumber",
  832. RG.GATEPOST_NAME "gatepostName",
  833. TER.RESULT_ENTRY_MODE "resultEntryMode",
  834. RC.CAPACITY_NUMBER "capacityNumber",
  835. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  836. RS.SHIPPER_NAME "shipperName",
  837. RW.WAREHOUSE_NAME "warehouseName"
  838. FROM OMSTRUCK_ORDER OO
  839. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  840. ON TTR.ORDER_ID = OO.ORDER_ID
  841. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  842. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  843. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  844. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  845. LEFT JOIN RMS_GATEPOST RG
  846. ON RG.GATEPOST_ID = TER.GATEPOST_ID
  847. LEFT JOIN RMS_SHIPPER RS
  848. ON RS.SHIPPER_ID = AROD.SHIPPER_ID
  849. LEFT JOIN RMS_WAREHOUSE RW
  850. ON RW.WAREHOUSE_ID = AROD.RECEIVING_UNIT_ID
  851. LEFT JOIN RMS_CAPACITY RC
  852. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  853. WHERE OO.ORDER_TYPE = 4
  854. AND TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  855. <if test="oneDate != null">
  856. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  857. </if>
  858. <if test="startDate != null">
  859. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  860. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  861. </if>
  862. )
  863. <where>
  864. <if test="dayplanNo != null">
  865. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  866. "dayplanNo" like '%${item}%'
  867. </foreach>
  868. </if>
  869. <if test="orderNumber != null">
  870. and
  871. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  872. "orderNumber" like '%${item}%'
  873. </foreach>
  874. </if>
  875. <if test="gatepostName != null">
  876. and
  877. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  878. "gatepostName" like '%${item}%'
  879. </foreach>
  880. </if>
  881. <if test="resultEntryMode != null">
  882. and
  883. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  884. "resultEntryMode" like '%${item}%'
  885. </foreach>
  886. </if>
  887. <if test="capacityNumber != null">
  888. and
  889. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  890. "capacityNumber" like '%${item}%'
  891. </foreach>
  892. </if>
  893. <if test="resultEntryGateTime != null">
  894. and
  895. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  896. "resultEntryGateTime" like '%${item}%'
  897. </foreach>
  898. </if>
  899. <if test="shipperName != null">
  900. and
  901. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  902. "shipperName" like '%${item}%'
  903. </foreach>
  904. </if>
  905. <if test="warehouseName != null">
  906. and
  907. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  908. "warehouseName" like '%${item}%'
  909. </foreach>
  910. </if>
  911. </where>
  912. <include refid="orderByEnterTime"></include>
  913. </select>
  914. <!-- 查询内转国产矿进口矿 进厂实绩 -->
  915. <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  916. select *
  917. from (
  918. select TER.RESULT_ID "resultId",
  919. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  920. RM.MATERIAL_NAME "materialName",
  921. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  922. OO.ORDER_NUMBER "orderNumber",
  923. RC.CAPACITY_NUMBER "capacityNumber",
  924. RG.GATEPOST_NAME "gatepostName",
  925. TER.RESULT_ENTRY_MODE "resultEntryMode",
  926. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  927. RS.SUPPLIER_NAME "supplierName",
  928. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  929. TER.INSERT_TIME "insertTime",
  930. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  931. from TMSTRUCK_ENFACTORY_RESULT TER
  932. left join TMSTRUCK_TOTAL_RESULT TTR
  933. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  934. left join OMSTRUCK_ORDER OO
  935. on TTR.ORDER_ID = OO.ORDER_ID
  936. left join AMS_PURCHASE_ORDER APO
  937. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  938. left join DIL_BATCH DB
  939. on DB.BATCH_ID = APO.BATCH_ID
  940. left join RMS_CAPACITY RC
  941. on RC.CAPACITY_ID = OO.CAPACITY_ID
  942. left join RMS_SUPPLIER RS
  943. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  944. left join RMS_CONSIGNEE RCON
  945. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  946. left join OMSTRUCK_ORDER_MATERIAL OOM
  947. on OOM.ORDER_ID = OO.ORDER_ID
  948. left join RMS_MATERIAL RM
  949. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  950. left join RMS_GATEPOST RG
  951. on RG.GATEPOST_ID = TER.GATEPOST_ID
  952. where TER.RESULT_ENTRY_GATE_TIME is not null
  953. and OO.ORDER_TYPE = 9
  954. <if test="oneDate != null">
  955. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  956. </if>
  957. <if test="startDate != null">
  958. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  959. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  960. </if>
  961. )
  962. <where>
  963. <if test="purchaseOrderId != null">
  964. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  965. "purchaseOrderId" like '%${item}%'
  966. </foreach>
  967. </if>
  968. <if test="materialName != null">
  969. and
  970. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  971. "materialName" like '%${item}%'
  972. </foreach>
  973. </if>
  974. <if test="resultForeignShipName != null">
  975. and
  976. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  977. "resultForeignShipName" like '%${item}%'
  978. </foreach>
  979. </if>
  980. <if test="orderNumber != null">
  981. and
  982. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  983. "orderNumber" like '%${item}%'
  984. </foreach>
  985. </if>
  986. <if test="capacityNumber != null">
  987. and
  988. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  989. "capacityNumber" like '%${item}%'
  990. </foreach>
  991. </if>
  992. <if test="warehouseName != null">
  993. and
  994. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  995. "warehouseName" like '%${item}%'
  996. </foreach>
  997. </if>
  998. <if test="resultEntryMode != null">
  999. and
  1000. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1001. "resultEntryMode" like '%${item}%'
  1002. </foreach>
  1003. </if>
  1004. <if test="supplierName != null">
  1005. and
  1006. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1007. "supplierName" like '%${item}%'
  1008. </foreach>
  1009. </if>
  1010. <if test="orderMaterialWeight != null">
  1011. and
  1012. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1013. "orderMaterialWeight" like '%${item}%'
  1014. </foreach>
  1015. </if>
  1016. </where>
  1017. <include refid="orderByEnterTime"></include>
  1018. </select>
  1019. <!-- 查询内转厂内物资进厂实绩 -->
  1020. <select id="getInFactoryMaterialEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1021. select *
  1022. from (
  1023. select TER.RESULT_ID "resultId",
  1024. RM.MATERIAL_NAME "materialName",
  1025. OO.ORDER_NUMBER "orderNumber",
  1026. RC.CAPACITY_NUMBER "capacityNumber",
  1027. RG.GATEPOST_NAME "gatepostName",
  1028. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1029. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1030. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1031. RW1.WAREHOUSE_NAME "loadingName",
  1032. RW2.WAREHOUSE_NAME "unloadingName"
  1033. from TMSTRUCK_ENFACTORY_RESULT TER
  1034. left join TMSTRUCK_TOTAL_RESULT TTR
  1035. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1036. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1037. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1038. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR
  1039. ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1040. LEFT JOIN RMS_WAREHOUSE RW1
  1041. ON RW1.WAREHOUSE_ID = TLR.LOADING_ID
  1042. LEFT JOIN RMS_WAREHOUSE RW2
  1043. ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1044. left join OMSTRUCK_ORDER OO
  1045. on TTR.ORDER_ID = OO.ORDER_ID
  1046. left join RMS_CAPACITY RC
  1047. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1048. left join OMSTRUCK_ORDER_MATERIAL OOM
  1049. on OOM.ORDER_ID = OO.ORDER_ID
  1050. left join RMS_MATERIAL RM
  1051. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1052. left join RMS_GATEPOST RG
  1053. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1054. where TER.RESULT_ENTRY_GATE_TIME is not null
  1055. and OO.ORDER_TYPE = 11
  1056. <if test="oneDate != null">
  1057. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1058. </if>
  1059. <if test="startDate != null">
  1060. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1061. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1062. </if>
  1063. )
  1064. <where>
  1065. <if test="materialName != null">
  1066. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1067. "materialName" like '%${item}%'
  1068. </foreach>
  1069. </if>
  1070. <if test="loadingName != null">
  1071. and
  1072. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1073. "loadingName" like '%${item}%'
  1074. </foreach>
  1075. </if>
  1076. <if test="orderNumber != null">
  1077. and
  1078. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1079. "orderNumber" like '%${item}%'
  1080. </foreach>
  1081. </if>
  1082. <if test="capacityNumber != null">
  1083. and
  1084. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1085. "capacityNumber" like '%${item}%'
  1086. </foreach>
  1087. </if>
  1088. <if test="unloadingName != null">
  1089. and
  1090. <foreach collection="unloadingName" item="item" open="(" separator="or" close=")">
  1091. "unloadingName" like '%${item}%'
  1092. </foreach>
  1093. </if>
  1094. <if test="resultEntryMode != null">
  1095. and
  1096. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1097. "resultEntryMode" like '%${item}%'
  1098. </foreach>
  1099. </if>
  1100. <if test="orderMaterialWeight != null">
  1101. and
  1102. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1103. "orderMaterialWeight" like '%${item}%'
  1104. </foreach>
  1105. </if>
  1106. <if test="loadingName != null">
  1107. and
  1108. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1109. "loadingName" like '%${item}%'
  1110. </foreach>
  1111. </if>
  1112. <if test="resultEntryGateTime != null">
  1113. and
  1114. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1115. "resultEntryGateTime" like '%${item}%'
  1116. </foreach>
  1117. </if>
  1118. </where>
  1119. <include refid="orderByEnterTime"></include>
  1120. </select>
  1121. <select id="getBillOrder" parameterType="java.lang.String" resultType="java.util.Map">
  1122. select
  1123. oo.order_number "orderNumber",
  1124. rc.capacity_number "capacityNumber",
  1125. rce.consignee_company_name "consigeeName",
  1126. rcr.carrier_name "carrierName",
  1127. TO_CHAR(SYSDATE,'YYYY-MM-DD') "billDate"
  1128. from omstruck_order oo
  1129. left join
  1130. rms_capacity rc
  1131. on
  1132. rc.capacity_id = oo.capacity_id
  1133. left join
  1134. ams_sale_order_material asom
  1135. on
  1136. asom.sale_order_material_id = oo.order_plan_id
  1137. left join
  1138. ams_sale_order aso
  1139. on
  1140. aso.sale_order_id = asom.sale_order_id
  1141. left join
  1142. rms_consignee rce
  1143. on
  1144. rce.consignee_id = aso.receive_id
  1145. left join
  1146. ams_dispatch_sale_order adso
  1147. on
  1148. adso.sale_order_material_id = asom.sale_order_material_id
  1149. left join
  1150. rms_carrier rcr
  1151. on
  1152. rcr.carrier_id = adso.carrier_id
  1153. where oo.order_number = #{orderNumber}
  1154. </select>
  1155. <select id="getBillOrderMaterial" parameterType="java.lang.String" resultType="java.util.Map" >
  1156. select
  1157. rm.material_name "materialName",
  1158. rm.material_specification "materialSpe",
  1159. rm.material_model "materialModel",
  1160. oom.order_material_number "materialNumber",
  1161. oom.order_material_weight "materialWeight"
  1162. from omstruck_order oo
  1163. left join
  1164. omstruck_order_material oom
  1165. on
  1166. oom.order_id = oo.order_id
  1167. left join
  1168. rms_material rm
  1169. on
  1170. rm.material_id = oom.order_material_id
  1171. where oo.order_number = #{orderNumber}
  1172. </select>
  1173. <!-- 通过id获取零星物资id-->
  1174. <select id="getSporadicSuppliesEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1175. select *
  1176. from (
  1177. select distinct TER.RESULT_ID "resultId",
  1178. OO.ORDER_ID "orderId",
  1179. OO.ORDER_NUMBER "orderNumber",
  1180. RC.CAPACITY_NUMBER "capacityNumber",
  1181. RG.GATEPOST_NAME "gatepostName",
  1182. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1183. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1184. RM.MATERIAL_NAME "materialName",
  1185. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1186. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1187. TWR.RESULT_NET_WEIGHT "netWeight"
  1188. from TMSTRUCK_ENFACTORY_RESULT TER
  1189. left join TMSTRUCK_TOTAL_RESULT TTR
  1190. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1191. left join TMSTRUCK_WEIGHT_RESULT TWR
  1192. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1193. left join OMSTRUCK_ORDER OO
  1194. on TTR.ORDER_ID = OO.ORDER_ID
  1195. left join OMSTRUCK_ORDER_MATERIAL OOM
  1196. ON OOM.ORDER_ID=OO.ORDER_ID
  1197. left join RMS_MATERIAL RM
  1198. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1199. left join AMSTRUCK_SPORADIC_ORDER ASO
  1200. on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  1201. left join AMSTRUCK_SPORADIC_MATERIAL ASM
  1202. on ASM.SPORADIC_ORDER_ID=ASO.SPORADIC_ORDER_ID
  1203. left join RMS_GATEPOST RG
  1204. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1205. left join RMS_CAPACITY RC
  1206. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1207. WHERE TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  1208. <if test="orderTypee != 100">
  1209. AND OO.ORDER_TYPE = #{orderTypee}
  1210. </if>
  1211. <if test="orderTypee == 100">
  1212. AND OO.ORDER_TYPE in (12, 13 ,14,19)
  1213. </if>
  1214. <if test="oneDate != null">
  1215. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1216. </if>
  1217. <if test="startDate != null">
  1218. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1219. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1220. </if>
  1221. <if test="userId!=null">
  1222. and ASO.INSERT_USERNAME=#{userId}
  1223. </if>
  1224. <if test="userIds!=null">
  1225. and ASO.UPDATE_USERNAME=#{userIds}
  1226. </if>
  1227. <if test="con!=null">
  1228. where "orderNumber" like #{con} or "capacityNumber" like #{con}
  1229. or "gatepostName" like #{con} or "materialName" like #{con}
  1230. </if>
  1231. )
  1232. <where>
  1233. <if test="orderNumber != null">
  1234. and
  1235. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1236. "orderNumber" like '%${item}%'
  1237. </foreach>
  1238. </if>
  1239. <if test="capacityNumber != null">
  1240. and
  1241. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1242. "capacityNumber" like '%${item}%'
  1243. </foreach>
  1244. </if>
  1245. <if test="gatepostName != null">
  1246. and
  1247. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1248. "capacityNumber" like '%${item}%'
  1249. </foreach>
  1250. </if>
  1251. <if test="gatepostName != null">
  1252. and
  1253. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1254. "resultEntryMode" like '%${item}%'
  1255. </foreach>
  1256. </if>
  1257. <if test="resultEntryGateTime != null">
  1258. and
  1259. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1260. "resultEntryGateTime" like '%${item}%'
  1261. </foreach>
  1262. </if>
  1263. </where>
  1264. <include refid="orderByEnterTime"></include>
  1265. </select>
  1266. <select id="getCGNZEnFactory" resultType="java.util.Map" parameterType="map">
  1267. select
  1268. *
  1269. from(
  1270. select TER.RESULT_ID "resultId",
  1271. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1272. RM.MATERIAL_NAME "materialName",
  1273. OO.ORDER_NUMBER "orderNumber",
  1274. RC.CAPACITY_NUMBER "capacityNumber",
  1275. RG.GATEPOST_NAME "gatepostName",
  1276. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1277. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1278. RS.SUPPLIER_NAME "supplierName",
  1279. TER.INSERT_TIME "insertTime",
  1280. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  1281. from TMSTRUCK_ENFACTORY_RESULT TER
  1282. left join TMSTRUCK_TOTAL_RESULT TTR
  1283. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1284. left join OMSTRUCK_ORDER OO
  1285. on TTR.ORDER_ID = OO.ORDER_ID
  1286. left join amstruck_inward_plan aip
  1287. on aip.plan_id = oo.order_plan_id
  1288. left join amstruck_requirement_plan arp
  1289. on arp.plan_id = aip.plan_id
  1290. left join amstruck_inward_requirement air
  1291. on air.requirement_id = arp.requirement_id
  1292. left join AMS_PURCHASE_ORDER APO
  1293. on apo.purchase_order_id = air.purchase_order_id
  1294. left join DIL_BATCH DB
  1295. on DB.BATCH_ID = APO.BATCH_ID
  1296. left join RMS_CAPACITY RC
  1297. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1298. left join RMS_SUPPLIER RS
  1299. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  1300. left join RMS_CONSIGNEE RCON
  1301. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  1302. left join OMSTRUCK_ORDER_MATERIAL OOM
  1303. on OOM.ORDER_ID = OO.ORDER_ID
  1304. left join RMS_MATERIAL RM
  1305. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1306. left join RMS_GATEPOST RG
  1307. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1308. where TER.RESULT_ENTRY_GATE_TIME is not null
  1309. and OO.ORDER_TYPE in (10,20)
  1310. <if test="userId">
  1311. and air.INSERT_USERNAME=#{userId}
  1312. </if>
  1313. <if test="oneDate != null">
  1314. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1315. </if>
  1316. <if test="startDate != null">
  1317. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
  1318. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
  1319. </if>
  1320. )
  1321. <where>
  1322. <if test="purchaseOrderId != null">
  1323. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  1324. "purchaseOrderId" like '%${item}%'
  1325. </foreach>
  1326. </if>
  1327. <if test="materialName != null">
  1328. and
  1329. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1330. "materialName" like '%${item}%'
  1331. </foreach>
  1332. </if>
  1333. <if test="resultForeignShipName != null">
  1334. and
  1335. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  1336. "resultForeignShipName" like '%${item}%'
  1337. </foreach>
  1338. </if>
  1339. <if test="orderNumber != null">
  1340. and
  1341. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1342. "orderNumber" like '%${item}%'
  1343. </foreach>
  1344. </if>
  1345. <if test="capacityNumber != null">
  1346. and
  1347. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1348. "capacityNumber" like '%${item}%'
  1349. </foreach>
  1350. </if>
  1351. <if test="warehouseName != null">
  1352. and
  1353. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1354. "warehouseName" like '%${item}%'
  1355. </foreach>
  1356. </if>
  1357. <if test="resultEntryMode != null">
  1358. and
  1359. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1360. "resultEntryMode" like '%${item}%'
  1361. </foreach>
  1362. </if>
  1363. <if test="supplierName != null">
  1364. and
  1365. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1366. "supplierName" like '%${item}%'
  1367. </foreach>
  1368. </if>
  1369. <if test="orderMaterialWeight != null">
  1370. and
  1371. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1372. "orderMaterialWeight" like '%${item}%'
  1373. </foreach>
  1374. </if>
  1375. </where>
  1376. <include refid="orderByEnterTime"></include>
  1377. </select>
  1378. <select id="getCgNzOutFactory" resultType="java.util.Map">
  1379. select TLFR.RESULT_ID "resultId",
  1380. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1381. RM.MATERIAL_NAME "materialName",
  1382. OO.ORDER_NUMBER "orderNumber",
  1383. RC.CAPACITY_NUMBER "capacityNumber",
  1384. RG.GATEPOST_NAME "gatepostName",
  1385. TLFR.RESULT_OUT_MODE "resultOutMode",
  1386. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1387. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  1388. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1389. left join TMSTRUCK_TOTAL_RESULT TTR
  1390. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1391. left join OMSTRUCK_ORDER OO
  1392. on OO.ORDER_ID = TTR.ORDER_ID
  1393. left join amstruck_inward_plan aip
  1394. on aip.plan_id = oo.order_plan_id
  1395. left join amstruck_requirement_plan arp
  1396. on arp.plan_id = aip.plan_id
  1397. left join amstruck_inward_requirement air
  1398. on air.requirement_id = arp.requirement_id
  1399. left join AMS_PURCHASE_ORDER APO
  1400. on APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
  1401. left join DIL_BATCH DB
  1402. on DB.BATCH_ID = APO.BATCH_ID
  1403. left join OMSTRUCK_ORDER_MATERIAL OOM
  1404. on OOM.ORDER_ID = OO.ORDER_ID
  1405. left join RMS_MATERIAL RM
  1406. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1407. left join RMS_CAPACITY RC
  1408. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1409. left join RMS_GATEPOST RG
  1410. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  1411. where RESULT_OUT_GATE_TIME is not null
  1412. and OO.ORDER_TYPE in (10,20)
  1413. <if test="userId !=null">
  1414. and AIR.INSERT_USERNAME = #{userId}
  1415. </if>
  1416. <if test="oneDate != null">
  1417. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLFR.RESULT_OUT_GATE_TIME
  1418. </if>
  1419. <if test="startDate != null">
  1420. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLFR.RESULT_OUT_GATE_TIME
  1421. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLFR.RESULT_OUT_GATE_TIME
  1422. </if>
  1423. order by tlfr.result_out_gate_time desc
  1424. <where>
  1425. <if test="capacityNumber != null">
  1426. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1427. "capacityNumber" like '%${item}%'
  1428. </foreach>
  1429. </if>
  1430. <if test="materialName != null">
  1431. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1432. "materialName" like '%${item}%'
  1433. </foreach>
  1434. </if>
  1435. <if test="gatepostName != null">
  1436. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1437. "gatepostName" like '%${item}%'
  1438. </foreach>
  1439. </if>
  1440. </where>
  1441. </select>
  1442. <select id="selectAllEnFactoryNum" parameterType="java.math.BigDecimal" resultType="int">
  1443. select count(TER.RESULT_TOTAL_ID)
  1444. from TMSTRUCK_ENFACTORY_RESULT TER
  1445. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  1446. </select>
  1447. <select id="selectEnFactoryNumber" parameterType="java.math.BigDecimal" resultType="int">
  1448. select count(TER.RESULT_TOTAL_ID)
  1449. from TMSTRUCK_ENFACTORY_RESULT TER
  1450. where TER.RESULT_TOTAL_ID = #{resultTotalId}
  1451. and TER.RESULT_ENTRY_GATE_TIME is null
  1452. </select>
  1453. <select id="getEnResult" resultType="java.util.Map">
  1454. SELECT TER.RESULT_ID "resultId", TER.SEGMEN_SQE,TER.INSERT_TIME,oo.ORDER_TYPE
  1455. FROM OMSTRUCK_ORDER OO
  1456. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1457. ON TTR.ORDER_ID = OO.ORDER_ID
  1458. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  1459. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1460. WHERE OO.ORDER_TYPE = 20
  1461. AND TER.SEGMEN_SQE = 5
  1462. </select>
  1463. </mapper>