TmstruckLoadResultMapper.xml 71 KB

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