TmstruckEnfactoryResultMapper.xml 66 KB

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