TmstruckLoadResultMapper.xml 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815
  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,23,24)
  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
  1444. distinct RM.MATERIAL_NAME "materialName",
  1445. OO.ORDER_NUMBER "orderNumber",
  1446. RC.CAPACITY_NUMBER "capacityNumber",
  1447. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  1448. TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
  1449. TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
  1450. TLR.RESULT_LOAD_DURATION "resultLoadDuration",
  1451. RW.WAREHOUSE_NAME "warehouseName",
  1452. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  1453. RC.CAPACITY_NUMBER || RM.MATERIAL_NAME || RW.WAREHOUSE_NAME "likeCon"
  1454. FROM TMSTRUCK_LOAD_RESULT TLR
  1455. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1456. ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1457. LEFT JOIN OMSTRUCK_ORDER OO
  1458. ON OO.ORDER_ID = TTR.ORDER_ID
  1459. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1460. ON OOM.ORDER_ID = OO.ORDER_ID
  1461. LEFT JOIN RMS_MATERIAL RM
  1462. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  1463. LEFT JOIN RMS_CAPACITY RC
  1464. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  1465. LEFT JOIN RMS_WAREHOUSE RW
  1466. ON RW.WAREHOUSE_ID = TLR.LOADING_ID
  1467. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1468. ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1469. WHERE OO.ORDER_TYPE = #{orderTypee}
  1470. AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1471. <if test="oneDate != null">
  1472. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1473. </if>
  1474. <if test="startDate != null">
  1475. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
  1476. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
  1477. </if>
  1478. )
  1479. <where>
  1480. <if test="con != null">
  1481. and "likeCon" like #{con}
  1482. </if>
  1483. <if test="resultLoadEndTime != null">
  1484. and <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1485. "resultLoadEndTime" like '%${item}%'
  1486. </foreach>
  1487. </if>
  1488. <if test="materialName != null">
  1489. and
  1490. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1491. "materialName" like '%${item}%'
  1492. </foreach>
  1493. </if>
  1494. <if test="resultLoadDuration != null">
  1495. and
  1496. <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
  1497. "resultLoadDuration" like '%${item}%'
  1498. </foreach>
  1499. </if>
  1500. <if test="orderNumber != null">
  1501. and
  1502. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1503. "orderNumber" like '%${item}%'
  1504. </foreach>
  1505. </if>
  1506. <if test="capacityNumber != null">
  1507. and
  1508. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1509. "capacityNumber" like '%${item}%'
  1510. </foreach>
  1511. </if>
  1512. <if test="orderMaterialWeight != null">
  1513. and
  1514. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1515. "orderMaterialWeight" like '%${item}%'
  1516. </foreach>
  1517. </if>
  1518. <if test="resultLoadStartTime != null">
  1519. and
  1520. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1521. to_char("resultLoadStartTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1522. </foreach>
  1523. </if>
  1524. <if test="resultLoadEndTime != null">
  1525. and
  1526. <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
  1527. to_char("resultLoadEndTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  1528. </foreach>
  1529. </if>
  1530. <if test="warehouseName != null">
  1531. and
  1532. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1533. "warehouseName" like '%${item}%'
  1534. </foreach>
  1535. </if>
  1536. <if test="resultNetWeight != null">
  1537. and
  1538. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  1539. "resultNetWeight" like '%${item}%'
  1540. </foreach>
  1541. </if>
  1542. </where>
  1543. <include refid="orderBy"></include>
  1544. <if test="orderField == null ">
  1545. order by "resultLoadStartTime" desc
  1546. </if>
  1547. </select>
  1548. <select id="getResultId" resultType="java.math.BigDecimal" parameterType="DeCimal">
  1549. select tlr.result_id "resultId" from tmstruck_load_result tlr
  1550. where tlr.result_total_id=#{totalId}
  1551. </select>
  1552. <select id="getOrderType" resultType="java.lang.Integer">
  1553. select oo.order_type
  1554. from tmstruck_total_result ttr
  1555. left join omstruck_order oo
  1556. on oo.order_id = ttr.order_id
  1557. where ttr.result_total_id = #{totalId}
  1558. </select>
  1559. <!-- 根据订单id查询所有的零星物资出厂实绩-->
  1560. <select id="getSporadicSuppliesLoadResult" resultType="java.util.Map">
  1561. select *
  1562. from (
  1563. select distinct
  1564. TLR.RESULT_ID "resultId",
  1565. OO.ORDER_NUMBER "orderNumber",
  1566. RC.CAPACITY_NUMBER "capacityNumber",
  1567. TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
  1568. TLR.RESULT_ISCLEAR "resultIsclear",
  1569. to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
  1570. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1571. TLR.INSERT_TIME "insertTime",
  1572. RM.MATERIAL_NAME "materialName",
  1573. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1574. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1575. TWR.RESULT_NET_WEIGHT "netWeight"
  1576. from TMSTRUCK_LOAD_RESULT TLR
  1577. left join TMSTRUCK_TOTAL_RESULT TTR
  1578. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1579. left join TMSTRUCK_WEIGHT_RESULT TWR
  1580. on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1581. left join OMSTRUCK_ORDER OO
  1582. on TTR.ORDER_ID = OO.ORDER_ID
  1583. left join OMSTRUCK_ORDER_MATERIAL OOM
  1584. on OOM.ORDER_ID=OO.ORDER_ID
  1585. left join RMS_MATERIAL RM
  1586. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1587. left join AMSTRUCK_SPORADIC_ORDER ASO
  1588. on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  1589. left join RMS_CAPACITY RC
  1590. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1591. where TLR.STATUS = #{status}
  1592. and TLR.RESULT_LOAD_START_TIME IS NOT NULL
  1593. <if test="orderTypee != 100">
  1594. AND OO.ORDER_TYPE = #{orderTypee}
  1595. </if>
  1596. <if test="orderTypee == 100">
  1597. AND OO.ORDER_TYPE in (12, 13 ,14,19)
  1598. </if>
  1599. <if test="userId!=null">
  1600. AND ASO.INSERT_USERNAME=#{userId}
  1601. </if>
  1602. <if test="userIds!=null">
  1603. and ASO.UPDATE_USERNAME = #{userIds}
  1604. </if>
  1605. )
  1606. <where>
  1607. <if test="orderNumber != null">
  1608. and
  1609. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1610. "orderNumber" like '%${item}%'
  1611. </foreach>
  1612. </if>
  1613. <if test="capacityNumber != null">
  1614. and
  1615. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1616. "capacityNumber" like '%${item}%'
  1617. </foreach>
  1618. </if>
  1619. <if test="resultIsclear != null">
  1620. and
  1621. <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
  1622. "resultIsclear" like '%${item}%'
  1623. </foreach>
  1624. </if>
  1625. <if test="resultLoadStartTime != null">
  1626. and
  1627. <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
  1628. "resultLoadStartTime" like '%${item}%'
  1629. </foreach>
  1630. </if>
  1631. <if test="insertUpdateRemark != null">
  1632. and
  1633. <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
  1634. "insertUpdateRemark" like '%${item}%'
  1635. </foreach>
  1636. </if>
  1637. </where>
  1638. <include refid="orderBy"></include>
  1639. <if test="orderField == null ">
  1640. order by "resultLoadStartTime" desc
  1641. </if>
  1642. </select>
  1643. <!-- 获取采购内转装车实绩 -->
  1644. <select id="getCgNzLoadingResult" resultType="java.util.Map" parameterType="java.lang.Integer">
  1645. select *from ( select OO.ORDER_NUMBER "orderNumber",
  1646. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1647. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  1648. RW.WAREHOUSE_NAME "warehouseName",
  1649. RM.MATERIAL_NAME "materialName",
  1650. RC.CAPACITY_NUMBER "capacityNumber",
  1651. RW2.WAREHOUSE_NAME "warehouseName2",
  1652. OO.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1653. TTR.RESULT_TOTAL_ID "resultTotalId"
  1654. from OMSTRUCK_ORDER OO
  1655. left join RMS_CAPACITY RC
  1656. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1657. left join OMSTRUCK_ORDER_MATERIAL OOM
  1658. on OOM.ORDER_ID = OO.ORDER_ID
  1659. left join RMS_MATERIAL RM
  1660. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1661. left join RMS_WAREHOUSE RW
  1662. on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
  1663. left join TMSTRUCK_TOTAL_RESULT TTR
  1664. on TTR.ORDER_ID = OO.ORDER_ID
  1665. left join TMSTRUCK_LOAD_RESULT TLR
  1666. on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1667. left join RMS_WAREHOUSE RW2
  1668. on RW2.WAREHOUSE_ID = TLR.LOADING_ID
  1669. where OO.ORDER_STATUS = #{orderStatus}
  1670. and TLR.RESULT_LOAD_END_TIME IS NULL
  1671. and OO.ORDER_TYPE = #{orderType})
  1672. </select>
  1673. <select id="getInsertUpdateRemark" resultType="java.util.Map" parameterType="java.util.Map">
  1674. select OO.LINE_ID "lineId",
  1675. OO.ORDER_ID "orderId"
  1676. from OMSTRUCK_ORDER OO
  1677. left join TMSTRUCK_TOTAL_RESULT TTR
  1678. on TTR.ORDER_ID=OO.ORDER_ID
  1679. left join TMSTRUCK_LOAD_RESULT TLR
  1680. on TTR.RESULT_TOTAL_ID=TLR.RESULT_TOTAL_ID
  1681. where TTR.RESULT_TOTAL_ID=#{resultTotalId}
  1682. </select>
  1683. <select id="allOutFactoryNum" resultType="int" parameterType="java.math.BigDecimal">
  1684. select TLFR.RESULT_ID
  1685. from OMSTRUCK_ORDER OO
  1686. left join TMSTRUCK_TOTAL_RESULT TTR on TTR.ORDER_ID = OO.ORDER_ID
  1687. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1688. where OO.ORDER_ID = #{orderId}
  1689. and TLFR.RESULT_OUT_GATE_TIME is null
  1690. order by TLFR.SEGMENT_SQE
  1691. </select>
  1692. <select id="allOutFactoryJudge" resultType="int" parameterType="java.math.BigDecimal">
  1693. select TLFR.RESULT_ID
  1694. from OMSTRUCK_ORDER OO
  1695. left join TMSTRUCK_TOTAL_RESULT TTR on TTR.ORDER_ID = OO.ORDER_ID
  1696. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1697. where OO.ORDER_ID = #{orderId}
  1698. and TLFR.RESULT_OUT_GATE_TIME is not null
  1699. and TLFR.RESULT_OUT_MODE = '未装货出厂'
  1700. order by TLFR.SEGMENT_SQE
  1701. </select>
  1702. <update id="updateLoadSeq">
  1703. UPDATE OMSTRUCK_ORDER
  1704. SET ORDER_LINE_SEQUENCE =
  1705. (
  1706. SELECT
  1707. TLR.SEGMENT_SQE
  1708. FROM TMSTRUCK_LOAD_RESULT TLR
  1709. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1710. WHERE TTR.ORDER_ID = #{orderId}
  1711. ORDER BY SEGMENT_SQE
  1712. FETCH NEXT 1 ROWS ONLY
  1713. )
  1714. WHERE ORDER_ID = #{orderId}
  1715. </update>
  1716. <update id="updateSqe" parameterType="java.util.Map">
  1717. update OMSTRUCK_ORDER OO
  1718. set OO.ORDER_LINE_SEQUENCE =
  1719. (
  1720. select MAX(RLS.SEGMENT_SQE)
  1721. from OMSTRUCK_ORDER OO
  1722. left join RMS_LINE RL
  1723. on OO.LINE_ID = RL.LINE_ID
  1724. left join RMS_LINE_SEGEMNT RLS
  1725. on RL.LINE_ID = RLS.LINE_ID
  1726. where OO.ORDER_ID = #{orderId}
  1727. ) - 1
  1728. where OO.ORDER_ID = #{orderId}
  1729. </update>
  1730. <select id="checkMaterialIdLoad" resultType="java.lang.Integer">
  1731. select TLR.RESULT_ID
  1732. from TMSTRUCK_LOAD_RESULT TLR
  1733. where TLR.RESULT_TOTAL_ID = #{resultTotalId}
  1734. and TLR.MATERIAL_ID = #{materialId}
  1735. </select>
  1736. <select id="getSteelLoadResult" parameterType="java.math.BigDecimal" resultType="java.util.Map">
  1737. SELECT *
  1738. FROM (
  1739. SELECT OO.ORDER_ID "orderId",
  1740. OO.ORDER_TYPE "orderType",
  1741. TTR.RESULT_TOTAL_ID "resultTotalId",
  1742. TLR.RESULT_ID "resultId",
  1743. TLR.SEGMENT_SQE "segmentSqe",
  1744. RC.CAPACITY_NUMBER "capacityNumber"
  1745. FROM OMSTRUCK_ORDER OO
  1746. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON OO.ORDER_ID = TTR.ORDER_ID
  1747. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
  1748. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
  1749. WHERE TLR.RESULT_LOAD_END_TIME IS NULL
  1750. <if test="orderId != null">
  1751. AND OO.ORDER_ID = #{orderId}
  1752. </if>
  1753. <if test="orderNumber != null">
  1754. AND OO.ORDER_NUMBER = #{orderNumber}
  1755. </if>
  1756. ORDER BY TLR.SEGMENT_SQE
  1757. )
  1758. WHERE ROWNUM = 1
  1759. </select>
  1760. <select id="getLoadResultMap" resultType="java.util.Map" parameterType="decimal">
  1761. select TLR.RESULT_LOAD_END_TIME "loadEndTime" from TMSTRUCK_LOAD_RESULT TLR
  1762. WHERE TLR.RESULT_TOTAL_ID = #{resultTotalId}
  1763. </select>
  1764. <select id="countJudgeLeave" resultType="java.lang.Integer">
  1765. SELECT
  1766. COUNT(TLFR.RESULT_ID)
  1767. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1768. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1769. WHERE TLFR.RESULT_OUT_MODE = '未装货出厂' AND TTR.ORDER_ID = #{orderId}
  1770. </select>
  1771. </mapper>