TmstruckLoadResultMapper.xml 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655
  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.TmstruckLoadResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckLoadResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  7. <result column="RESULT_LOAD_START_TIME" jdbcType="TIMESTAMP" property="resultLoadStartTime" />
  8. <result column="RESULT_LOAD_END_TIME" jdbcType="TIMESTAMP" property="resultLoadEndTime" />
  9. <result column="RESULT_LOAD_DURATION" jdbcType="DECIMAL" property="resultLoadDuration" />
  10. <result column="LOAD_STANDARD_TIME_ID" jdbcType="DECIMAL" property="loadStandardTimeId" />
  11. <result column="LOADER_ID" jdbcType="DECIMAL" property="loaderId" />
  12. <result column="RESULT_ISCLEAR" jdbcType="VARCHAR" property="resultIsclear" />
  13. <result column="DELETE_NAME" jdbcType="VARCHAR" property="deleteName" />
  14. <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
  15. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  16. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  17. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  18. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  19. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  20. <result column="STATUS" jdbcType="DECIMAL" property="status" />
  21. <result column="RESULT_MEASURED_TONNAGE" jdbcType="DECIMAL" property="resultMeasuredTonnage" />
  22. <result column="LOADING_ID" jdbcType="DECIMAL" property="loadingId" />
  23. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  24. <result column="LOADING_SEQUENCE" jdbcType="DECIMAL" property="loadingSequence" />
  25. <result column="ISDEDUCT" jdbcType="DECIMAL" property="isdeduct" />
  26. <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
  27. <result column="CASE_NUMBER" jdbcType="VARCHAR" property="caseNumber" />
  28. </resultMap>
  29. <sql id="columns">
  30. RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME, RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
  31. LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME, INSERT_USERNAME,
  32. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
  33. LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE, ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
  34. </sql>
  35. <sql id="columns_alias">
  36. t.RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_LOAD_START_TIME, t.RESULT_LOAD_END_TIME,
  37. t.RESULT_LOAD_DURATION, t.LOAD_STANDARD_TIME_ID, t.LOADER_ID, t.RESULT_ISCLEAR, t.DELETE_NAME,
  38. t.DELETE_TIME, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  39. t.INSERT_UPDATE_REMARK, t.STATUS, t.RESULT_MEASURED_TONNAGE, t.LOADING_ID, t.MATERIAL_ID,
  40. t.LOADING_SEQUENCE, t.ISDEDUCT, t.SEGMENT_SQE, t.CASE_NUMBER
  41. </sql>
  42. <sql id="select">
  43. SELECT <include refid="columns" /> FROM TMSTRUCK_LOAD_RESULT
  44. </sql>
  45. <sql id="select_alias">
  46. SELECT <include refid="columns_alias" /> FROM TMSTRUCK_LOAD_RESULT t
  47. </sql>
  48. <sql id="where">
  49. <where>
  50. <if test="resultId != null">
  51. and RESULT_ID = #{resultId}
  52. </if>
  53. <if test="resultTotalId != null">
  54. and RESULT_TOTAL_ID = #{resultTotalId}
  55. </if>
  56. <if test="resultLoadStartTime != null">
  57. and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
  58. </if>
  59. <if test="resultLoadEndTime != null">
  60. and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
  61. </if>
  62. <if test="resultLoadDuration != null">
  63. and RESULT_LOAD_DURATION = #{resultLoadDuration}
  64. </if>
  65. <if test="loadStandardTimeId != null">
  66. and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
  67. </if>
  68. <if test="loaderId != null">
  69. and LOADER_ID = #{loaderId}
  70. </if>
  71. <if test="resultIsclear != null and resultIsclear != ''">
  72. and RESULT_ISCLEAR = #{resultIsclear}
  73. </if>
  74. <if test="deleteName != null and deleteName != ''">
  75. and DELETE_NAME = #{deleteName}
  76. </if>
  77. <if test="deleteTime != null">
  78. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  79. </if>
  80. <if test="insertUsername != null and insertUsername != ''">
  81. and INSERT_USERNAME = #{insertUsername}
  82. </if>
  83. <if test="insertTime != null">
  84. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  85. </if>
  86. <if test="updateUsername != null and updateUsername != ''">
  87. and UPDATE_USERNAME = #{updateUsername}
  88. </if>
  89. <if test="updateTime != null">
  90. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  91. </if>
  92. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  93. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  94. </if>
  95. <if test="status != null">
  96. and STATUS = #{status}
  97. </if>
  98. <if test="resultMeasuredTonnage != null">
  99. and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
  100. </if>
  101. <if test="loadingId != null">
  102. and LOADING_ID = #{loadingId}
  103. </if>
  104. <if test="materialId != null">
  105. and MATERIAL_ID = #{materialId}
  106. </if>
  107. <if test="loadingSequence != null">
  108. and LOADING_SEQUENCE = #{loadingSequence}
  109. </if>
  110. <if test="isdeduct != null">
  111. and ISDEDUCT = #{isdeduct}
  112. </if>
  113. <if test="segmentSqe != null">
  114. and SEGMENT_SQE = #{segmentSqe}
  115. </if>
  116. <if test="caseNumber != null and caseNumber != ''">
  117. and CASE_NUMBER = #{caseNumber}
  118. </if>
  119. </where>
  120. </sql>
  121. <sql id="whereLike">
  122. <where>
  123. <if test="resultId != null">
  124. and RESULT_ID = #{resultId}
  125. </if>
  126. <if test="resultTotalId != null">
  127. and RESULT_TOTAL_ID = #{resultTotalId}
  128. </if>
  129. <if test="resultLoadStartTime != null">
  130. and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
  131. </if>
  132. <if test="resultLoadEndTime != null">
  133. and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
  134. </if>
  135. <if test="resultLoadDuration != null">
  136. and RESULT_LOAD_DURATION = #{resultLoadDuration}
  137. </if>
  138. <if test="loadStandardTimeId != null">
  139. and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
  140. </if>
  141. <if test="loaderId != null">
  142. and LOADER_ID = #{loaderId}
  143. </if>
  144. <if test="resultIsclear != null and resultIsclear != ''">
  145. and RESULT_ISCLEAR LIKE '%${resultIsclear}%'
  146. </if>
  147. <if test="deleteName != null and deleteName != ''">
  148. and DELETE_NAME LIKE '%${deleteName}%'
  149. </if>
  150. <if test="deleteTime != null">
  151. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  152. </if>
  153. <if test="insertUsername != null and insertUsername != ''">
  154. and INSERT_USERNAME LIKE '%${insertUsername}%'
  155. </if>
  156. <if test="insertTime != null">
  157. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  158. </if>
  159. <if test="updateUsername != null and updateUsername != ''">
  160. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  161. </if>
  162. <if test="updateTime != null">
  163. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  164. </if>
  165. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  166. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  167. </if>
  168. <if test="status != null">
  169. and STATUS = #{status}
  170. </if>
  171. <if test="resultMeasuredTonnage != null">
  172. and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
  173. </if>
  174. <if test="loadingId != null">
  175. and LOADING_ID = #{loadingId}
  176. </if>
  177. <if test="materialId != null">
  178. and MATERIAL_ID = #{materialId}
  179. </if>
  180. <if test="loadingSequence != null">
  181. and LOADING_SEQUENCE = #{loadingSequence}
  182. </if>
  183. <if test="isdeduct != null">
  184. and ISDEDUCT = #{isdeduct}
  185. </if>
  186. <if test="segmentSqe != null">
  187. and SEGMENT_SQE = #{segmentSqe}
  188. </if>
  189. <if test="caseNumber != null and caseNumber != ''">
  190. and CASE_NUMBER LIKE '%${caseNumber}%'
  191. </if>
  192. </where>
  193. </sql>
  194. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  195. delete from TMSTRUCK_LOAD_RESULT
  196. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  197. </delete>
  198. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  199. delete from TMSTRUCK_LOAD_RESULT
  200. where 1!=1
  201. <if test="resultTotalId != null">
  202. or RESULT_TOTAL_ID = #{resultTotalId}
  203. </if>
  204. <if test="resultLoadStartTime != null">
  205. or TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = '#{resultLoadStartTime}'
  206. </if>
  207. <if test="resultLoadEndTime != null">
  208. or TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = '#{resultLoadEndTime}'
  209. </if>
  210. <if test="resultLoadDuration != null">
  211. or RESULT_LOAD_DURATION = #{resultLoadDuration}
  212. </if>
  213. <if test="loadStandardTimeId != null">
  214. or LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
  215. </if>
  216. <if test="loaderId != null">
  217. or LOADER_ID = #{loaderId}
  218. </if>
  219. <if test="resultIsclear != null and resultIsclear != ''">
  220. or RESULT_ISCLEAR = #{resultIsclear}
  221. </if>
  222. <if test="deleteName != null and deleteName != ''">
  223. or DELETE_NAME = #{deleteName}
  224. </if>
  225. <if test="deleteTime != null">
  226. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  227. </if>
  228. <if test="insertUsername != null and insertUsername != ''">
  229. or INSERT_USERNAME = #{insertUsername}
  230. </if>
  231. <if test="insertTime != null">
  232. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  233. </if>
  234. <if test="updateUsername != null and updateUsername != ''">
  235. or UPDATE_USERNAME = #{updateUsername}
  236. </if>
  237. <if test="updateTime != null">
  238. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  239. </if>
  240. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  241. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  242. </if>
  243. <if test="status != null">
  244. or STATUS = #{status}
  245. </if>
  246. <if test="resultMeasuredTonnage != null">
  247. or RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
  248. </if>
  249. <if test="loadingId != null">
  250. or LOADING_ID = #{loadingId}
  251. </if>
  252. <if test="materialId != null">
  253. or MATERIAL_ID = #{materialId}
  254. </if>
  255. <if test="loadingSequence != null">
  256. or LOADING_SEQUENCE = #{loadingSequence}
  257. </if>
  258. <if test="isdeduct != null">
  259. or ISDEDUCT = #{isdeduct}
  260. </if>
  261. <if test="segmentSqe != null">
  262. or SEGMENT_SQE = #{segmentSqe}
  263. </if>
  264. <if test="caseNumber != null and caseNumber != ''">
  265. or CASE_NUMBER = #{caseNumber}
  266. </if>
  267. </delete>
  268. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
  269. insert into TMSTRUCK_LOAD_RESULT (RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME,
  270. RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
  271. LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR,
  272. DELETE_NAME, DELETE_TIME, INSERT_USERNAME,
  273. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  274. INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
  275. LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE,
  276. ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
  277. )
  278. values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{resultLoadStartTime,jdbcType=TIMESTAMP},
  279. #{resultLoadEndTime,jdbcType=TIMESTAMP}, #{resultLoadDuration,jdbcType=DECIMAL},
  280. #{loadStandardTimeId,jdbcType=DECIMAL}, #{loaderId,jdbcType=DECIMAL}, #{resultIsclear,jdbcType=VARCHAR},
  281. #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR},
  282. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  283. #{insertUpdateRemark,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{resultMeasuredTonnage,jdbcType=DECIMAL},
  284. #{loadingId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{loadingSequence,jdbcType=DECIMAL},
  285. #{isdeduct,jdbcType=DECIMAL}, #{segmentSqe,jdbcType=DECIMAL}, #{caseNumber,jdbcType=VARCHAR}
  286. )
  287. </insert>
  288. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
  289. insert into TMSTRUCK_LOAD_RESULT
  290. <trim prefix="(" suffix=")" suffixOverrides=",">
  291. <if test="resultId != null">
  292. RESULT_ID,
  293. </if>
  294. <if test="resultTotalId != null">
  295. RESULT_TOTAL_ID,
  296. </if>
  297. <if test="resultLoadStartTime != null">
  298. RESULT_LOAD_START_TIME,
  299. </if>
  300. <if test="resultLoadEndTime != null">
  301. RESULT_LOAD_END_TIME,
  302. </if>
  303. <if test="resultLoadDuration != null">
  304. RESULT_LOAD_DURATION,
  305. </if>
  306. <if test="loadStandardTimeId != null">
  307. LOAD_STANDARD_TIME_ID,
  308. </if>
  309. <if test="loaderId != null">
  310. LOADER_ID,
  311. </if>
  312. <if test="resultIsclear != null">
  313. RESULT_ISCLEAR,
  314. </if>
  315. <if test="deleteName != null">
  316. DELETE_NAME,
  317. </if>
  318. <if test="deleteTime != null">
  319. DELETE_TIME,
  320. </if>
  321. <if test="insertUsername != null">
  322. INSERT_USERNAME,
  323. </if>
  324. <if test="insertTime != null">
  325. INSERT_TIME,
  326. </if>
  327. <if test="updateUsername != null">
  328. UPDATE_USERNAME,
  329. </if>
  330. <if test="updateTime != null">
  331. UPDATE_TIME,
  332. </if>
  333. <if test="insertUpdateRemark != null">
  334. INSERT_UPDATE_REMARK,
  335. </if>
  336. <if test="status != null">
  337. STATUS,
  338. </if>
  339. <if test="resultMeasuredTonnage != null">
  340. RESULT_MEASURED_TONNAGE,
  341. </if>
  342. <if test="loadingId != null">
  343. LOADING_ID,
  344. </if>
  345. <if test="materialId != null">
  346. MATERIAL_ID,
  347. </if>
  348. <if test="loadingSequence != null">
  349. LOADING_SEQUENCE,
  350. </if>
  351. <if test="isdeduct != null">
  352. ISDEDUCT,
  353. </if>
  354. <if test="segmentSqe != null">
  355. SEGMENT_SQE,
  356. </if>
  357. <if test="caseNumber != null">
  358. CASE_NUMBER,
  359. </if>
  360. </trim>
  361. <trim prefix="values (" suffix=")" suffixOverrides=",">
  362. <if test="resultId != null">
  363. #{resultId,jdbcType=DECIMAL},
  364. </if>
  365. <if test="resultTotalId != null">
  366. #{resultTotalId,jdbcType=DECIMAL},
  367. </if>
  368. <if test="resultLoadStartTime != null">
  369. #{resultLoadStartTime,jdbcType=TIMESTAMP},
  370. </if>
  371. <if test="resultLoadEndTime != null">
  372. #{resultLoadEndTime,jdbcType=TIMESTAMP},
  373. </if>
  374. <if test="resultLoadDuration != null">
  375. #{resultLoadDuration,jdbcType=DECIMAL},
  376. </if>
  377. <if test="loadStandardTimeId != null">
  378. #{loadStandardTimeId,jdbcType=DECIMAL},
  379. </if>
  380. <if test="loaderId != null">
  381. #{loaderId,jdbcType=DECIMAL},
  382. </if>
  383. <if test="resultIsclear != null">
  384. #{resultIsclear,jdbcType=VARCHAR},
  385. </if>
  386. <if test="deleteName != null">
  387. #{deleteName,jdbcType=VARCHAR},
  388. </if>
  389. <if test="deleteTime != null">
  390. #{deleteTime,jdbcType=TIMESTAMP},
  391. </if>
  392. <if test="insertUsername != null">
  393. #{insertUsername,jdbcType=VARCHAR},
  394. </if>
  395. <if test="insertTime != null">
  396. #{insertTime,jdbcType=TIMESTAMP},
  397. </if>
  398. <if test="updateUsername != null">
  399. #{updateUsername,jdbcType=VARCHAR},
  400. </if>
  401. <if test="updateTime != null">
  402. #{updateTime,jdbcType=TIMESTAMP},
  403. </if>
  404. <if test="insertUpdateRemark != null">
  405. #{insertUpdateRemark,jdbcType=VARCHAR},
  406. </if>
  407. <if test="status != null">
  408. #{status,jdbcType=DECIMAL},
  409. </if>
  410. <if test="resultMeasuredTonnage != null">
  411. #{resultMeasuredTonnage,jdbcType=DECIMAL},
  412. </if>
  413. <if test="loadingId != null">
  414. #{loadingId,jdbcType=DECIMAL},
  415. </if>
  416. <if test="materialId != null">
  417. #{materialId,jdbcType=DECIMAL},
  418. </if>
  419. <if test="loadingSequence != null">
  420. #{loadingSequence,jdbcType=DECIMAL},
  421. </if>
  422. <if test="isdeduct != null">
  423. #{isdeduct,jdbcType=DECIMAL},
  424. </if>
  425. <if test="segmentSqe != null">
  426. #{segmentSqe,jdbcType=DECIMAL},
  427. </if>
  428. <if test="caseNumber != null">
  429. #{caseNumber,jdbcType=VARCHAR},
  430. </if>
  431. </trim>
  432. </insert>
  433. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
  434. update TMSTRUCK_LOAD_RESULT
  435. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  436. RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
  437. RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
  438. RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
  439. LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
  440. LOADER_ID = #{loaderId,jdbcType=DECIMAL},
  441. RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
  442. DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
  443. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  444. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  445. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  446. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  447. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  448. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  449. STATUS = #{status,jdbcType=DECIMAL},
  450. RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
  451. LOADING_ID = #{loadingId,jdbcType=DECIMAL},
  452. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  453. LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
  454. ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
  455. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  456. CASE_NUMBER = #{caseNumber,jdbcType=VARCHAR}
  457. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  458. </update>
  459. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
  460. update TMSTRUCK_LOAD_RESULT
  461. <set>
  462. <if test="resultTotalId != null">
  463. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  464. </if>
  465. <if test="resultLoadStartTime != null">
  466. RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
  467. </if>
  468. <if test="resultLoadEndTime != null">
  469. RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
  470. </if>
  471. <if test="resultLoadDuration != null">
  472. RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
  473. </if>
  474. <if test="loadStandardTimeId != null">
  475. LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
  476. </if>
  477. <if test="loaderId != null">
  478. LOADER_ID = #{loaderId,jdbcType=DECIMAL},
  479. </if>
  480. <if test="resultIsclear != null">
  481. RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
  482. </if>
  483. <if test="deleteName != null">
  484. DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
  485. </if>
  486. <if test="deleteTime != null">
  487. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  488. </if>
  489. <if test="insertUsername != null">
  490. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  491. </if>
  492. <if test="insertTime != null">
  493. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  494. </if>
  495. <if test="updateUsername != null">
  496. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  497. </if>
  498. <if test="updateTime != null">
  499. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  500. </if>
  501. <if test="insertUpdateRemark != null">
  502. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  503. </if>
  504. <if test="status != null">
  505. STATUS = #{status,jdbcType=DECIMAL},
  506. </if>
  507. <if test="resultMeasuredTonnage != null">
  508. RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
  509. </if>
  510. <if test="loadingId != null">
  511. LOADING_ID = #{loadingId,jdbcType=DECIMAL},
  512. </if>
  513. <if test="materialId != null">
  514. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  515. </if>
  516. <if test="loadingSequence != null">
  517. LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
  518. </if>
  519. <if test="isdeduct != null">
  520. ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
  521. </if>
  522. <if test="segmentSqe != null">
  523. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  524. </if>
  525. <if test="caseNumber != null">
  526. CASE_NUMBER = #{caseNumber,jdbcType=VARCHAR},
  527. </if>
  528. </set>
  529. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  530. </update>
  531. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  532. <include refid="select" />
  533. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  534. </select>
  535. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  536. <include refid="select" />
  537. <include refid="where" />
  538. </select>
  539. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  540. <include refid="select" />
  541. <include refid="whereLike" />
  542. </select>
  543. <insert id="batchInsert" parameterType="java.util.List">
  544. insert into TMSTRUCK_LOAD_RESULT
  545. (RESULT_ID,
  546. RESULT_TOTAL_ID, RESULT_LOAD_START_TIME,
  547. RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
  548. LOAD_STANDARD_TIME_ID, LOADER_ID,
  549. RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME,
  550. INSERT_USERNAME, INSERT_TIME,
  551. UPDATE_USERNAME, UPDATE_TIME,
  552. INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
  553. LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE,
  554. ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
  555. )
  556. ( <foreach collection="list" item="item" separator="union all">
  557. select
  558. #{item.resultId,jdbcType=DECIMAL},
  559. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.resultLoadStartTime,jdbcType=TIMESTAMP},
  560. #{item.resultLoadEndTime,jdbcType=TIMESTAMP}, #{item.resultLoadDuration,jdbcType=DECIMAL},
  561. #{item.loadStandardTimeId,jdbcType=DECIMAL}, #{item.loaderId,jdbcType=DECIMAL},
  562. #{item.resultIsclear,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP},
  563. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  564. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  565. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL}, #{item.resultMeasuredTonnage,jdbcType=DECIMAL},
  566. #{item.loadingId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.loadingSequence,jdbcType=DECIMAL},
  567. #{item.isdeduct,jdbcType=DECIMAL}, #{item.segmentSqe,jdbcType=DECIMAL}, #{item.caseNumber,jdbcType=VARCHAR}
  568. from dual
  569. </foreach> )
  570. </insert>
  571. <update id="batchUpdate" parameterType="java.util.List">
  572. update TMSTRUCK_LOAD_RESULT
  573. set
  574. RESULT_ID=
  575. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  576. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  577. </foreach>
  578. ,RESULT_TOTAL_ID=
  579. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  580. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  581. </foreach>
  582. ,RESULT_LOAD_START_TIME=
  583. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  584. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadStartTime,jdbcType=TIMESTAMP}
  585. </foreach>
  586. ,RESULT_LOAD_END_TIME=
  587. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  588. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadEndTime,jdbcType=TIMESTAMP}
  589. </foreach>
  590. ,RESULT_LOAD_DURATION=
  591. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  592. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadDuration,jdbcType=DECIMAL}
  593. </foreach>
  594. ,LOAD_STANDARD_TIME_ID=
  595. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  596. when #{item.resultId,jdbcType=DECIMAL} then #{item.loadStandardTimeId,jdbcType=DECIMAL}
  597. </foreach>
  598. ,LOADER_ID=
  599. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  600. when #{item.resultId,jdbcType=DECIMAL} then #{item.loaderId,jdbcType=DECIMAL}
  601. </foreach>
  602. ,RESULT_ISCLEAR=
  603. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  604. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultIsclear,jdbcType=VARCHAR}
  605. </foreach>
  606. ,DELETE_NAME=
  607. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  608. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
  609. </foreach>
  610. ,DELETE_TIME=
  611. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  612. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  613. </foreach>
  614. ,INSERT_USERNAME=
  615. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  616. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  617. </foreach>
  618. ,INSERT_TIME=
  619. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  620. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  621. </foreach>
  622. ,UPDATE_USERNAME=
  623. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  624. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  625. </foreach>
  626. ,UPDATE_TIME=
  627. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  628. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  629. </foreach>
  630. ,INSERT_UPDATE_REMARK=
  631. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  632. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  633. </foreach>
  634. ,STATUS=
  635. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  636. when #{item.resultId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
  637. </foreach>
  638. ,RESULT_MEASURED_TONNAGE=
  639. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  640. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMeasuredTonnage,jdbcType=DECIMAL}
  641. </foreach>
  642. ,LOADING_ID=
  643. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  644. when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingId,jdbcType=DECIMAL}
  645. </foreach>
  646. ,MATERIAL_ID=
  647. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  648. when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  649. </foreach>
  650. ,LOADING_SEQUENCE=
  651. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  652. when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingSequence,jdbcType=DECIMAL}
  653. </foreach>
  654. ,ISDEDUCT=
  655. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  656. when #{item.resultId,jdbcType=DECIMAL} then #{item.isdeduct,jdbcType=DECIMAL}
  657. </foreach>
  658. ,SEGMENT_SQE=
  659. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  660. when #{item.resultId,jdbcType=DECIMAL} then #{item.segmentSqe,jdbcType=DECIMAL}
  661. </foreach>
  662. ,CASE_NUMBER=
  663. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  664. when #{item.resultId,jdbcType=DECIMAL} then #{item.caseNumber,jdbcType=VARCHAR}
  665. </foreach>
  666. where RESULT_ID in
  667. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  668. #{item.resultId,jdbcType=DECIMAL}
  669. </foreach>
  670. </update>
  671. <delete id="batchDelete" parameterType="java.util.List">
  672. delete from TMSTRUCK_LOAD_RESULT
  673. where RESULT_ID in
  674. <foreach close=")" collection="list" item="id" open="(" separator=",">
  675. #{id}
  676. </foreach>
  677. </delete>
  678. <!-- 友情提示!!!-->
  679. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  680. <sql id="orderBy">
  681. <if test="orderField != null and orderField != ''">
  682. order by "${orderField}"
  683. <if test="orderType != null and orderType != ''">
  684. ${orderType}
  685. </if>
  686. </if>
  687. </sql>
  688. <!-- 获取所有装车实绩 -->
  689. <select id="getCGJKLoadResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  690. select *
  691. from (
  692. select TLR.RESULT_ID "resultId",
  693. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  694. RM.MATERIAL_NAME "materialName",
  695. OO.ORDER_NUMBER "orderNumber",
  696. RC.CAPACITY_NUMBER "capacityNumber",
  697. TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
  698. TLR.RESULT_ISCLEAR "resultIsclear",
  699. to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
  700. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
  701. TLR.INSERT_TIME "insertTime",
  702. RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  703. RS.SUPPLIER_NAME "supplierName"
  704. from TMSTRUCK_LOAD_RESULT TLR
  705. left join TMSTRUCK_TOTAL_RESULT TTR
  706. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  707. left join OMSTRUCK_ORDER OO
  708. on TTR.ORDER_ID = OO.ORDER_ID
  709. left join OMSTRUCK_ORDER_MATERIAL OOM
  710. on OO.ORDER_ID = OOM.ORDER_ID
  711. left join AMS_PURCHASE_ORDER APO
  712. on OO.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
  713. left join DIL_BATCH DB
  714. on DB.BATCH_ID = APO.BATCH_ID
  715. left join RMS_MATERIAL RM
  716. on OOM.MATERIAL_ID = RM.MATERIAL_ID
  717. left join RMS_CAPACITY RC
  718. on RC.CAPACITY_ID = OO.CAPACITY_ID
  719. left join RMS_SUPPLIER RS
  720. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  721. left join RMS_CONSIGNEE RCON
  722. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  723. where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
  724. )
  725. <where>
  726. <if test="purchaseOrderId != null">
  727. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  728. "purchaseOrderId" like '%${item}%'
  729. </foreach>
  730. </if>
  731. <if test="materialName != null">
  732. and
  733. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  734. "materialName" like '%${item}%'
  735. </foreach>
  736. </if>
  737. <if test="orderNumber != null">
  738. and
  739. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  740. "orderNumber" like '%${item}%'
  741. </foreach>
  742. </if>
  743. <if test="capacityNumber != null">
  744. and
  745. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  746. "capacityNumber" like '%${item}%'
  747. </foreach>
  748. </if>
  749. <if test="orderMaterialWeight != null">
  750. and
  751. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  752. "orderMaterialWeight" like '%${item}%'
  753. </foreach>
  754. </if>
  755. <if test="resultIsclear != null">
  756. and
  757. <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
  758. "resultIsclear" like '%${item}%'
  759. </foreach>
  760. </if>
  761. <if test="resultLoadStartTime != null">
  762. and
  763. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  764. "resultLoadStartTime" like '%${item}%'
  765. </foreach>
  766. </if>
  767. <if test="insertUpdateRemark != null">
  768. and
  769. <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
  770. "insertUpdateRemark" like '%${item}%'
  771. </foreach>
  772. </if>
  773. </where>
  774. <include refid="orderBy"></include>
  775. <if test="orderField == null ">
  776. order by "resultLoadStartTime" desc
  777. </if>
  778. </select>
  779. <!-- 通过Id获取装车实绩 数据 用于修改-->
  780. <select id="getLoadResultById" parameterType="int" resultType="java.util.LinkedHashMap">
  781. select TLR.RESULT_ISCLEAR "resultIsclear",
  782. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  783. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark"
  784. from TMSTRUCK_LOAD_RESULT TLR
  785. where RESULT_ID = #{resultId}
  786. </select>
  787. <!-- 通过发站查询所属港口 -->
  788. <select id="getPortIdBySendStationId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  789. select RAS.OWNED_PORT_ID
  790. from RMSTRAIN_ARRIVAL_SEND RAS
  791. where RAS.ARRIVAL_ID = #{sendStationId}
  792. </select>
  793. <!-- 通过运输订单查询批次 -->
  794. <select id="getBatchIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  795. select APO.BATCH_ID
  796. from OMSTRUCK_ORDER OO
  797. left join AMS_PURCHASE_ORDER APO
  798. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  799. where OO.ORDER_ID = #{orderId}
  800. </select>
  801. <!--通过运输订单号查找运输订单类型-->
  802. <select id="selectOrderTypeByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
  803. select OO.ORDER_TYPE "orderType"
  804. from OMSTRUCK_ORDER OO
  805. where OO.ORDER_NUMBER = #{oderNumber}
  806. </select>
  807. <!-- 通过运输订单号查询 出库实绩 最小Id(第一件扫描时间) 0 成功 1 失败-->
  808. <select id="getMinScanIdByOrderNum" parameterType="java.util.Map" resultType="java.util.Map">
  809. select *
  810. from (
  811. select WOSR.RESULT_ID "resultId",
  812. WOSR.LOAD_ID "loadId"
  813. from WMSP_OUTBOUND_RESULT WOR
  814. left join WMSP_OUTBOUND_SCAN_RESULT WOSR
  815. on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
  816. left join OMSTRUCK_ORDER OO
  817. on OO.ORDER_ID = WOR.BILL_LADING_ID
  818. WHERE OO.ORDER_NUMBER = #{orderNumber}
  819. and WOR.MATERIAL_ID = #{materialId}
  820. and WOSR.RESULT_CHECK = 0
  821. ORDER BY WOSR.RESULT_LOAD_TIME
  822. )
  823. where rownum = 1
  824. </select>
  825. <!-- 根据运输订单号查找 -->
  826. <select id="selectResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
  827. select WOSR.RESULT_ID "resultId"
  828. from OMSTRUCK_ORDER OO
  829. left join WMSP_OUTBOUND_RESULT WOR
  830. on OO.ORDER_ID = WOR.BILL_LADING_ID
  831. left join WMSP_OUTBOUND_SCAN_RESULT WOSR
  832. on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
  833. WHERE OO.ORDER_NUMBER = #{orderNumber}
  834. and WOSR.RESULT_CHECK = 0
  835. </select>
  836. <!-- 根据实绩id查找扫描时间 -->
  837. <select id="selectLoadTimeByResultId" resultType="java.util.Date" parameterType="java.math.BigDecimal">
  838. select WOSR.RESULT_LOAD_TIME "loadTime"
  839. from WMSP_OUTBOUND_SCAN_RESULT WOSR
  840. where WOSR.RESULT_ID = #{resultId}
  841. </select>
  842. <!-- 根据扫描实绩id查询装卸工id -->
  843. <select id="selecLoadIdByresultId" resultType="java.lang.Integer">
  844. select WOSR.LOAD_ID "loadId"
  845. from WMSP_OUTBOUND_SCAN_RESULT WOSR
  846. where WOSR.RESULT_ID = #{resultId}
  847. </select>
  848. <!-- 销售装车实绩查询-->
  849. <select id="selectLoadResultForSale" resultType="java.util.Map" parameterType="java.lang.Integer">
  850. SELECT (SELECT ORDER_MATERIAL_NUMBER
  851. FROM OMSTRUCK_ORDER_MATERIAL OOM
  852. WHERE OOM.ORDER_ID = OO.ORDER_ID
  853. AND TLR.MATERIAL_ID = OOM.MATERIAL_ID) "orderMaterialNumber",
  854. TLR.RESULT_LOAD_START_TIME "startTime",
  855. TLR.RESULT_LOAD_END_TIME "endTime",
  856. TLR.RESULT_LOAD_DURATION "loadDuration",
  857. RM.MATERIAL_NAME "materialName",
  858. RP.PERSONNEL_NAME "name",
  859. RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
  860. OO.ORDER_NUMBER "orderNumber",
  861. ASO.SALE_NUMBER "saleNumber",
  862. RC.CAPACITY_NUMBER "capacityNumber"
  863. FROM TMSTRUCK_LOAD_RESULT TLR
  864. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  865. LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
  866. LEFT JOIN RMS_MATERIAL_STEEL RMS ON RMS.MATERIAL_STEEL_ID = TLR.MATERIAL_ID
  867. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = RMS.MATERIAL_ID
  868. LEFT JOIN RMS_PERSONNEL RP ON TLR.LOADER_ID = RP.PERSONNEL_ID
  869. LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  870. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  871. LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
  872. where TLR.STATUS = #{status}
  873. and OO.ORDER_TYPE = 1
  874. </select>
  875. <!--通过运输订单号查找物资id-->
  876. <select id="selectMaterialIdByOrderNumber" parameterType="java.lang.String" resultType="java.util.Map">
  877. SELECT
  878. OOM.MATERIAL_ID "materialId"
  879. FROM
  880. OMSTRUCK_ORDER OO
  881. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
  882. WHERE
  883. <if test="orderNumber != null">
  884. OO.ORDER_NUMBER = #{orderNumber}
  885. </if>
  886. <if test="orderId != null">
  887. and OO.ORDER_ID = #{orderId}
  888. </if>
  889. </select>
  890. <!-- 通过订单ID 和物资Id 查询装车实绩ID 可能会有多条-->
  891. <select id="getLoadResultId" parameterType="java.util.Map" resultType="java.lang.Integer">
  892. select TLR.RESULT_ID
  893. from OMSTRUCK_ORDER OO
  894. left join TMSTRUCK_TOTAL_RESULT TTR
  895. on TTR.ORDER_ID = OO.ORDER_ID
  896. left join TMSTRUCK_LOAD_RESULT TLR
  897. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  898. where OO.ORDER_ID = #{orderId}
  899. and TLR.MATERIAL_ID = #{materialId}
  900. </select>
  901. <!--通过运输订单号查找装车实绩id-->
  902. <select id="selectLoadResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.util.Map">
  903. SELECT TLR.RESULT_ID "loadResultId",
  904. TLR.RESULT_LOAD_START_TIME "startTime"
  905. FROM OMSTRUCK_ORDER OO
  906. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  907. ON OO.ORDER_ID = TTR.ORDER_ID
  908. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  909. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  910. WHERE OO.ORDER_NUMBER = #{orderNumber}
  911. </select>
  912. <!--内转物流查询汽车装车实绩 -->
  913. <select id="selectLoadResultForConverted" resultType="java.util.LinkedHashMap">
  914. select APO.PURCHASE_ORDER_NO "orderNo",
  915. TLR.INSERT_TIME "insertTime",
  916. RC.CAPACITY_NUMBER "capacityNumber",
  917. TLR.RESULT_MEASURED_TONNAGE "toggage",
  918. RAS.ARRIVAL_NAME "arrivelName",
  919. DB.RESULT_FOREIGN_SHIP_NAME "foreignShipName",
  920. OO.ORDER_NUMBER "orderNumber",
  921. RM.MATERIAL_NAME "materialName"
  922. from TMSTRUCK_LOAD_RESULT TLR
  923. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  924. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  925. LEFT JOIN OMSTRUCK_ORDER OO
  926. ON OO.ORDER_ID = TTR.ORDER_ID
  927. left join AMS_PURCHASE_ORDER APO
  928. ON oo.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
  929. LEFT JOIN DIL_BATCH DB
  930. ON DB.BATCH_ID = APO.BATCH_ID
  931. LEFT JOIN RMS_MATERIAL RM
  932. ON RM.MATERIAL_ID = TLR.MATERIAL_ID
  933. LEFT JOIN RMS_CAPACITY RC
  934. ON OO.CAPACITY_ID = RC.CAPACITY_ID
  935. LEFT JOIN TMSTRAIN_LOADING_RESULT TLR2
  936. ON TLR2.PURCHASE_ORDER_RAIL_PLAN_ID = OO.ORDER_PLAN_ID
  937. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
  938. ON RAS.ARRIVAL_ID = TLR.LOADING_ID
  939. </select>
  940. <!-- 根据实绩id渲染数据 -->
  941. <select id="selectLoadResultByResultId" resultType="java.lang.Integer">
  942. SELECT TLR.LOADING_ID "loadingId",
  943. TLR.MATERIAL_ID "materialId",
  944. TLR.RESULT_TOTAL_ID "totalId"
  945. FROM TMSTRUCK_LOAD_RESULT TLR
  946. WHERE TLR.RESULT_ID = #{resultId}
  947. </select>
  948. <!--通过车牌号号查找物资id和运力id以及总实绩id-->
  949. <select id="selectMaterialIdAndCapacityId" resultType="java.util.Map" parameterType="java.lang.Integer">
  950. select OOM.MATERIAL_ID "materialId",
  951. OO.CAPACITY_ID "capacityId",
  952. TTR.RESULT_TOTAL_ID "resultTotalId"
  953. from TMSTRUCK_TOTAL_RESULT TTR
  954. left join OMSTRUCK_ORDER OO
  955. on OO.ORDER_ID = TTR.ORDER_ID
  956. left join OMSTRUCK_ORDER_MATERIAL OOM
  957. on OOM.ORDER_ID = OO.ORDER_ID
  958. LEFT JOIN RMS_CAPACITY RC
  959. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  960. where RC.CAPACITY_NUMBER = #{capacityNumber}
  961. </select>
  962. <!--根据id查找用户名 -->
  963. <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
  964. select RP.PERSONNEL_NAME "personnelName"
  965. from RMS_PERSONNEL RP
  966. where RP.PERSONNEL_ID = #{personnelId}
  967. </select>
  968. <select id="selectMaterialTypeByMaterialId" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  969. select RMT.MATERIAL_TYPE_ID "materialTypeId"
  970. FROM RMS_MATERIAL RM
  971. LEFT JOIN RMS_MATERIAL_TYPE RMT
  972. ON RMT.MATERIAL_TYPE_ID = RM.MATERIAL_TYPE_ID
  973. where RM.MATERIAL_ID = #{materialId}
  974. </select>
  975. <!-- 查询销售装车实绩 -->
  976. <select id="getXSLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  977. SELECT *
  978. FROM (
  979. SELECT OO.ORDER_NUMBER "orderNumber",
  980. RC.CAPACITY_NUMBER "capacityNumber",
  981. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  982. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  983. TLR.RESULT_LOAD_DURATION "resultLoadDuration",
  984. RP.PERSONNEL_NAME "personnelName",
  985. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  986. RM.MATERIAL_NAME "materialName",
  987. ASO.SALE_NUMBER "no",
  988. (CASE WHEN OOM.ORDER_MATERIAL_NUMBER is not null
  989. THEN OOM.ORDER_MATERIAL_NUMBER
  990. ELSE OOM.ORDER_MATERIAL_WEIGHT
  991. END) "materialNumWei",
  992. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
  993. TLR.CASE_NUMBER "caseNumber"
  994. FROM TMSTRUCK_LOAD_RESULT TLR
  995. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  996. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  997. LEFT JOIN OMSTRUCK_ORDER OO
  998. ON OO.ORDER_ID = TTR.ORDER_ID
  999. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1000. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  1001. LEFT JOIN AMS_SALE_ORDER ASO
  1002. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1003. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1004. ON OOM.ORDER_ID = OO.ORDER_ID
  1005. LEFT JOIN RMS_MATERIAL RM
  1006. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1007. LEFT JOIN RMS_CAPACITY RC
  1008. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1009. LEFT JOIN RMS_PERSONNEL RP
  1010. ON TLR.LOADER_ID = RP.PERSONNEL_ID
  1011. where
  1012. OO.ORDER_TYPE in (1, 2, 3)
  1013. and TLR.STATUS = #{status}
  1014. )
  1015. <where>
  1016. <if test="orderNumber != null">
  1017. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1018. "orderNumber" like '%${item}%'
  1019. </foreach>
  1020. </if>
  1021. <if test="materialName != null">
  1022. and
  1023. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1024. "materialName" like '%${item}%'
  1025. </foreach>
  1026. </if>
  1027. <if test="no != null">
  1028. and
  1029. <foreach collection="no" item="item" open="(" separator="or" close=")">
  1030. "no" like '%${item}%'
  1031. </foreach>
  1032. </if>
  1033. <if test="materialNumWei != null">
  1034. and
  1035. <foreach collection="materialNumWei" item="item" open="(" separator="or" close=")">
  1036. "materialNumWei" like '%${item}%'
  1037. </foreach>
  1038. </if>
  1039. <if test="materialTheoreticalWeight != null">
  1040. and
  1041. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1042. "materialTheoreticalWeight" like '%${item}%'
  1043. </foreach>
  1044. </if>
  1045. <if test="capacityNumber != null">
  1046. and
  1047. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1048. "capacityNumber" like '%${item}%'
  1049. </foreach>
  1050. </if>
  1051. <if test="resultLoadStartTime != null">
  1052. and
  1053. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1054. "resultLoadStartTime" like '%${item}%'
  1055. </foreach>
  1056. </if>
  1057. <if test="resultLoadEndTime != null">
  1058. and
  1059. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1060. "resultLoadEndTime" like '%${item}%'
  1061. </foreach>
  1062. </if>
  1063. <if test="resultLoadDuration != null">
  1064. and
  1065. <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
  1066. "resultLoadDuration" like '%${item}%'
  1067. </foreach>
  1068. </if>
  1069. <if test="standardDataMax != null">
  1070. and
  1071. <foreach collection="standardDataMax" item="item" open="(" separator="or" close=")">
  1072. "standardDataMax" like '%${item}%'
  1073. </foreach>
  1074. </if>
  1075. <if test="personnelName != null">
  1076. and
  1077. <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
  1078. "personnelName" like '%${item}%'
  1079. </foreach>
  1080. </if>
  1081. </where>
  1082. <include refid="orderBy"></include>
  1083. <if test="orderField == null ">
  1084. order by "resultLoadStartTime" desc
  1085. </if>
  1086. </select>
  1087. <!-- 通过港口ID获取仓库ID -->
  1088. <select id="getWarehouseIdByPortId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  1089. select RW.WAREHOUSE_ID
  1090. from RMS_WAREHOUSE RW
  1091. where RW.WAREHOUSE_TYPE_ID = 4 and RW.PORT_ID = #{portId}
  1092. </select>
  1093. <!-- 通过物资ID和总实绩Id查询唯一的装车实绩Id -->
  1094. <select id="getLoadResultIdByMIdAndTotalId" parameterType="int" resultType="java.util.Map">
  1095. select TLR.RESULT_ID "resultId",
  1096. TLR.SEGMENT_SQE "segmentSqe"
  1097. from TMSTRUCK_LOAD_RESULT TLR
  1098. <where>
  1099. TLR.RESULT_TOTAL_ID = #{resultTotalId}
  1100. <if test="materialId != null">
  1101. and TLR.MATERIAL_ID = #{materialId}
  1102. </if>
  1103. </where>
  1104. </select>
  1105. <!-- 通过物资唯一编码 查找物资ID -->
  1106. <select id="getMaterialIdByMaterialCode" parameterType="string" resultType="java.math.BigDecimal">
  1107. select MATERIAL_ID
  1108. from RMS_MATERIAL_STEEL
  1109. where MATERIAL_ONLY_CODE = #{materialOnlyCode}
  1110. </select>
  1111. <!-- 查询所有正在进行进厂排队的销售订单 -->
  1112. <select id="getSaleOrderOnQueue" parameterType="java.util.Map" resultType="java.util.Map">
  1113. select *
  1114. from (
  1115. select OO.ORDER_ID "orderId",
  1116. OO.ORDER_NUMBER "orderNumber",
  1117. ASO.SALE_NUMBER "saleNumber",
  1118. RC.CAPACITY_NUMBER "capacityNumber",
  1119. OO.ORDER_ISSUE_TIME "orderIssueTime"
  1120. from OMSTRUCK_ORDER OO
  1121. left join AMS_SALE_ORDER_MATERIAL ASOM
  1122. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  1123. left join AMS_SALE_ORDER ASO
  1124. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1125. left join RMS_CAPACITY RC
  1126. on OO.CAPACITY_ID = RC.CAPACITY_ID
  1127. where OO.ORDER_ID in (select OO.ORDER_ID
  1128. from QMS_QUEUE_RESULT QQR
  1129. left join TMSTRUCK_TOTAL_RESULT TTR
  1130. on TTR.RESULT_TOTAL_ID = QQR.RESULT_TOTAL_ID
  1131. left join OMSTRUCK_ORDER OO
  1132. on OO.ORDER_ID = TTR.ORDER_ID
  1133. where QQR.RESULT_START_TIME is not null
  1134. and QQR.RESULT_END_TIME is null
  1135. and OO.ORDER_TYPE = 1)
  1136. )
  1137. <where>
  1138. <if test="orderNumber != null">
  1139. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1140. "orderNumber" like '%${item}%'
  1141. </foreach>
  1142. </if>
  1143. <if test="saleNumber != null">
  1144. and
  1145. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1146. "saleNumber" like '%${item}%'
  1147. </foreach>
  1148. </if>
  1149. <if test="driverName != null">
  1150. and
  1151. <foreach collection="driverName" item="item" open="(" separator="or" close=")">
  1152. "driverName" like '%${item}%'
  1153. </foreach>
  1154. </if>
  1155. <if test="capacityNumber != null">
  1156. and
  1157. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1158. "capacityNumber" like '%${item}%'
  1159. </foreach>
  1160. </if>
  1161. </where>
  1162. <include refid="orderBy"></include>
  1163. <if test="orderField == null ">
  1164. order by "orderIssueTime" desc
  1165. </if>
  1166. </select>
  1167. <!-- 通过订单Id和物资Id确定唯一的装车实绩Id -->
  1168. <select id="getLoadIdByOrderIdAndMId" parameterType="java.util.Map" resultType="java.lang.Integer">
  1169. select TLR.RESULT_ID
  1170. from OMSTRUCK_ORDER OO
  1171. left join TMSTRUCK_TOTAL_RESULT TTR
  1172. on TTR.ORDER_ID = OO.ORDER_ID
  1173. left join TMSTRUCK_LOAD_RESULT TLR
  1174. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1175. where OO.ORDER_ID = #{orderId}
  1176. and TLR.MATERIAL_ID = #{materialId}
  1177. </select>
  1178. <!-- 查询内转钢材到异地库装车实绩 -->
  1179. <select id="getSteelNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  1180. SELECT *
  1181. FROM (
  1182. select TLR.RESULT_ID "resultId",
  1183. AROD.DAYPLAN_NO "dayplanNo",
  1184. OO.ORDER_NUMBER "orderNumber",
  1185. RC.CAPACITY_NUMBER "capacityNumber",
  1186. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  1187. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  1188. TLR.RESULT_LOAD_DURATION "resultLoadDuration",
  1189. RSD.STANDARD_DATA_MIN "standardDataMin",
  1190. RM.MATERIAL_NAME "materialName",
  1191. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  1192. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  1193. RP.PERSONNEL_NAME "personnelName"
  1194. from TMSTRUCK_LOAD_RESULT TLR
  1195. left join TMSTRUCK_TOTAL_RESULT TTR
  1196. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1197. LEFT JOIN OMSTRUCK_ORDER OO
  1198. ON OO.ORDER_ID = TTR.ORDER_ID
  1199. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  1200. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  1201. LEFT JOIN RMS_CAPACITY RC
  1202. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1203. LEFT JOIN RMS_PERSONNEL RP
  1204. ON RP.PERSONNEL_ID = TLR.LOADER_ID
  1205. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1206. ON OO.ORDER_ID = OOM.ORDER_ID AND OOM.MATERIAL_ID = TLR.MATERIAL_ID
  1207. LEFT JOIN RMS_MATERIAL RM
  1208. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1209. LEFT JOIN RMS_STANDARD_DATA RSD
  1210. ON RSD.STANDARD_DATA_ID = TLR.LOAD_STANDARD_TIME_ID
  1211. WHERE OO.ORDER_TYPE = 4
  1212. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1213. AND TLR.STATUS = 0
  1214. )
  1215. <where>
  1216. <if test="dayplanNo != null">
  1217. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  1218. "dayplanNo" like '%${item}%'
  1219. </foreach>
  1220. <if test="orderNumber != null">
  1221. and
  1222. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1223. "orderNumber" like '%${item}%'
  1224. </foreach>
  1225. </if>
  1226. <if test="capacityNumber != null">
  1227. and
  1228. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1229. "capacityNumber" like '%${item}%'
  1230. </foreach>
  1231. </if>
  1232. <if test="resultLoadStartTime != null">
  1233. and
  1234. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1235. "resultLoadStartTime" like '%${item}%'
  1236. </foreach>
  1237. </if>
  1238. <if test="resultLoadEndTime != null">
  1239. and
  1240. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1241. "resultLoadEndTime" like '%${item}%'
  1242. </foreach>
  1243. </if>
  1244. <if test="resultLoadDuration != null">
  1245. and
  1246. <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
  1247. "resultLoadDuration" like '%${item}%'
  1248. </foreach>
  1249. </if>
  1250. <if test="standardDataMin != null">
  1251. and
  1252. <foreach collection="standardDataMin" item="item" open="(" separator="or" close=")">
  1253. "standardDataMin" like '%${item}%'
  1254. </foreach>
  1255. </if>
  1256. <if test="materialName != null">
  1257. and
  1258. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1259. "materialName" like '%${item}%'
  1260. </foreach>
  1261. </if>
  1262. <if test="orderMaterialNumber != null">
  1263. and
  1264. <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
  1265. "orderMaterialNumber" like '%${item}%'
  1266. </foreach>
  1267. </if>
  1268. <if test="materialTheoreticalWeight != null">
  1269. and
  1270. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1271. "materialTheoreticalWeight" like '%${item}%'
  1272. </foreach>
  1273. </if>
  1274. <if test="personnelName != null">
  1275. and
  1276. <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
  1277. "personnelName" like '%${item}%'
  1278. </foreach>
  1279. </if>
  1280. </if>
  1281. </where>
  1282. <include refid="orderBy"></include>
  1283. <if test="orderField == null ">
  1284. order by "resultLoadStartTime" desc
  1285. </if>
  1286. </select>
  1287. <!-- 查询内转进口矿/国产矿装车实绩 -->
  1288. <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  1289. SELECT
  1290. *
  1291. FROM (
  1292. SELECT APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1293. RM.MATERIAL_NAME "materialName",
  1294. OO.ORDER_NUMBER "orderNumber",
  1295. RC.CAPACITY_NUMBER "capacityNumber",
  1296. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  1297. RW.WAREHOUSE_NAME "warehouseName",
  1298. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  1299. TLR.RESULT_LOAD_DURATION "loadDuration"
  1300. FROM TMSTRUCK_LOAD_RESULT TLR
  1301. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1302. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1303. LEFT JOIN OMSTRUCK_ORDER OO
  1304. ON OO.ORDER_ID = TTR.ORDER_ID
  1305. left join amstruck_inward_plan aip
  1306. on aip.plan_id = oo.order_plan_id
  1307. left join amstruck_requirement_plan arp
  1308. on arp.plan_id = aip.plan_id
  1309. left join amstruck_inward_requirement air
  1310. on air.requirement_id = arp.requirement_id
  1311. LEFT JOIN AMS_PURCHASE_ORDER APO
  1312. ON APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
  1313. LEFT JOIN DIL_BATCH DB
  1314. ON DB.BATCH_ID = APO.BATCH_ID
  1315. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1316. ON OOM.ORDER_ID = OO.ORDER_ID
  1317. LEFT JOIN RMS_MATERIAL RM
  1318. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1319. LEFT JOIN RMS_CAPACITY RC
  1320. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1321. LEFT JOIN RMS_WAREHOUSE RW
  1322. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1323. WHERE OO.ORDER_TYPE in (10,20)
  1324. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1325. <if test="userId !=null">
  1326. and AIR.INSERT_USERNAME = #{userId}
  1327. </if>
  1328. order by tlr.result_load_end_time
  1329. )
  1330. <where>
  1331. <if test="purchaseOrderNo != null">
  1332. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  1333. "purchaseOrderNo" like '%${item}%'
  1334. </foreach>
  1335. </if>
  1336. <if test="materialName != null">
  1337. and
  1338. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1339. "materialName" like '%${item}%'
  1340. </foreach>
  1341. </if>
  1342. <if test="orderNumber != null">
  1343. and
  1344. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1345. "orderNumber" like '%${item}%'
  1346. </foreach>
  1347. </if>
  1348. <if test="capacityNumber != null">
  1349. and
  1350. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1351. "capacityNumber" like '%${item}%'
  1352. </foreach>
  1353. </if>
  1354. <if test="resultLoadStartTime != null">
  1355. and
  1356. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1357. "resultLoadStartTime" like '%${item}%'
  1358. </foreach>
  1359. </if>
  1360. <if test="resultLoadEndTime != null">
  1361. and
  1362. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1363. "resultLoadEndTime" like '%${item}%'
  1364. </foreach>
  1365. </if>
  1366. <if test="warehouseName != null">
  1367. and
  1368. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1369. "warehouseName" like '%${item}%'
  1370. </foreach>
  1371. </if>
  1372. <if test="loadDuration != null">
  1373. and
  1374. <foreach collection="loadDuration" item="item" open="(" separator="or" close=")">
  1375. "loadDuration" like '%${item}%'
  1376. </foreach>
  1377. </if>
  1378. </where>
  1379. <include refid="orderBy"></include>
  1380. <if test="orderField == null ">
  1381. order by "resultLoadStartTime" desc
  1382. </if>
  1383. </select>
  1384. <!-- 查询内转厂内物资装车实绩 -->
  1385. <select id="getInFactoryLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  1386. SELECT *
  1387. FROM (
  1388. SELECT RM.MATERIAL_NAME "materialName",
  1389. OO.ORDER_NUMBER "orderNumber",
  1390. RC.CAPACITY_NUMBER "capacityNumber",
  1391. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  1392. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  1393. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  1394. TLR.RESULT_LOAD_DURATION "resultLoadDuration",
  1395. RW.WAREHOUSE_NAME "warehouseName"
  1396. FROM TMSTRUCK_LOAD_RESULT TLR
  1397. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1398. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1399. LEFT JOIN OMSTRUCK_ORDER OO
  1400. ON OO.ORDER_ID = TTR.ORDER_ID
  1401. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1402. ON OOM.ORDER_ID = OO.ORDER_ID
  1403. LEFT JOIN RMS_MATERIAL RM
  1404. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1405. LEFT JOIN RMS_CAPACITY RC
  1406. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1407. LEFT JOIN RMS_WAREHOUSE RW
  1408. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1409. WHERE OO.ORDER_TYPE = #{orderTypee}
  1410. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1411. )
  1412. <where>
  1413. <if test="resultLoadEndTime != null">
  1414. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1415. "resultLoadEndTime" like '%${item}%'
  1416. </foreach>
  1417. </if>
  1418. <if test="materialName != null">
  1419. and
  1420. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1421. "materialName" like '%${item}%'
  1422. </foreach>
  1423. </if>
  1424. <if test="resultLoadDuration != null">
  1425. and
  1426. <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
  1427. "resultLoadDuration" like '%${item}%'
  1428. </foreach>
  1429. </if>
  1430. <if test="orderNumber != null">
  1431. and
  1432. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1433. "orderNumber" like '%${item}%'
  1434. </foreach>
  1435. </if>
  1436. <if test="capacityNumber != null">
  1437. and
  1438. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1439. "capacityNumber" like '%${item}%'
  1440. </foreach>
  1441. </if>
  1442. <if test="orderMaterialWeight != null">
  1443. and
  1444. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1445. "orderMaterialWeight" like '%${item}%'
  1446. </foreach>
  1447. </if>
  1448. <if test="resultLoadStartTime != null">
  1449. and
  1450. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1451. "resultLoadStartTime" like '%${item}%'
  1452. </foreach>
  1453. </if>
  1454. <if test="warehouseName != null">
  1455. and
  1456. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1457. "warehouseName" like '%${item}%'
  1458. </foreach>
  1459. </if>
  1460. </where>
  1461. <include refid="orderBy"></include>
  1462. <if test="orderField == null ">
  1463. order by "resultLoadStartTime" desc
  1464. </if>
  1465. </select>
  1466. <select id="getResultId" resultType="java.math.BigDecimal" parameterType="DeCimal">
  1467. select tlr.result_id "resultId" from tmstruck_load_result tlr
  1468. where tlr.result_total_id=#{totalId}
  1469. </select>
  1470. <select id="getOrderType" resultType="java.lang.Integer">
  1471. select oo.order_type
  1472. from tmstruck_total_result ttr
  1473. left join omstruck_order oo
  1474. on oo.order_id = ttr.order_id
  1475. where ttr.result_total_id = #{totalId}
  1476. </select>
  1477. <!-- 根据订单id查询所有的零星物资出厂实绩-->
  1478. <select id="getSporadicSuppliesLoadResult" resultType="java.util.Map">
  1479. select *
  1480. from (
  1481. select distinct
  1482. TLR.RESULT_ID "resultId",
  1483. OO.ORDER_NUMBER "orderNumber",
  1484. RC.CAPACITY_NUMBER "capacityNumber",
  1485. TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
  1486. TLR.RESULT_ISCLEAR "resultIsclear",
  1487. to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
  1488. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1489. TLR.INSERT_TIME "insertTime",
  1490. RM.MATERIAL_NAME "materialName",
  1491. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1492. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1493. TWR.RESULT_NET_WEIGHT "netWeight"
  1494. from TMSTRUCK_LOAD_RESULT TLR
  1495. left join TMSTRUCK_TOTAL_RESULT TTR
  1496. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1497. left join TMSTRUCK_WEIGHT_RESULT TWR
  1498. on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1499. left join OMSTRUCK_ORDER OO
  1500. on TTR.ORDER_ID = OO.ORDER_ID
  1501. left join OMSTRUCK_ORDER_MATERIAL OOM
  1502. on OOM.ORDER_ID=OO.ORDER_ID
  1503. left join RMS_MATERIAL RM
  1504. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1505. left join AMSTRUCK_SPORADIC_ORDER ASO
  1506. on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  1507. left join RMS_CAPACITY RC
  1508. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1509. where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
  1510. and TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1511. <if test="userId!=null">
  1512. AND ASO.INSERT_USERNAME=#{userId}
  1513. </if>
  1514. <if test="userIds!=null">
  1515. and ASO.UPDATE_USERNAME = #{userIds}
  1516. </if>
  1517. )
  1518. <where>
  1519. <if test="orderNumber != null">
  1520. and
  1521. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1522. "orderNumber" like '%${item}%'
  1523. </foreach>
  1524. </if>
  1525. <if test="capacityNumber != null">
  1526. and
  1527. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1528. "capacityNumber" like '%${item}%'
  1529. </foreach>
  1530. </if>
  1531. <if test="resultIsclear != null">
  1532. and
  1533. <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
  1534. "resultIsclear" like '%${item}%'
  1535. </foreach>
  1536. </if>
  1537. <if test="resultLoadStartTime != null">
  1538. and
  1539. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1540. "resultLoadStartTime" like '%${item}%'
  1541. </foreach>
  1542. </if>
  1543. <if test="insertUpdateRemark != null">
  1544. and
  1545. <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
  1546. "insertUpdateRemark" like '%${item}%'
  1547. </foreach>
  1548. </if>
  1549. </where>
  1550. <include refid="orderBy"></include>
  1551. <if test="orderField == null ">
  1552. order by "resultLoadStartTime" desc
  1553. </if>
  1554. </select>
  1555. <!-- 获取采购内转装车实绩 -->
  1556. <select id="getCgNzLoadingResult" resultType="java.util.Map" parameterType="java.lang.Integer">
  1557. select *from ( select OO.ORDER_NUMBER "orderNumber",
  1558. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1559. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  1560. RW.WAREHOUSE_NAME "warehouseName",
  1561. RM.MATERIAL_NAME "materialName",
  1562. RC.CAPACITY_NUMBER "capacityNumber",
  1563. RW2.WAREHOUSE_NAME "warehouseName2",
  1564. OO.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1565. TTR.RESULT_TOTAL_ID "resultTotalId"
  1566. from OMSTRUCK_ORDER OO
  1567. left join RMS_CAPACITY RC
  1568. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1569. left join OMSTRUCK_ORDER_MATERIAL OOM
  1570. on OOM.ORDER_ID = OO.ORDER_ID
  1571. left join RMS_MATERIAL RM
  1572. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1573. left join RMS_WAREHOUSE RW
  1574. on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
  1575. left join TMSTRUCK_TOTAL_RESULT TTR
  1576. on TTR.ORDER_ID = OO.ORDER_ID
  1577. left join TMSTRUCK_LOAD_RESULT TLR
  1578. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1579. left join RMS_WAREHOUSE RW2
  1580. on RW2.WAREHOUSE_ID = TLR.LOADING_ID
  1581. where OO.ORDER_STATUS = #{orderStatus}
  1582. and TLR.RESULT_LOAD_END_TIME IS NULL
  1583. and OO.ORDER_TYPE = #{orderType})
  1584. </select>
  1585. <select id="getInsertUpdateRemark" resultType="java.util.Map" parameterType="java.util.Map">
  1586. select OO.LINE_ID "lineId",
  1587. OO.ORDER_ID "orderId"
  1588. from OMSTRUCK_ORDER OO
  1589. left join TMSTRUCK_TOTAL_RESULT TTR
  1590. on TTR.ORDER_ID=OO.ORDER_ID
  1591. left join TMSTRUCK_LOAD_RESULT TLR
  1592. on TTR.RESULT_TOTAL_ID=TLR.RESULT_TOTAL_ID
  1593. where TTR.RESULT_TOTAL_ID=#{resultTotalId}
  1594. </select>
  1595. <select id="allOutFactoryNum" resultType="int" parameterType="java.math.BigDecimal">
  1596. select TLFR.RESULT_ID
  1597. from OMSTRUCK_ORDER OO
  1598. left join TMSTRUCK_TOTAL_RESULT TTR on TTR.ORDER_ID = OO.ORDER_ID
  1599. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1600. where OO.ORDER_ID = #{orderId}
  1601. and TLFR.RESULT_OUT_GATE_TIME is null
  1602. order by TLFR.SEGMENT_SQE
  1603. </select>
  1604. <update id="updateSqe" parameterType="java.util.Map">
  1605. update OMSTRUCK_ORDER OO
  1606. set OO.ORDER_LINE_SEQUENCE =
  1607. (
  1608. select MAX(RLS.SEGMENT_SQE)
  1609. from OMSTRUCK_ORDER OO
  1610. left join RMS_LINE RL
  1611. on OO.LINE_ID = RL.LINE_ID
  1612. left join RMS_LINE_SEGEMNT RLS
  1613. on RL.LINE_ID = RLS.LINE_ID
  1614. where OO.ORDER_ID = #{orderId}
  1615. ) - 1
  1616. where OO.ORDER_ID = #{orderId}
  1617. </update>
  1618. </mapper>