OmstruckOrderMapper.xml 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306
  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.OmstruckOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.OmstruckOrder">
  5. <id column="ORDER_ID" jdbcType="DECIMAL" property="orderId"/>
  6. <result column="ORDER_PLAN_ID" jdbcType="DECIMAL" property="orderPlanId"/>
  7. <result column="ORDER_NUMBER" jdbcType="VARCHAR" property="orderNumber"/>
  8. <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId"/>
  9. <result column="ORDER_ISSUE_TIME" jdbcType="TIMESTAMP" property="orderIssueTime"/>
  10. <result column="ORDER_RECEIVE_STATUS" jdbcType="DECIMAL" property="orderReceiveStatus"/>
  11. <result column="ORDER_RECEIVE_REFUSE_TIME" jdbcType="TIMESTAMP" property="orderReceiveRefuseTime"/>
  12. <result column="ORDER_COMMUNICATION_DURATION" jdbcType="DECIMAL" property="orderCommunicationDuration"/>
  13. <result column="ORDER_STATUS" jdbcType="DECIMAL" property="orderStatus"/>
  14. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
  15. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
  16. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
  17. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
  18. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
  19. <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
  20. <result column="ORDER_TYPE" jdbcType="DECIMAL" property="orderType"/>
  21. <result column="ORDER_LINE_SEQUENCE" jdbcType="DECIMAL" property="orderLineSequence"/>
  22. <result column="LINE_ID" jdbcType="DECIMAL" property="lineId"/>
  23. <result column="ORDER_ENTRY_TIME" jdbcType="TIMESTAMP" property="orderEntryTime"/>
  24. <result column="DRIVER_CAPACITY_ID" jdbcType="DECIMAL" property="driverCapacityId"/>
  25. <result column="UNLOAD_POINT_ID" jdbcType="DECIMAL" property="unloadPointId"/>
  26. </resultMap>
  27. <sql id="columns">
  28. ORDER_ID, ORDER_PLAN_ID, ORDER_NUMBER, CAPACITY_ID, ORDER_ISSUE_TIME, ORDER_RECEIVE_STATUS,
  29. ORDER_RECEIVE_REFUSE_TIME, ORDER_COMMUNICATION_DURATION, ORDER_STATUS, INSERT_USERNAME,
  30. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, ORDER_TYPE,
  31. ORDER_LINE_SEQUENCE, LINE_ID, ORDER_ENTRY_TIME, DRIVER_CAPACITY_ID, UNLOAD_POINT_ID
  32. </sql>
  33. <sql id="columns_alias">
  34. t.ORDER_ID, t.ORDER_PLAN_ID, t.ORDER_NUMBER, t.CAPACITY_ID, t.ORDER_ISSUE_TIME, t.ORDER_RECEIVE_STATUS,
  35. t.ORDER_RECEIVE_REFUSE_TIME, t.ORDER_COMMUNICATION_DURATION, t.ORDER_STATUS, t.INSERT_USERNAME,
  36. t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED,
  37. t.ORDER_TYPE, t.ORDER_LINE_SEQUENCE, t.LINE_ID, t.ORDER_ENTRY_TIME, t.DRIVER_CAPACITY_ID,
  38. t.UNLOAD_POINT_ID
  39. </sql>
  40. <sql id="select">
  41. SELECT
  42. <include refid="columns"/>
  43. FROM OMSTRUCK_ORDER
  44. </sql>
  45. <sql id="select_alias">
  46. SELECT
  47. <include refid="columns_alias"/>
  48. FROM OMSTRUCK_ORDER t
  49. </sql>
  50. <sql id="where">
  51. <where>
  52. <if test="orderId != null">
  53. and ORDER_ID = #{orderId}
  54. </if>
  55. <if test="orderPlanId != null">
  56. and ORDER_PLAN_ID = #{orderPlanId}
  57. </if>
  58. <if test="orderNumber != null and orderNumber != ''">
  59. and ORDER_NUMBER = #{orderNumber}
  60. </if>
  61. <if test="capacityId != null">
  62. and CAPACITY_ID = #{capacityId}
  63. </if>
  64. <if test="orderIssueTime != null">
  65. and TO_CHAR(ORDER_ISSUE_TIME,'yyyy-MM-dd') = #{orderIssueTime}
  66. </if>
  67. <if test="orderReceiveStatus != null">
  68. and ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  69. </if>
  70. <if test="orderReceiveRefuseTime != null">
  71. and TO_CHAR(ORDER_RECEIVE_REFUSE_TIME,'yyyy-MM-dd') = #{orderReceiveRefuseTime}
  72. </if>
  73. <if test="orderCommunicationDuration != null">
  74. and ORDER_COMMUNICATION_DURATION = #{orderCommunicationDuration}
  75. </if>
  76. <if test="orderStatus != null">
  77. and ORDER_STATUS = #{orderStatus}
  78. </if>
  79. <if test="insertUsername != null and insertUsername != ''">
  80. and INSERT_USERNAME = #{insertUsername}
  81. </if>
  82. <if test="insertTime != null">
  83. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  84. </if>
  85. <if test="updateUsername != null and updateUsername != ''">
  86. and UPDATE_USERNAME = #{updateUsername}
  87. </if>
  88. <if test="updateTime != null">
  89. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  90. </if>
  91. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  92. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  93. </if>
  94. <if test="deleted != null">
  95. and DELETED = #{deleted}
  96. </if>
  97. <if test="orderType != null">
  98. and ORDER_TYPE = #{orderType}
  99. </if>
  100. <if test="orderLineSequence != null">
  101. and ORDER_LINE_SEQUENCE = #{orderLineSequence}
  102. </if>
  103. <if test="lineId != null">
  104. and LINE_ID = #{lineId}
  105. </if>
  106. <if test="orderEntryTime != null">
  107. and TO_CHAR(ORDER_ENTRY_TIME,'yyyy-MM-dd') = #{orderEntryTime}
  108. </if>
  109. <if test="driverCapacityId != null">
  110. and DRIVER_CAPACITY_ID = #{driverCapacityId}
  111. </if>
  112. <if test="unloadPointId != null">
  113. and UNLOAD_POINT_ID = #{unloadPointId}
  114. </if>
  115. </where>
  116. </sql>
  117. <sql id="whereLike">
  118. <where>
  119. <if test="orderId != null">
  120. and ORDER_ID = #{orderId}
  121. </if>
  122. <if test="orderPlanId != null">
  123. and ORDER_PLAN_ID = #{orderPlanId}
  124. </if>
  125. <if test="orderNumber != null and orderNumber != ''">
  126. and ORDER_NUMBER LIKE '%${orderNumber}%'
  127. </if>
  128. <if test="capacityId != null">
  129. and CAPACITY_ID = #{capacityId}
  130. </if>
  131. <if test="orderIssueTime != null">
  132. and TO_CHAR(ORDER_ISSUE_TIME,'yyyy-MM-dd') = #{orderIssueTime}
  133. </if>
  134. <if test="orderReceiveStatus != null">
  135. and ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  136. </if>
  137. <if test="orderReceiveRefuseTime != null">
  138. and TO_CHAR(ORDER_RECEIVE_REFUSE_TIME,'yyyy-MM-dd') = #{orderReceiveRefuseTime}
  139. </if>
  140. <if test="orderCommunicationDuration != null">
  141. and ORDER_COMMUNICATION_DURATION = #{orderCommunicationDuration}
  142. </if>
  143. <if test="orderStatus != null">
  144. and ORDER_STATUS = #{orderStatus}
  145. </if>
  146. <if test="insertUsername != null and insertUsername != ''">
  147. and INSERT_USERNAME LIKE '%${insertUsername}%'
  148. </if>
  149. <if test="insertTime != null">
  150. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  151. </if>
  152. <if test="updateUsername != null and updateUsername != ''">
  153. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  154. </if>
  155. <if test="updateTime != null">
  156. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  157. </if>
  158. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  159. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  160. </if>
  161. <if test="deleted != null">
  162. and DELETED = #{deleted}
  163. </if>
  164. <if test="orderType != null">
  165. and ORDER_TYPE = #{orderType}
  166. </if>
  167. <if test="orderLineSequence != null">
  168. and ORDER_LINE_SEQUENCE = #{orderLineSequence}
  169. </if>
  170. <if test="lineId != null">
  171. and LINE_ID = #{lineId}
  172. </if>
  173. <if test="orderEntryTime != null">
  174. and TO_CHAR(ORDER_ENTRY_TIME,'yyyy-MM-dd') = #{orderEntryTime}
  175. </if>
  176. <if test="driverCapacityId != null">
  177. and DRIVER_CAPACITY_ID = #{driverCapacityId}
  178. </if>
  179. <if test="unloadPointId != null">
  180. and UNLOAD_POINT_ID = #{unloadPointId}
  181. </if>
  182. </where>
  183. </sql>
  184. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  185. delete
  186. from OMSTRUCK_ORDER
  187. where ORDER_ID = #{orderId,jdbcType=DECIMAL}
  188. </delete>
  189. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  190. delete from OMSTRUCK_ORDER
  191. where 1!=1
  192. <if test="orderPlanId != null">
  193. or ORDER_PLAN_ID = #{orderPlanId}
  194. </if>
  195. <if test="orderNumber != null and orderNumber != ''">
  196. or ORDER_NUMBER = #{orderNumber}
  197. </if>
  198. <if test="capacityId != null">
  199. or CAPACITY_ID = #{capacityId}
  200. </if>
  201. <if test="orderIssueTime != null">
  202. or TO_CHAR(ORDER_ISSUE_TIME,'yyyy-MM-dd') = '#{orderIssueTime}'
  203. </if>
  204. <if test="orderReceiveStatus != null">
  205. or ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  206. </if>
  207. <if test="orderReceiveRefuseTime != null">
  208. or TO_CHAR(ORDER_RECEIVE_REFUSE_TIME,'yyyy-MM-dd') = '#{orderReceiveRefuseTime}'
  209. </if>
  210. <if test="orderCommunicationDuration != null">
  211. or ORDER_COMMUNICATION_DURATION = #{orderCommunicationDuration}
  212. </if>
  213. <if test="orderStatus != null">
  214. or ORDER_STATUS = #{orderStatus}
  215. </if>
  216. <if test="insertUsername != null and insertUsername != ''">
  217. or INSERT_USERNAME = #{insertUsername}
  218. </if>
  219. <if test="insertTime != null">
  220. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  221. </if>
  222. <if test="updateUsername != null and updateUsername != ''">
  223. or UPDATE_USERNAME = #{updateUsername}
  224. </if>
  225. <if test="updateTime != null">
  226. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  227. </if>
  228. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  229. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  230. </if>
  231. <if test="deleted != null">
  232. or DELETED = #{deleted}
  233. </if>
  234. <if test="orderType != null">
  235. or ORDER_TYPE = #{orderType}
  236. </if>
  237. <if test="orderLineSequence != null">
  238. or ORDER_LINE_SEQUENCE = #{orderLineSequence}
  239. </if>
  240. <if test="lineId != null">
  241. or LINE_ID = #{lineId}
  242. </if>
  243. <if test="orderEntryTime != null">
  244. or TO_CHAR(ORDER_ENTRY_TIME,'yyyy-MM-dd') = '#{orderEntryTime}'
  245. </if>
  246. <if test="driverCapacityId != null">
  247. or DRIVER_CAPACITY_ID = #{driverCapacityId}
  248. </if>
  249. <if test="unloadPointId != null">
  250. or UNLOAD_POINT_ID = #{unloadPointId}
  251. </if>
  252. </delete>
  253. <insert id="insert" parameterType="com.steerinfo.dil.model.OmstruckOrder">
  254. insert into OMSTRUCK_ORDER (ORDER_ID, ORDER_PLAN_ID, ORDER_NUMBER,
  255. CAPACITY_ID, ORDER_ISSUE_TIME, ORDER_RECEIVE_STATUS,
  256. ORDER_RECEIVE_REFUSE_TIME, ORDER_COMMUNICATION_DURATION,
  257. ORDER_STATUS, INSERT_USERNAME, INSERT_TIME,
  258. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  259. DELETED, ORDER_TYPE, ORDER_LINE_SEQUENCE,
  260. LINE_ID, ORDER_ENTRY_TIME, DRIVER_CAPACITY_ID,
  261. UNLOAD_POINT_ID)
  262. values (#{orderId,jdbcType=DECIMAL}, #{orderPlanId,jdbcType=DECIMAL}, #{orderNumber,jdbcType=VARCHAR},
  263. #{capacityId,jdbcType=DECIMAL}, #{orderIssueTime,jdbcType=TIMESTAMP},
  264. #{orderReceiveStatus,jdbcType=DECIMAL},
  265. #{orderReceiveRefuseTime,jdbcType=TIMESTAMP}, #{orderCommunicationDuration,jdbcType=DECIMAL},
  266. #{orderStatus,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  267. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  268. #{insertUpdateRemark,jdbcType=VARCHAR},
  269. #{deleted,jdbcType=DECIMAL}, #{orderType,jdbcType=DECIMAL}, #{orderLineSequence,jdbcType=DECIMAL},
  270. #{lineId,jdbcType=DECIMAL}, #{orderEntryTime,jdbcType=TIMESTAMP}, #{driverCapacityId,jdbcType=DECIMAL},
  271. #{unloadPointId,jdbcType=DECIMAL})
  272. </insert>
  273. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.OmstruckOrder">
  274. insert into OMSTRUCK_ORDER
  275. <trim prefix="(" suffix=")" suffixOverrides=",">
  276. <if test="orderId != null">
  277. ORDER_ID,
  278. </if>
  279. <if test="orderPlanId != null">
  280. ORDER_PLAN_ID,
  281. </if>
  282. <if test="orderNumber != null">
  283. ORDER_NUMBER,
  284. </if>
  285. <if test="capacityId != null">
  286. CAPACITY_ID,
  287. </if>
  288. <if test="orderIssueTime != null">
  289. ORDER_ISSUE_TIME,
  290. </if>
  291. <if test="orderReceiveStatus != null">
  292. ORDER_RECEIVE_STATUS,
  293. </if>
  294. <if test="orderReceiveRefuseTime != null">
  295. ORDER_RECEIVE_REFUSE_TIME,
  296. </if>
  297. <if test="orderCommunicationDuration != null">
  298. ORDER_COMMUNICATION_DURATION,
  299. </if>
  300. <if test="orderStatus != null">
  301. ORDER_STATUS,
  302. </if>
  303. <if test="insertUsername != null">
  304. INSERT_USERNAME,
  305. </if>
  306. <if test="insertTime != null">
  307. INSERT_TIME,
  308. </if>
  309. <if test="updateUsername != null">
  310. UPDATE_USERNAME,
  311. </if>
  312. <if test="updateTime != null">
  313. UPDATE_TIME,
  314. </if>
  315. <if test="insertUpdateRemark != null">
  316. INSERT_UPDATE_REMARK,
  317. </if>
  318. <if test="deleted != null">
  319. DELETED,
  320. </if>
  321. <if test="orderType != null">
  322. ORDER_TYPE,
  323. </if>
  324. <if test="orderLineSequence != null">
  325. ORDER_LINE_SEQUENCE,
  326. </if>
  327. <if test="lineId != null">
  328. LINE_ID,
  329. </if>
  330. <if test="orderEntryTime != null">
  331. ORDER_ENTRY_TIME,
  332. </if>
  333. <if test="driverCapacityId != null">
  334. DRIVER_CAPACITY_ID,
  335. </if>
  336. <if test="unloadPointId != null">
  337. UNLOAD_POINT_ID,
  338. </if>
  339. </trim>
  340. <trim prefix="values (" suffix=")" suffixOverrides=",">
  341. <if test="orderId != null">
  342. #{orderId,jdbcType=DECIMAL},
  343. </if>
  344. <if test="orderPlanId != null">
  345. #{orderPlanId,jdbcType=DECIMAL},
  346. </if>
  347. <if test="orderNumber != null">
  348. #{orderNumber,jdbcType=VARCHAR},
  349. </if>
  350. <if test="capacityId != null">
  351. #{capacityId,jdbcType=DECIMAL},
  352. </if>
  353. <if test="orderIssueTime != null">
  354. #{orderIssueTime,jdbcType=TIMESTAMP},
  355. </if>
  356. <if test="orderReceiveStatus != null">
  357. #{orderReceiveStatus,jdbcType=DECIMAL},
  358. </if>
  359. <if test="orderReceiveRefuseTime != null">
  360. #{orderReceiveRefuseTime,jdbcType=TIMESTAMP},
  361. </if>
  362. <if test="orderCommunicationDuration != null">
  363. #{orderCommunicationDuration,jdbcType=DECIMAL},
  364. </if>
  365. <if test="orderStatus != null">
  366. #{orderStatus,jdbcType=DECIMAL},
  367. </if>
  368. <if test="insertUsername != null">
  369. #{insertUsername,jdbcType=VARCHAR},
  370. </if>
  371. <if test="insertTime != null">
  372. #{insertTime,jdbcType=TIMESTAMP},
  373. </if>
  374. <if test="updateUsername != null">
  375. #{updateUsername,jdbcType=VARCHAR},
  376. </if>
  377. <if test="updateTime != null">
  378. #{updateTime,jdbcType=TIMESTAMP},
  379. </if>
  380. <if test="insertUpdateRemark != null">
  381. #{insertUpdateRemark,jdbcType=VARCHAR},
  382. </if>
  383. <if test="deleted != null">
  384. #{deleted,jdbcType=DECIMAL},
  385. </if>
  386. <if test="orderType != null">
  387. #{orderType,jdbcType=DECIMAL},
  388. </if>
  389. <if test="orderLineSequence != null">
  390. #{orderLineSequence,jdbcType=DECIMAL},
  391. </if>
  392. <if test="lineId != null">
  393. #{lineId,jdbcType=DECIMAL},
  394. </if>
  395. <if test="orderEntryTime != null">
  396. #{orderEntryTime,jdbcType=TIMESTAMP},
  397. </if>
  398. <if test="driverCapacityId != null">
  399. #{driverCapacityId,jdbcType=DECIMAL},
  400. </if>
  401. <if test="unloadPointId != null">
  402. #{unloadPointId,jdbcType=DECIMAL},
  403. </if>
  404. </trim>
  405. </insert>
  406. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.OmstruckOrder">
  407. update OMSTRUCK_ORDER
  408. set ORDER_PLAN_ID = #{orderPlanId,jdbcType=DECIMAL},
  409. ORDER_NUMBER = #{orderNumber,jdbcType=VARCHAR},
  410. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  411. ORDER_ISSUE_TIME = #{orderIssueTime,jdbcType=TIMESTAMP},
  412. ORDER_RECEIVE_STATUS = #{orderReceiveStatus,jdbcType=DECIMAL},
  413. ORDER_RECEIVE_REFUSE_TIME = #{orderReceiveRefuseTime,jdbcType=TIMESTAMP},
  414. ORDER_COMMUNICATION_DURATION = #{orderCommunicationDuration,jdbcType=DECIMAL},
  415. ORDER_STATUS = #{orderStatus,jdbcType=DECIMAL},
  416. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  417. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  418. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  419. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  420. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  421. DELETED = #{deleted,jdbcType=DECIMAL},
  422. ORDER_TYPE = #{orderType,jdbcType=DECIMAL},
  423. ORDER_LINE_SEQUENCE = #{orderLineSequence,jdbcType=DECIMAL},
  424. LINE_ID = #{lineId,jdbcType=DECIMAL},
  425. ORDER_ENTRY_TIME = #{orderEntryTime,jdbcType=TIMESTAMP},
  426. DRIVER_CAPACITY_ID = #{driverCapacityId,jdbcType=DECIMAL},
  427. UNLOAD_POINT_ID = #{unloadPointId,jdbcType=DECIMAL}
  428. where ORDER_ID = #{orderId,jdbcType=DECIMAL}
  429. </update>
  430. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.OmstruckOrder">
  431. update OMSTRUCK_ORDER
  432. <set>
  433. <if test="orderPlanId != null">
  434. ORDER_PLAN_ID = #{orderPlanId,jdbcType=DECIMAL},
  435. </if>
  436. <if test="orderNumber != null">
  437. ORDER_NUMBER = #{orderNumber,jdbcType=VARCHAR},
  438. </if>
  439. <if test="capacityId != null">
  440. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  441. </if>
  442. <if test="orderIssueTime != null">
  443. ORDER_ISSUE_TIME = #{orderIssueTime,jdbcType=TIMESTAMP},
  444. </if>
  445. <if test="orderReceiveStatus != null">
  446. ORDER_RECEIVE_STATUS = #{orderReceiveStatus,jdbcType=DECIMAL},
  447. </if>
  448. <if test="orderReceiveRefuseTime != null">
  449. ORDER_RECEIVE_REFUSE_TIME = #{orderReceiveRefuseTime,jdbcType=TIMESTAMP},
  450. </if>
  451. <if test="orderCommunicationDuration != null">
  452. ORDER_COMMUNICATION_DURATION = #{orderCommunicationDuration,jdbcType=DECIMAL},
  453. </if>
  454. <if test="orderStatus != null">
  455. ORDER_STATUS = #{orderStatus,jdbcType=DECIMAL},
  456. </if>
  457. <if test="insertUsername != null">
  458. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  459. </if>
  460. <if test="insertTime != null">
  461. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  462. </if>
  463. <if test="updateUsername != null">
  464. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  465. </if>
  466. <if test="updateTime != null">
  467. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  468. </if>
  469. <if test="insertUpdateRemark != null">
  470. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  471. </if>
  472. <if test="deleted != null">
  473. DELETED = #{deleted,jdbcType=DECIMAL},
  474. </if>
  475. <if test="orderType != null">
  476. ORDER_TYPE = #{orderType,jdbcType=DECIMAL},
  477. </if>
  478. <if test="orderLineSequence != null">
  479. ORDER_LINE_SEQUENCE = #{orderLineSequence,jdbcType=DECIMAL},
  480. </if>
  481. <if test="lineId != null">
  482. LINE_ID = #{lineId,jdbcType=DECIMAL},
  483. </if>
  484. <if test="orderEntryTime != null">
  485. ORDER_ENTRY_TIME = #{orderEntryTime,jdbcType=TIMESTAMP},
  486. </if>
  487. <if test="driverCapacityId != null">
  488. DRIVER_CAPACITY_ID = #{driverCapacityId,jdbcType=DECIMAL},
  489. </if>
  490. <if test="unloadPointId != null">
  491. UNLOAD_POINT_ID = #{unloadPointId,jdbcType=DECIMAL},
  492. </if>
  493. </set>
  494. where ORDER_ID = #{orderId,jdbcType=DECIMAL}
  495. </update>
  496. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  497. <include refid="select"/>
  498. where ORDER_ID = #{orderId,jdbcType=DECIMAL}
  499. </select>
  500. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  501. <include refid="select"/>
  502. <include refid="where"/>
  503. </select>
  504. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  505. <include refid="select"/>
  506. <include refid="whereLike"/>
  507. </select>
  508. <insert id="batchInsert" parameterType="java.util.List">
  509. insert into OMSTRUCK_ORDER
  510. (ORDER_ID,
  511. ORDER_PLAN_ID, ORDER_NUMBER, CAPACITY_ID,
  512. ORDER_ISSUE_TIME, ORDER_RECEIVE_STATUS,
  513. ORDER_RECEIVE_REFUSE_TIME, ORDER_COMMUNICATION_DURATION,
  514. ORDER_STATUS, INSERT_USERNAME,
  515. INSERT_TIME, UPDATE_USERNAME,
  516. UPDATE_TIME, INSERT_UPDATE_REMARK,
  517. DELETED, ORDER_TYPE, ORDER_LINE_SEQUENCE,
  518. LINE_ID, ORDER_ENTRY_TIME, DRIVER_CAPACITY_ID,
  519. UNLOAD_POINT_ID)
  520. ( <foreach collection="list" item="item" separator="union all">
  521. select
  522. #{item.orderId,jdbcType=DECIMAL},
  523. #{item.orderPlanId,jdbcType=DECIMAL}, #{item.orderNumber,jdbcType=VARCHAR}, #{item.capacityId,jdbcType=DECIMAL},
  524. #{item.orderIssueTime,jdbcType=TIMESTAMP}, #{item.orderReceiveStatus,jdbcType=DECIMAL},
  525. #{item.orderReceiveRefuseTime,jdbcType=TIMESTAMP}, #{item.orderCommunicationDuration,jdbcType=DECIMAL},
  526. #{item.orderStatus,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  527. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  528. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  529. #{item.deleted,jdbcType=DECIMAL}, #{item.orderType,jdbcType=DECIMAL},
  530. #{item.orderLineSequence,jdbcType=DECIMAL},
  531. #{item.lineId,jdbcType=DECIMAL}, #{item.orderEntryTime,jdbcType=TIMESTAMP},
  532. #{item.driverCapacityId,jdbcType=DECIMAL},
  533. #{item.unloadPointId,jdbcType=DECIMAL} from dual
  534. </foreach> )
  535. </insert>
  536. <update id="batchUpdate" parameterType="java.util.List">
  537. update OMSTRUCK_ORDER
  538. set
  539. ORDER_ID=
  540. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  541. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
  542. </foreach>
  543. ,ORDER_PLAN_ID=
  544. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  545. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderPlanId,jdbcType=DECIMAL}
  546. </foreach>
  547. ,ORDER_NUMBER=
  548. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  549. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderNumber,jdbcType=VARCHAR}
  550. </foreach>
  551. ,CAPACITY_ID=
  552. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  553. when #{item.orderId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
  554. </foreach>
  555. ,ORDER_ISSUE_TIME=
  556. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  557. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderIssueTime,jdbcType=TIMESTAMP}
  558. </foreach>
  559. ,ORDER_RECEIVE_STATUS=
  560. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  561. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderReceiveStatus,jdbcType=DECIMAL}
  562. </foreach>
  563. ,ORDER_RECEIVE_REFUSE_TIME=
  564. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  565. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderReceiveRefuseTime,jdbcType=TIMESTAMP}
  566. </foreach>
  567. ,ORDER_COMMUNICATION_DURATION=
  568. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  569. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderCommunicationDuration,jdbcType=DECIMAL}
  570. </foreach>
  571. ,ORDER_STATUS=
  572. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  573. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderStatus,jdbcType=DECIMAL}
  574. </foreach>
  575. ,INSERT_USERNAME=
  576. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  577. when #{item.orderId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  578. </foreach>
  579. ,INSERT_TIME=
  580. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  581. when #{item.orderId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  582. </foreach>
  583. ,UPDATE_USERNAME=
  584. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  585. when #{item.orderId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  586. </foreach>
  587. ,UPDATE_TIME=
  588. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  589. when #{item.orderId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  590. </foreach>
  591. ,INSERT_UPDATE_REMARK=
  592. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  593. when #{item.orderId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  594. </foreach>
  595. ,DELETED=
  596. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  597. when #{item.orderId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  598. </foreach>
  599. ,ORDER_TYPE=
  600. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  601. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderType,jdbcType=DECIMAL}
  602. </foreach>
  603. ,ORDER_LINE_SEQUENCE=
  604. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  605. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderLineSequence,jdbcType=DECIMAL}
  606. </foreach>
  607. ,LINE_ID=
  608. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  609. when #{item.orderId,jdbcType=DECIMAL} then #{item.lineId,jdbcType=DECIMAL}
  610. </foreach>
  611. ,ORDER_ENTRY_TIME=
  612. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  613. when #{item.orderId,jdbcType=DECIMAL} then #{item.orderEntryTime,jdbcType=TIMESTAMP}
  614. </foreach>
  615. ,DRIVER_CAPACITY_ID=
  616. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  617. when #{item.orderId,jdbcType=DECIMAL} then #{item.driverCapacityId,jdbcType=DECIMAL}
  618. </foreach>
  619. ,UNLOAD_POINT_ID=
  620. <foreach collection="list" item="item" index="index" separator=" " open="case ORDER_ID" close="end">
  621. when #{item.orderId,jdbcType=DECIMAL} then #{item.unloadPointId,jdbcType=DECIMAL}
  622. </foreach>
  623. where ORDER_ID in
  624. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  625. #{item.orderId,jdbcType=DECIMAL}
  626. </foreach>
  627. </update>
  628. <delete id="batchDelete" parameterType="java.util.List">
  629. delete from OMSTRUCK_ORDER
  630. where ORDER_ID in
  631. <foreach collection="list" item="id" open="(" close=")" separator=",">
  632. #{id}
  633. </foreach>
  634. </delete>
  635. <!-- 友情提示!!!-->
  636. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  637. <!-- 根据插入时间排序 -->
  638. <sql id="orderBy">
  639. <if test="orderField != null and orderField != ''">
  640. order by "${orderField}"
  641. <if test="orderType != null and orderType != ''">
  642. ${orderType}
  643. </if>
  644. </if>
  645. </sql>
  646. <!-- 查询运输订单 -->
  647. <select id="getAllTruckOrder" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  648. select
  649. *
  650. from
  651. (
  652. select
  653. OO.ORDER_ID "orderId",
  654. APO.PURCHASE_ORDER_ID "purchaseOrderId",
  655. AP.PLAN_ID "planId",
  656. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  657. RM.MATERIAL_NAME "materialName",
  658. AP.PLAN_NO "planNo",
  659. RC.CAPACITY_NUMBER "capacityNumber",
  660. RC.CAPACITY_ID "capacityId",
  661. RCD.DRIVER_NAME "driverName",
  662. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  663. AP.PLAN_TRUCK_TIME "planTruckTime",
  664. AP.PLAN_INCOMING_TIME "planIncomingTime",
  665. OO.INSERT_USERNAME "insertUsername",
  666. OO.INSERT_TIME "insertTime",
  667. OO.ORDER_NUMBER "orderNumber",
  668. RW.WAREHOUSE_NAME "warehouseName",
  669. OO.ORDER_ENTRY_TIME "orderEntryTime",
  670. RS.SUPPLIER_NAME "supplierName",
  671. RCSE.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  672. from OMSTRUCK_ORDER OO
  673. left join AMS_PURCHASE_ORDER APO
  674. on OO.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
  675. left join AMSTRUCK_PURPLAN AP
  676. on AP.BATCH_ID = APO.BATCH_ID and AP.PLAN_STATUS != 3
  677. left join RMS_DRIVER_CAPACITY RDC
  678. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  679. left join RMS_CAPACITY RC
  680. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  681. left join RMS_CAR_DRIVER RCD
  682. on RCD.DRIVER_ID = RDC.DRIVER_ID
  683. left join OMSTRUCK_ORDER_MATERIAL OOM
  684. on OOM.ORDER_ID = OO.ORDER_ID
  685. left join RMS_MATERIAL RM
  686. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  687. left join RMS_WAREHOUSE RW
  688. on OO.UNLOAD_POINT_ID = RW.WAREHOUSE_ID
  689. left join RMS_SUPPLIER RS
  690. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  691. left join RMS_CONSIGNEE RCSE
  692. on APO.RECEIVE_UNIT_ID = RCSE.CONSIGNEE_ID
  693. <where>
  694. <choose>
  695. <when test="orderStatus != 8">
  696. and OO.ORDER_STATUS = #{orderStatus}
  697. </when>
  698. <otherwise>
  699. and OO.ORDER_STATUS in (1, 2, 4, 5, 6)
  700. </otherwise>
  701. </choose>
  702. <if test="planId != null ">
  703. and AP.PLAN_ID = #{planId}
  704. </if>
  705. <if test="orderType != null">
  706. and OO.ORDER_TYPE = #{orderType}
  707. </if>
  708. <if test="fuelOrder != null">
  709. and OO.ORDER_TYPE in (6, 7)
  710. </if>
  711. </where>
  712. )
  713. <where>
  714. <if test="materialName != null">
  715. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  716. "materialName" like '%${item}%'
  717. </foreach>
  718. </if>
  719. <if test="orderMaterialWeight != null">
  720. and
  721. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  722. "orderMaterialWeight" like '%${item}%'
  723. </foreach>
  724. </if>
  725. <if test="planNo != null">
  726. and
  727. <foreach collection="planNo" item="item" open="(" separator="or" close=")">
  728. "planNo" like '%${item}%'
  729. </foreach>
  730. </if>
  731. <if test="capacityNumber != null">
  732. and
  733. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  734. "capacityNumber" like '%${item}%'
  735. </foreach>
  736. </if>
  737. <if test="driverName != null">
  738. and
  739. <foreach collection="driverName" item="item" open="(" separator="or" close=")">
  740. "driverName" like '%${item}%'
  741. </foreach>
  742. </if>
  743. <if test="planTruckTime != null">
  744. and
  745. <foreach collection="planTruckTime" item="item" open="(" separator="or" close=")">
  746. "planTruckTime" like '%${item}%'
  747. </foreach>
  748. </if>
  749. <if test="planIncomingTime != null">
  750. and
  751. <foreach collection="planIncomingTime" item="item" open="(" separator="or" close=")">
  752. "planIncomingTime" like '%${item}%'
  753. </foreach>
  754. </if>
  755. <if test="insertUsername != null">
  756. and
  757. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  758. "insertUsername" like '%${item}%'
  759. </foreach>
  760. </if>
  761. <if test="insertTime != null">
  762. and
  763. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  764. "insertTime" like '%${item}%'
  765. </foreach>
  766. </if>
  767. <if test="warehouseName != null">
  768. and
  769. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  770. "warehouseName" like '%${item}%'
  771. </foreach>
  772. </if>
  773. <if test="orderNumber != null">
  774. and
  775. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  776. "orderNumber" like '%${item}%'
  777. </foreach>
  778. </if>
  779. <if test="orderEntryTime != null">
  780. and
  781. <foreach collection="orderEntryTime" item="item" open="(" separator="or" close=")">
  782. "orderEntryTime" like '%${item}%'
  783. </foreach>
  784. </if>
  785. <if test="supplierName != null">
  786. and
  787. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  788. "supplierName" like '%${item}%'
  789. </foreach>
  790. </if>
  791. <if test="consigneeCompanyName != null">
  792. and
  793. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  794. "consigneeCompanyName" like '%${item}%'
  795. </foreach>
  796. </if>
  797. </where>
  798. <include refid="orderBy">
  799. </include>
  800. <if test="orderField == null ">
  801. order by "insertTime" desc
  802. </if>
  803. </select>
  804. <!-- 通过运输订单Id查询运输订单号 -->
  805. <select id="getOrderNumberByOrderId" parameterType="int" resultType="string">
  806. select OO.ORDER_NUMBER "orderNumber"
  807. from OMSTRUCK_ORDER OO
  808. where OO.ORDER_ID = #{orderId}
  809. </select>
  810. <!-- 获取所有的运力信息 -->
  811. <select id="getAllCapacity" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  812. select
  813. *
  814. from
  815. (
  816. select
  817. RDC.DRIVER_CAPACITY_ID "driverCapacityId",
  818. RC.CAPACITY_NUMBER "capacityNumber",
  819. RCD.DRIVER_NAME "driverName",
  820. RC.CAPACITY_VIP "capacityVip",
  821. RCA.CARRIER_NAME "carrierName",
  822. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  823. RC.CAPACITY_BLACKLIST "capacityBlacklist",
  824. RDC.INSERT_TIME "insertTime"
  825. from RMS_DRIVER_CAPACITY RDC
  826. left join RMS_CAPACITY RC
  827. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  828. left join RMS_CARRIER RCA
  829. on RC.CARRIER_ID = RCA.CARRIER_ID
  830. left join RMS_CAR_DRIVER RCD
  831. on RCD.DRIVER_ID = RDC.DRIVER_ID
  832. left join RMS_CAPACITY_TYPE RCT
  833. on RCT.CAPACITY_TYPE_ID = RC.CAPACITY_TYPE_ID
  834. <where>
  835. <if test="capacityTypeId != null">
  836. RC.CAPACITY_TYPE_ID = #{capacityTypeId}
  837. </if>
  838. <if test="capacityStatus != null">
  839. and RC.CAPACITY_STATUS = #{capacityStatus}
  840. </if>
  841. <if test="carrierId != null">
  842. and RC.CARRIER_ID = #{carrierId}
  843. </if>
  844. </where>
  845. )
  846. <where>
  847. <if test="capacityTypeName != null">
  848. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  849. "capacityTypeName" like '%${item}%'
  850. </foreach>
  851. </if>
  852. <if test="capacityNumber != null">
  853. and
  854. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  855. "capacityNumber" like '%${item}%'
  856. </foreach>
  857. </if>
  858. <if test="driverName != null">
  859. and
  860. <foreach collection="driverName" item="item" open="(" separator="or" close=")">
  861. "driverName" like '%${item}%'
  862. </foreach>
  863. </if>
  864. <if test="capacityVip != null">
  865. and
  866. <foreach collection="capacityVip" item="item" open="(" separator="or" close=")">
  867. "capacityVip" like '%${item}%'
  868. </foreach>
  869. </if>
  870. <if test="carrierName != null">
  871. and
  872. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  873. "carrierName" like '%${item}%'
  874. </foreach>
  875. </if>
  876. <if test="capacityBlacklist != null">
  877. and
  878. <foreach collection="capacityBlacklist" item="item" open="(" separator="or" close=")">
  879. "capacityBlacklist" like '%${item}%'
  880. </foreach>
  881. </if>
  882. </where>
  883. <include refid="orderBy">
  884. </include>
  885. <if test="orderField == null ">
  886. order by "insertTime" desc
  887. </if>
  888. </select>
  889. <!-- 通过Id查询派发时间 -->
  890. <select id="getInsertTimeById" parameterType="int" resultType="java.util.Date">
  891. select ORDER_ISSUE_TIME
  892. from OMSTRUCK_ORDER
  893. where ORDER_ID = #{orderId}
  894. </select>
  895. <!-- 通过车牌号匹配运力Id -->
  896. <select id="getCapacityIdByCapacityNum" parameterType="string" resultType="java.math.BigDecimal">
  897. select CAPACITY_ID
  898. from RMS_CAPACITY
  899. where CAPACITY_NUMBER = #{capacityNumber}
  900. </select>
  901. <!-- 通过运输订单ID 或运输订单号 查询 运力ID -->
  902. <select id="getCapacityIdByOrderOrNum" parameterType="java.util.Map" resultType="java.math.BigDecimal">
  903. select CAPACITY_ID
  904. from OMSTRUCK_ORDER
  905. <where>
  906. <if test="orderId != null">
  907. ORDER_ID = #{orderId}
  908. </if>
  909. <if test="orderNumber != null">
  910. and ORDER_NUMBER = #{orderNumber}
  911. </if>
  912. </where>
  913. </select>
  914. <!-- 通过运力ID 或车牌号 修改 运力状态 -->
  915. <update id="updateCapacityByCarIdOrNum" parameterType="java.util.Map">
  916. update RMS_CAPACITY RC
  917. set RC.CAPACITY_STATUS = #{capacityStatus}
  918. where
  919. <if test="capacityId != null">
  920. RC.CAPACITY_ID = #{capacityId}
  921. </if>
  922. <if test="capacityNumber != null">
  923. RC.CAPACITY_NUMBER = #{capacityNumber}
  924. </if>
  925. </update>
  926. <!-- 销售物流,通过运力id修改运力状态 -->
  927. <update id="updateCapacityById" parameterType="java.util.Map">
  928. update RMS_CAPACITY RC
  929. set RC.CAPACITY_STATUS = #{capacityStatus}
  930. where
  931. <if test="driverCapacityId != null">
  932. RC.CAPACITY_ID = #{driverCapacityId}
  933. </if>
  934. <if test="capacityNumber != null">
  935. RC.CAPACITY_NUMBER = #{capacityNumber}
  936. </if>
  937. </update>
  938. <!-- 通过运力ID 查询采购司机接单数据 、通过运单号查询所有运单信息-->
  939. <select id="getTruckOrderByCapacityNum" parameterType="java.util.Map" resultType="java.util.Map">
  940. select *
  941. from (
  942. select OO.ORDER_NUMBER "orderNumber",
  943. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  944. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  945. RW.WAREHOUSE_NAME "warehouseName",
  946. RM.MATERIAL_NAME "materialName",
  947. RC.CAPACITY_NUMBER "capacityNumber",
  948. RW2.WAREHOUSE_NAME "warehouseName2"
  949. from OMSTRUCK_ORDER OO
  950. left join RMS_DRIVER_CAPACITY RDC on OO.DRIVER_CAPACITY_ID = RDC.DRIVER_CAPACITY_ID
  951. left join RMS_CAPACITY RC on RC.CAPACITY_ID = RDC.CAPACITY_ID
  952. left join OMSTRUCK_ORDER_MATERIAL OOM on OOM.ORDER_ID = OO.ORDER_ID
  953. left join RMS_MATERIAL RM on RM.MATERIAL_ID = OOM.MATERIAL_ID
  954. left join RMS_WAREHOUSE RW on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
  955. left join TMSTRUCK_TOTAL_RESULT TTR on TTR.ORDER_ID = OO.ORDER_ID
  956. left join TMSTRUCK_LOAD_RESULT TLR on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  957. left join RMS_WAREHOUSE RW2 on RW2.WAREHOUSE_ID = TLR.LOADING_ID
  958. where OO.ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  959. and OO.ORDER_TYPE = #{orderTypee}
  960. )
  961. <where>
  962. <if test="orderNumber != null">
  963. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  964. "orderNumber" like '%${item}%'
  965. </foreach>
  966. </if>
  967. <if test="orderMaterialWeight != null">
  968. and
  969. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  970. "orderMaterialWeight" like '%${item}%'
  971. </foreach>
  972. </if>
  973. <if test="orderReceiveRefuseTime != null">
  974. and
  975. <foreach collection="orderReceiveRefuseTime" item="item" open="(" separator="or" close=")">
  976. "orderReceiveRefuseTime" like '%${item}%'
  977. </foreach>
  978. </if>
  979. <if test="warehouseName != null">
  980. and
  981. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  982. "warehouseName" like '%${item}%'
  983. </foreach>
  984. </if>
  985. <if test="capacityNumber != null">
  986. and
  987. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  988. "capacityNumber" like '%${item}%'
  989. </foreach>
  990. </if>
  991. <if test="warehouseName2 != null">
  992. and
  993. <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
  994. "warehouseName2" like '%${item}%'
  995. </foreach>
  996. </if>
  997. </where>
  998. <include refid="orderBy">
  999. </include>
  1000. <if test="orderField == null ">
  1001. order by "orderReceiveRefuseTime" desc
  1002. </if>
  1003. </select>
  1004. <!-- 通过运力ID 查询销售司机接单数据 、通过运单号查询所有运单信息-->
  1005. <select id="getSaleTruckOrderByCapacityNum" parameterType="java.util.Map" resultType="java.util.Map">
  1006. select
  1007. distinct *
  1008. from(
  1009. select
  1010. OO.INSERT_TIME "insertTime",
  1011. OO.ORDER_ID "orderId",
  1012. OO.ORDER_NUMBER "orderNumber",
  1013. RC.CAPACITY_NUMBER "carNumber",
  1014. ASO.SALE_NUMBER "saleNumber",
  1015. RM.MATERIAL_NAME "materialName",
  1016. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1017. RS.SHIPPER_NAME "shipperName",
  1018. RCO.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1019. RRA.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1020. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt"
  1021. from OMSTRUCK_ORDER OO
  1022. left join AMS_SALE_ORDER_MATERIAL ASOM
  1023. on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  1024. left join AMS_SALE_ORDER ASO
  1025. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1026. left join RMS_SHIPPER RS
  1027. on RS.SHIPPER_ID = ASO.SHIPPER_ID
  1028. left join RMS_CONSIGNEE RCO
  1029. on RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  1030. left join RMS_RECEIVE_ADDRESS RRA
  1031. on RRA.ADDRESS_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1032. left join RMS_CAPACITY RC --车牌号
  1033. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1034. left join OMSTRUCK_ORDER_MATERIAL OOM --物资重量
  1035. on OOM.ORDER_ID = OO.ORDER_ID
  1036. left join RMS_MATERIAL RM --物资名称
  1037. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1038. <where>
  1039. <if test="capacityId != null">
  1040. and OO.CAPACITY_ID = #{capacityId}
  1041. </if>
  1042. <if test="orderStatus != null">
  1043. and OO.ORDER_STATUS = #{orderStatus}
  1044. </if>
  1045. <if test="orderId != null">
  1046. and OO.ORDER_ID = #{orderId}
  1047. </if>
  1048. <if test="orderType != null">
  1049. and OO.ORDER_TYPE = #{orderType}
  1050. </if>
  1051. <if test="orderReceiveStatus != null">
  1052. and OO.ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  1053. </if>
  1054. </where>
  1055. )
  1056. <where>
  1057. <if test="orderNumber != null">
  1058. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1059. "orderNumber" like '%${item}%'
  1060. </foreach>
  1061. </if>
  1062. <if test="carNumber != null">
  1063. <foreach collection="carNumber" item="item" open="(" separator="or" close=")">
  1064. "carNumber" like '%${item}%'
  1065. </foreach>
  1066. </if>
  1067. <if test="saleNumber != null">
  1068. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1069. "saleNumber" 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="orderMaterialWeight != null">
  1079. and
  1080. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1081. "orderMaterialWeight" like '%${item}%'
  1082. </foreach>
  1083. </if>
  1084. <if test="shipperName != null">
  1085. and
  1086. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1087. "shipperName" like '%${item}%'
  1088. </foreach>
  1089. </if>
  1090. <if test="consigneeCompanyName != null">
  1091. and
  1092. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1093. "consigneeCompanyName" like '%${item}%'
  1094. </foreach>
  1095. </if>
  1096. <if test="addressDeliveryAddress != null">
  1097. and
  1098. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  1099. "addressDeliveryAddress" like '%${item}%'
  1100. </foreach>
  1101. </if>
  1102. <if test="saleDateOfReceipt != null">
  1103. and
  1104. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  1105. "saleDateOfReceipt" like '%${item}%'
  1106. </foreach>
  1107. </if>
  1108. </where>
  1109. <include refid="orderBy">
  1110. </include>
  1111. <if test="orderField == null ">
  1112. order by "insertTime" desc
  1113. </if>
  1114. </select>
  1115. <!-- 查询五个作业点名称sql片段 -->
  1116. <sql id="columnSql">
  1117. RG1.GATEPOST_NAME "gatepostName1",
  1118. RG2.GATEPOST_NAME "gatepostName2",
  1119. RTC1.TRUCK_CALCULATE_NUMBER "truckCalculateNumber",
  1120. RW.WAREHOUSE_NAME "warehouseName",
  1121. RTC2.TRUCK_CALCULATE_NUMBER "truckCalculateNum",
  1122. </sql>
  1123. <sql id="placeSql">
  1124. left join RMS_GATEPOST RG1 --进厂门岗
  1125. on RG1.GATEPOST_ID = RL.LINE_START_NODE_ID
  1126. left join RMS_GATEPOST RG2 --出厂门岗
  1127. on RG2.GATEPOST_ID = RL.LINE_END_NODE_ID
  1128. left join RMS_LINE_SEGEMNT RLS1
  1129. on RL.LINE_ID = RLS1.LINE_ID and RLS1.SEGMENT_END_NODE_TYPE = 1
  1130. left join RMS_TRUCK_CALCULATE RTC1 -- 计毛汽车衡
  1131. on RLS1.SEGMENT_END_NODE_ID = RTC1.TRUCK_CALCULATE_ID
  1132. left join RMS_LINE_SEGEMNT RLS2
  1133. on RL.LINE_ID = RLS2.LINE_ID and RLS2.SEGMENT_END_NODE_TYPE = 3
  1134. left join RMS_WAREHOUSE RW -- 卸货仓库
  1135. on RW.WAREHOUSE_ID = RLS2.SEGMENT_END_NODE_ID
  1136. left join RMS_LINE_SEGEMNT RLS3
  1137. on RL.LINE_ID = RLS3.LINE_ID and RLS3.SEGMENT_END_NODE_TYPE = 2
  1138. left join RMS_TRUCK_CALCULATE RTC2 -- 计皮汽车衡
  1139. on RLS3.SEGMENT_END_NODE_ID = RTC2.TRUCK_CALCULATE_ID
  1140. </sql>
  1141. <!-- 通过运力ID 查询司机所有已拒绝已接收的订单 -->
  1142. <select id="getReceiveRefuseOrderByCapacityId" parameterType="java.util.Map" resultType="java.util.Map">
  1143. select OO.ORDER_ID "orderId",
  1144. OO.ORDER_NUMBER "orderNumber"
  1145. from OMSTRUCK_ORDER OO
  1146. where CAPACITY_ID = #{capacityId}
  1147. and ORDER_RECEIVE_STATUS = 0
  1148. </select>
  1149. <!-- 查询实绩流程 -->
  1150. <select id="selectPlaceAndTime" parameterType="DECIMAL" resultType="java.util.Map">
  1151. SELECT ERG.GATEPOST_NAME as "entryGatepost",
  1152. TER.RESULT_ENTRY_GATE_TIME as "entryTime",
  1153. GRTC.TRUCK_CALCULATE_NUMBER as "grossCalculate",
  1154. TWR.RESULT_GROSS_WEIGHT_TIME as "grossTime",
  1155. RW.WAREHOUSE_NAME as "unloadWarhouse",
  1156. TUR.RESULT_START_TIME as "unloadTime",
  1157. TRTC.TRUCK_CALCULATE_NUMBER as "tareCalculate",
  1158. TWR.RESULT_TARE_WEIGHT_TIME as "tareTime",
  1159. LRG.GATEPOST_NAME as "leaveGatepost",
  1160. TLFR.RESULT_OUT_GATE_TIME as "outTime",
  1161. RWR.WAREHOUSE_NAME as "receiptWarhouse",
  1162. TRR.INSERT_TIME as "receiptTime",
  1163. OO.ORDER_LINE_SEQUENCE as "orderLineSequence",
  1164. OO.ORDER_TYPE as "orderType"
  1165. FROM OMSTRUCK_ORDER OO
  1166. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1167. ON TTR.ORDER_ID = OO.ORDER_ID
  1168. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  1169. ON TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
  1170. LEFT JOIN RMS_GATEPOST ERG --进厂门岗
  1171. ON ERG.GATEPOST_ID = TER.GATEPOST_ID
  1172. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1173. ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1174. LEFT JOIN RMS_TRUCK_CALCULATE GRTC --毛重汽车衡
  1175. ON TWR.RESULT_GROSS_PLACE_ID = GRTC.TRUCK_CALCULATE_ID
  1176. LEFT JOIN RMS_TRUCK_CALCULATE TRTC --皮重汽车衡
  1177. ON TWR.RESULT_TARE_PLACE_ID = TRTC.TRUCK_CALCULATE_ID
  1178. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR
  1179. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  1180. LEFT JOIN RMS_WAREHOUSE RW --卸货点
  1181. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1182. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1183. ON TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1184. LEFT JOIN RMS_GATEPOST LRG --出厂门岗
  1185. ON LRG.GATEPOST_ID = TLFR.GATEPOST_ID
  1186. LEFT JOIN TMSTRUCK_RECEIPT_RESULT TRR
  1187. ON TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1188. LEFT JOIN RMS_WAREHOUSE RWR --异地库
  1189. ON TRR.WAREHOUSE_ID = RWR.WAREHOUSE_ID
  1190. WHERE OO.ORDER_ID = #{orderId}
  1191. </select>
  1192. <!-- 通过运输订单ID查询运输订单相关信息 -->
  1193. <select id="getOrderByOrderId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
  1194. SELECT APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1195. RC.CAPACITY_NUMBER "capacityNumber",
  1196. RM.MATERIAL_ID "materialId",
  1197. OO.ORDER_ENTRY_TIME "orderEntryTime",
  1198. OO.ORDER_TYPE "orderType",
  1199. OO.UNLOAD_POINT_ID "unloadPointId"
  1200. FROM OMSTRUCK_ORDER OO
  1201. left join RMS_DRIVER_CAPACITY RDC
  1202. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  1203. LEFT JOIN RMS_CAPACITY RC
  1204. ON RDC.CAPACITY_ID = RC.CAPACITY_ID
  1205. left join AMS_PURCHASE_ORDER APO
  1206. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  1207. left join OMSTRUCK_ORDER_MATERIAL OOM
  1208. on OOM.ORDER_ID = OO.ORDER_ID
  1209. left join RMS_MATERIAL RM
  1210. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1211. WHERE OO.ORDER_ID = #{orderId}
  1212. </select>
  1213. <!-- 通过运输订单号查询各路段预设作业点 以及总实绩ID -->
  1214. <select id="getPointIdByOrderNum" parameterType="java.util.Map" resultType="java.util.Map">
  1215. select
  1216. RL.LINE_START_NODE_ID "lineStartNodeId",
  1217. RL.LINE_END_NODE_ID "lineEndNodeId",
  1218. RLS1.SEGMENT_END_NODE_ID "truckCalculateIdMao",
  1219. RLS2.SEGMENT_END_NODE_ID "truckCalculateIdPi",
  1220. RLS3.SEGMENT_END_NODE_ID "resultUnloadPlaceId",
  1221. TTR.RESULT_TOTAL_ID "resultTotalId",
  1222. OO.ORDER_TYPE "orderType"
  1223. from OMSTRUCK_ORDER OO
  1224. left join RMS_LINE RL
  1225. on RL.LINE_ID = OO.LINE_ID
  1226. left join TMSTRUCK_TOTAL_RESULT TTR
  1227. on TTR.ORDER_ID = OO.ORDER_ID
  1228. left join RMS_LINE_SEGEMNT RLS1 --查询计毛汽车衡
  1229. on RL.LINE_ID = RLS1.LINE_ID and RLS1.SEGMENT_END_NODE_TYPE = 1
  1230. left join RMS_LINE_SEGEMNT RLS2 --查询计皮汽车衡
  1231. on RL.LINE_ID = RLS2.LINE_ID and RLS2.SEGMENT_END_NODE_TYPE = 2
  1232. left join RMS_LINE_SEGEMNT RLS3 --查询卸货点
  1233. on RL.LINE_ID = RLS3.LINE_ID and RLS3.SEGMENT_END_NODE_TYPE = 3
  1234. <where>
  1235. <if test="orderNumber != null">
  1236. OO.ORDER_NUMBER = #{orderNumber}
  1237. </if>
  1238. <if test="orderId != null">
  1239. and OO.ORDER_ID = #{orderId}
  1240. </if>
  1241. </where>
  1242. </select>
  1243. <!-- 查询运输派单信息 -->
  1244. <select id="getTransportDispatch" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1245. select
  1246. *
  1247. from(
  1248. select
  1249. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  1250. RS.SUPPLIER_NAME "supplierName",
  1251. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1252. RW.WAREHOUSE_NAME "warehouseName",
  1253. RCON.CONSIGNEE_CONTACT_NAME "consigneeContactName",
  1254. RCON.CONSIGNEE_CONTACT_TEL "consigneeContactTel",
  1255. APO.PUCHASE_ORDER_DELIVERY_DATE "puchaseOrderDeliveryDate",
  1256. RM.MATERIAL_NAME "materialName",
  1257. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1258. OO.ORDER_ISSUE_TIME "orderIssueTime",
  1259. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  1260. RC.CAPACITY_NUMBER "capacityNumber",
  1261. RCD.DRIVER_NAME "driverName"
  1262. from OMSTRUCK_ORDER OO
  1263. left join AMS_PURCHASE_ORDER APO
  1264. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  1265. left join OMSTRUCK_ORDER_MATERIAL OOM
  1266. on OOM.ORDER_ID = OO.ORDER_ID
  1267. left join RMS_MATERIAL RM
  1268. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1269. left join RMS_SUPPLIER RS
  1270. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  1271. left join RMS_CONSIGNEE RCON
  1272. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  1273. left join RMS_WAREHOUSE RW
  1274. on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
  1275. left join RMS_DRIVER_CAPACITY RDC
  1276. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  1277. left join RMS_CAPACITY RC
  1278. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  1279. left join RMS_CAR_DRIVER RCD
  1280. on RCD.DRIVER_ID = RDC.DRIVER_ID
  1281. <where>
  1282. <if test="orderStatus != null">
  1283. OO.ORDER_STATUS = #{orderStatus}
  1284. </if>
  1285. <if test="orderTypee != null">
  1286. and OO.ORDER_TYPE = #{orderTypee}
  1287. </if>
  1288. <if test="orderReceiveStatus != null">
  1289. and OO.ORDER_RECEIVE_STATUS = #{orderReceiveStatus}
  1290. </if>
  1291. <if test="fuelOrder != null">
  1292. and OO.ORDER_TYPE in (6, 7)
  1293. </if>
  1294. </where>
  1295. )
  1296. <where>
  1297. <if test="purchaseOrderNo != null">
  1298. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  1299. "purchaseOrderNo" like '%${item}%'
  1300. </foreach>
  1301. </if>
  1302. <if test="supplierName != null">
  1303. and
  1304. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1305. "supplierName" like '%${item}%'
  1306. </foreach>
  1307. </if>
  1308. <if test="consigneeCompanyName != null">
  1309. and
  1310. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1311. "consigneeCompanyName" like '%${item}%'
  1312. </foreach>
  1313. </if>
  1314. <if test="warehouseName != null">
  1315. and
  1316. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1317. "warehouseName" like '%${item}%'
  1318. </foreach>
  1319. </if>
  1320. <if test="consigneeContactName != null">
  1321. and
  1322. <foreach collection="consigneeContactName" item="item" open="(" separator="or" close=")">
  1323. "consigneeContactName" like '%${item}%'
  1324. </foreach>
  1325. </if>
  1326. <if test="consigneeContactTel != null">
  1327. and
  1328. <foreach collection="consigneeContactTel" item="item" open="(" separator="or" close=")">
  1329. "consigneeContactTel" like '%${item}%'
  1330. </foreach>
  1331. </if>
  1332. <if test="puchaseOrderDeliveryDate != null">
  1333. and
  1334. <foreach collection="puchaseOrderDeliveryDate" item="item" open="(" separator="or" close=")">
  1335. "puchaseOrderDeliveryDate" like '%${item}%'
  1336. </foreach>
  1337. </if>
  1338. <if test="materialName != null">
  1339. and
  1340. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1341. "materialName" like '%${item}%'
  1342. </foreach>
  1343. </if>
  1344. <if test="orderMaterialWeight != null">
  1345. and
  1346. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1347. "orderMaterialWeight" like '%${item}%'
  1348. </foreach>
  1349. </if>
  1350. <if test="orderReceiveRefuseTime != null">
  1351. and
  1352. <foreach collection="orderReceiveRefuseTime" item="item" open="(" separator="or" close=")">
  1353. "orderReceiveRefuseTime" like '%${item}%'
  1354. </foreach>
  1355. </if>
  1356. <if test="orderIssueTime != null">
  1357. and
  1358. <foreach collection="orderIssueTime" item="item" open="(" separator="or" close=")">
  1359. "orderIssueTime" like '%${item}%'
  1360. </foreach>
  1361. </if>
  1362. <if test="capacityNumber != null">
  1363. and
  1364. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1365. "capacityNumber" like '%${item}%'
  1366. </foreach>
  1367. </if>
  1368. <if test="driverName != null">
  1369. and
  1370. <foreach collection="driverName" item="item" open="(" separator="or" close=")">
  1371. "driverName" like '%${item}%'
  1372. </foreach>
  1373. </if>
  1374. </where>
  1375. <include refid="orderBy">
  1376. </include>
  1377. <if test="orderField == null ">
  1378. order by "orderReceiveRefuseTime" desc
  1379. </if>
  1380. </select>
  1381. <!-- 查询已下发已接受的销售订单信息 -->
  1382. <select id="getOrderReceived" parameterType="DECIMAL" resultType="java.util.Map">
  1383. SELECT aso.SALE_NUMBER as "saleNumber",
  1384. oo.ORDER_NUMBER as "orderNumber",
  1385. oo.INSERT_USERNAME as "insertUsername",
  1386. rc.CAPACITY_NUMBER as "capacityNumber"
  1387. FROM OMSTRUCK_ORDER oo
  1388. LEFT JOIN AMS_SALE_ORDER_MATERIAL asom
  1389. ON asom.SALE_ORDER_MATERIAL_ID = oo.ORDER_PLAN_ID
  1390. LEFT JOIN AMS_SALE_ORDER aso
  1391. ON aso.SALE_ORDER_ID = asom.SALE_ORDER_ID
  1392. LEFT JOIN RMS_CAPACITY rc
  1393. ON rc.CAPACITY_ID = oo.CAPACITY_ID
  1394. WHERE oo.ORDER_ISSUE_TIME IS NOT NULL
  1395. AND oo.ORDER_RECEIVE_STATUS = 1
  1396. AND oo.ORDER_TYPE = #{orderType}
  1397. <where>
  1398. <if test="saleNumber != null">
  1399. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1400. "saleNumber" like '%${item}%'
  1401. </foreach>
  1402. </if>
  1403. <if test="orderNumber != null">
  1404. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1405. "orderNumber" like '%${item}%'
  1406. </foreach>
  1407. </if>
  1408. <if test="insertUsername != null">
  1409. <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
  1410. "insertUsername" like '%${item}%'
  1411. </foreach>
  1412. </if>
  1413. <if test="capacityNumber != null">
  1414. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1415. "capacityNumber" like '%${item}%'
  1416. </foreach>
  1417. </if>
  1418. </where>
  1419. </select>
  1420. <!--查询司机排班信息-->
  1421. <select id="selectCapacityAndDriver" resultType="java.util.Map" parameterType="java.util.Map">
  1422. SELECT
  1423. RDC.CAPACITY_ID "capacityId",
  1424. RDC.DRIVER_CAPACITY_ID "driverCapacityId",
  1425. RC.CAPACITY_NUMBER "number",
  1426. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  1427. RCD.DRIVER_NAME "name"
  1428. FROM
  1429. RMS_DRIVER_CAPACITY RDC
  1430. LEFT JOIN RMS_CAPACITY RC ON RDC.CAPACITY_ID = RC.CAPACITY_ID
  1431. LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCT.CAPACITY_TYPE_ID = RC.CAPACITY_TYPE_ID
  1432. LEFT JOIN RMS_CAR_DRIVER RCD ON RCD.DRIVER_ID = RDC.DRIVER_ID
  1433. WHERE
  1434. RC.CAPACITY_STATUS =0 and RC.CARRIER_ID=#{carrierId}
  1435. <where>
  1436. <if test="capacityId != null">
  1437. <foreach collection="capacityId" item="item" open="(" separator="or" close=")">
  1438. "capacityId" like '%${item}%'
  1439. </foreach>
  1440. </if>
  1441. <if test="number != null">
  1442. <foreach collection="number" item="item" open="(" separator="or" close=")">
  1443. "number" like '%${item}%'
  1444. </foreach>
  1445. </if>
  1446. <if test="capacityTypeName != null">
  1447. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  1448. "capacityTypeName" like '%${item}%'
  1449. </foreach>
  1450. </if>
  1451. <if test="name != null">
  1452. <foreach collection="name" item="item" open="(" separator="or" close=")">
  1453. "name" like '%${item}%'
  1454. </foreach>
  1455. </if>
  1456. </where>
  1457. </select>
  1458. <!--根据id查找用户名 -->
  1459. <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
  1460. select RP.PERSONNEL_NAME "personnelName"
  1461. from RMS_PERSONNEL RP
  1462. where RP.PERSONNEL_ID = #{personnelId}
  1463. </select>
  1464. <!-- 通过车牌号、承运商匹配最新的运力id-->
  1465. <select id="selectCapacityId" parameterType="java.util.Map" resultType="java.math.BigDecimal">
  1466. select t.CAPACITY_ID
  1467. from RMS_CAPACITY t
  1468. where t.CAPACITY_ID = #{capacityId}
  1469. and t.CAPACITY_NUMBER = #{capacityNumber}
  1470. </select>
  1471. <!-- 通过运输订单号或运输订单ID查询总实绩ID和订单类型 -->
  1472. <select id="getResultTotalIdByOrderNumAndId" parameterType="java.util.Map" resultType="java.util.Map">
  1473. select
  1474. TTR.RESULT_TOTAL_ID "resultTotalId",
  1475. OO.ORDER_TYPE "orderType"
  1476. from OMSTRUCK_ORDER OO
  1477. left join TMSTRUCK_TOTAL_RESULT TTR
  1478. on TTR.ORDER_ID = OO.ORDER_ID
  1479. <where>
  1480. <if test="orderId != null">
  1481. OO.ORDER_ID= #{orderId}
  1482. </if>
  1483. <if test="orderNumber != null">
  1484. and OO.ORDER_NUMBER = #{orderNumber}
  1485. </if>
  1486. </where>
  1487. </select>
  1488. <!--通过运输订单ID查询数据 用于websocket推送数据 如果订单实绩中有卸货点 没有卸货点通过传入的卸货点进行查询-->
  1489. <select id="pushMesToWebsocket" parameterType="java.util.Map" resultType="java.util.Map">
  1490. select OO.ORDER_NUMBER "orderNumber",
  1491. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1492. RM.MATERIAL_NAME "materialName",
  1493. RC.CAPACITY_NUMBER "capacityNumber"
  1494. from OMSTRUCK_ORDER OO
  1495. left join RMS_DRIVER_CAPACITY RDC
  1496. on OO.DRIVER_CAPACITY_ID = RDC.DRIVER_CAPACITY_ID
  1497. left join RMS_CAPACITY RC
  1498. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  1499. left join OMSTRUCK_ORDER_MATERIAL OOM
  1500. on OOM.ORDER_ID = OO.ORDER_ID
  1501. left join RMS_MATERIAL RM
  1502. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1503. left join RMS_WAREHOUSE RW
  1504. on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
  1505. where OO.ORDER_ID = #{orderId}
  1506. </select>
  1507. <!-- //通过物资id查询批次表匹配最新的批次,关联最新的采购订单号 -->
  1508. <select id="selectNewOrderId" parameterType="java.math.BigDecimal" resultType="string">
  1509. select *
  1510. from (select apo.PURCHASE_ORDER_NO
  1511. from DIL_BATCH db
  1512. join AMS_PURCHASE_ORDER apo on apo.BATCH_ID = db.BATCH_ID
  1513. where db.MATERIAL_ID = #{materialId}
  1514. order by db.INSERT_TIME desc)
  1515. where rownum = 1
  1516. </select>
  1517. <!--通过运输订单Id查询运输订单子表有几种物资 :物资ID-->
  1518. <select id="getMaterialIdListByOrderId" parameterType="int" resultType="java.lang.Integer">
  1519. select OOM.MATERIAL_ID
  1520. from OMSTRUCK_ORDER OO
  1521. left join OMSTRUCK_ORDER_MATERIAL OOM
  1522. on OOM.ORDER_ID = OO.ORDER_ID
  1523. </select>
  1524. <!-- 通过采购订单号查找采购订单ID -->
  1525. <select id="getPurchaseOrderIdByNo" parameterType="string" resultType="java.math.BigDecimal">
  1526. select APO.PURCHASE_ORDER_ID
  1527. from AMS_PURCHASE_ORDER APO
  1528. where APO.PURCHASE_ORDER_NO = #{purchaseOrderNo}
  1529. </select>
  1530. <select id="getSaleTruckOrderByCapacityId" resultType="java.util.Map">
  1531. select oo.ORDER_ID "orderId",
  1532. oo.order_number "orderNumber",
  1533. rc.capacity_number "capacityNumber",
  1534. aso.sale_number "saleOrderNumber",
  1535. rs.shipper_name "shipperUnit",
  1536. rce.consignee_company_name "receiveUnit",
  1537. to_char(oo.order_issue_time, 'yyyy-mm-dd') "shipperDate",
  1538. rca.address_delivery_address "receiveAddress",
  1539. asom.sale_date_of_receipt "receiveDate"
  1540. from omstruck_order oo
  1541. left join rms_driver_capacity rdc
  1542. on rdc.driver_capacity_id = oo.driver_capacity_id
  1543. left join rms_capacity rc
  1544. on rc.capacity_id = rdc.capacity_id
  1545. left join omstruck_order_material oom
  1546. on oom.order_id = oo.order_id
  1547. left join ams_sale_order_material asom
  1548. on asom.sale_order_material_id = oo.order_plan_id
  1549. left join ams_sale_order aso
  1550. on aso.sale_order_id = asom.sale_order_id
  1551. left join rms_shipper rs
  1552. on rs.shipper_id = aso.shipper_id
  1553. left join rms_consignee rce
  1554. on rce.consignee_id = aso.receive_id
  1555. left join rms_receive_address rca
  1556. on rca.address_id = asom.sale_shipping_address_id
  1557. where rdc.capacity_id = #{capacityId}
  1558. and oo.order_status = #{orderStatus}
  1559. and oo.order_type = #{orderType}
  1560. </select>
  1561. <select id="getSaleTruckOrderByCapacityNumMaterial" resultType="java.util.Map">
  1562. select rm.material_name "materialName",
  1563. oom.order_material_weight "materialWeight"
  1564. from omstruck_order oo
  1565. left join rms_driver_capacity rdc
  1566. on rdc.driver_capacity_id = oo.driver_capacity_id
  1567. left join rms_capacity rc
  1568. on rc.capacity_id = rdc.capacity_id
  1569. left join omstruck_order_material oom
  1570. on oom.order_id = oo.order_id
  1571. left join rms_material rm
  1572. on rm.material_id = oom.material_id
  1573. where rdc.capacity_id = #{capacityId}
  1574. and oo.order_status = #{orderStatus}
  1575. and oo.order_type = #{orderType}
  1576. </select>
  1577. <!-- 通过车序号查找物资id -->
  1578. <select id="selectMaterialIdBysaleOrderMaterialId" resultType="java.util.Map" parameterType="java.lang.Integer">
  1579. SELECT ASTM.MATERIAL_ID "materialId"
  1580. FROM AMS_SALE_ORDER_MATERIAL ASOM
  1581. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.TRUCKNO_MATERIAL_ID
  1582. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  1583. </select>
  1584. <!--通过销售订单物资ID查找物资理重和物资件数-->
  1585. <select id="selectTheoreticalWeightAndMaterialNumber" resultType="java.util.Map" parameterType="java.lang.Integer">
  1586. SELECT ASTM.SALE_ORDER_MATERIAL_NUMBER "materialNumber",
  1587. ASTM.MATERIAL_THEORETICAL_WEIGHT "weight"
  1588. from AMS_SALE_ORDER_MATERIAL ASOM
  1589. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1590. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1591. WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  1592. </select>
  1593. <!--销售,查看运输订单(钢材销售订单)并根据司机接受或者拒绝时间进行排序 -->
  1594. <select id="selectTransportOrderForSale" parameterType="java.util.Map" resultType="java.util.Map">
  1595. SELECT *
  1596. from(
  1597. select
  1598. OO.ORDER_NUMBER "orderNumber",
  1599. ASO.SALE_NUMBER "saleNumber",
  1600. RC.CAPACITY_NUMBER "capacityNumber",
  1601. RM.MATERIAL_NAME "materialName",
  1602. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialweight",
  1603. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  1604. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  1605. RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1606. RRA.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1607. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1608. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  1609. RS.SHIPPER_NAME "shipperName"
  1610. FROM OMSTRUCK_ORDER OO
  1611. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  1612. ON OO.ORDER_ID=OOM.ORDER_ID
  1613. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1614. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  1615. LEFT JOIN AMS_SALE_ORDER ASO
  1616. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1617. LEFT JOIN RMS_CONSIGNEE RC2
  1618. ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
  1619. LEFT JOIN RMS_DRIVER_CAPACITY RDC
  1620. ON RDC.DRIVER_CAPACITY_ID=OO.DRIVER_CAPACITY_ID
  1621. LEFT JOIN RMS_CAPACITY RC
  1622. ON RDC.CAPACITY_ID=RC.CAPACITY_ID
  1623. LEFT JOIN RMS_MATERIAL RM
  1624. ON OOM.MATERIAL_ID=RM.MATERIAL_ID
  1625. LEFT JOIN RMS_SHIPPER RS
  1626. ON RS.SHIPPER_ID=ASO.SHIPPER_ID
  1627. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1628. ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  1629. <where>
  1630. <if test="orderStatus!=null">
  1631. AND OO.ORDER_STATUS = #{orderStatus}
  1632. </if>
  1633. <if test="carrierId!=null">
  1634. and RDC.CARRIER_ID = #{carrierId}
  1635. </if>
  1636. <if test="orderType!=null">
  1637. and OO.ORDER_TYPE=#{orderType}
  1638. </if>
  1639. </where>
  1640. )
  1641. <where>
  1642. <if test="orderNumber != null">
  1643. and
  1644. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1645. "orderNumber" like '%${item}%'
  1646. </foreach>
  1647. </if>
  1648. <if test="saleNumber != null">
  1649. and
  1650. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1651. "saleNumber" like '%${item}%'
  1652. </foreach>
  1653. </if>
  1654. <if test="capacityNumber != null">
  1655. and
  1656. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1657. "capacityNumber" like '%${item}%'
  1658. </foreach>
  1659. </if>
  1660. <if test="materialName != null">
  1661. and
  1662. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1663. "materialName" like '%${item}%'
  1664. </foreach>
  1665. </if>
  1666. <if test="orderMaterialweight != null">
  1667. and
  1668. <foreach collection="orderMaterialweight" item="item" open="(" separator="or" close=")">
  1669. "orderMaterialweight" like '%${item}%'
  1670. </foreach>
  1671. </if>
  1672. <if test="orderMaterialweight != null">
  1673. and
  1674. <foreach collection="orderMaterialweight" item="item" open="(" separator="or" close=")">
  1675. "orderMaterialweight" like '%${item}%'
  1676. </foreach>
  1677. </if>
  1678. <if test="consigneeCompanyName != null">
  1679. and
  1680. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1681. "consigneeCompanyName" like '%${item}%'
  1682. </foreach>
  1683. </if>
  1684. <if test="consigneeCompanyName != null">
  1685. and
  1686. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1687. "consigneeCompanyName" like '%${item}%'
  1688. </foreach>
  1689. </if>
  1690. </where>
  1691. <include refid="orderBy">
  1692. </include>
  1693. <if test="orderField == null ">
  1694. order by "orderReceiveRefuseTime" desc
  1695. </if>
  1696. </select>
  1697. <!--根据车序号查找销售订单 -->
  1698. <select id="selectSaleBySaleOrderMaterialId" parameterType="java.lang.Integer" resultType="java.util.Map">
  1699. SELECT
  1700. ASO.SALE_NUMBER "saleNumber",
  1701. RS.SHIPPER_NAME "shipperName",
  1702. RC.CONSIGNEE_COMPANY_NAME "consigneeName",
  1703. RRA.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1704. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "truckNo",
  1705. ASOM.SALE_DATE_OF_RECEIPT "receiptOfdate",
  1706. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1707. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1708. ASOM.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1709. ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1710. (
  1711. SELECT
  1712. ASTM.SALE_ORDER_MATERIAL_NUMBER
  1713. FROM
  1714. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1715. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1716. WHERE
  1717. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1718. ) "saleOrderMaterialNumber",
  1719. (
  1720. SELECT
  1721. ASTM.MATERIAL_THEORETICAL_WEIGHT
  1722. FROM
  1723. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1724. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1725. WHERE
  1726. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1727. ) "materialTheoreticalWeight",
  1728. (
  1729. SELECT
  1730. RM.MATERIAL_NAME "materialName"
  1731. FROM
  1732. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1733. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
  1734. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1735. WHERE
  1736. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1737. ) "materialName",
  1738. (
  1739. SELECT
  1740. ASTM.MATERIAL_ID "materialId"
  1741. FROM
  1742. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1743. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
  1744. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1745. WHERE
  1746. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1747. ) "materialId"
  1748. FROM
  1749. AMS_SALE_ORDER_MATERIAL ASOM
  1750. LEFT JOIN AMS_SALE_ORDER ASO ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  1751. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  1752. LEFT JOIN RMS_CONSIGNEE RC ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  1753. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
  1754. WHERE
  1755. ASOM.SALE_ORDER_MATERIAL_ID=#{saleOrderMaterialId}
  1756. <include refid="orderBy"></include>
  1757. </select>
  1758. <!-- 根据承运商查找销售订单 -->
  1759. <select id="selectSaleMaterialIdByCarrierId" resultType="java.util.Map" parameterType="java.lang.Integer">
  1760. select ADSO.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId"
  1761. from AMS_DISPATCH_SALE_ORDER ADSO
  1762. where ADSO.CARRIER_ID = #{carrierId}
  1763. </select>
  1764. <!-- 查询所有下发的销售订单,根据下发状态进行筛选-->
  1765. <select id="selectSaleNumberForCarrier" resultType="java.util.Map" parameterType="java.util.Map">
  1766. SELECT ASO.SALE_NUMBER "saleNumber",
  1767. RC.CONSIGNEE_COMPANY_NAME "companyName",
  1768. RS.SHIPPER_NAME "shipperName"
  1769. FROM AMS_SALE_ORDER ASO
  1770. LEFT JOIN RMS_CONSIGNEE RC
  1771. ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  1772. LEFT JOIN RMS_SHIPPER RS
  1773. ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  1774. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1775. ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  1776. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleMaterialId}
  1777. </select>
  1778. <!-- 查询所有已接收的焦炭发运计划 -->
  1779. <select id="selectCokeDayPlanAndRecived" resultType="java.util.Map" parameterType="java.lang.Integer">
  1780. select * from (
  1781. select
  1782. ARD.DAYPLAN_ID "dayPlanId",
  1783. ARD.DAYPLAN_NO "No",
  1784. RS.SHIPPER_NAME "shipperName",
  1785. ARD.DAYPLAN_TRUCK_NUMBER "TruckNumber",
  1786. ARD.DAYPLAN_DELIVERY_PLACE "DayPlanDeliveryPlace",
  1787. ARD.DAYPLAN_RECEIVE_UNIT "receiveUnit",
  1788. ARD.DAYPLAN_DELIVERY_DATE "deliveryDate",
  1789. ARD.DAYPLAN_MATERIAL_WEIGHT "weight",
  1790. RM.MATERIAL_NAME "materialName",
  1791. ARD.INSERT_UPDATE_REMARK "remark",
  1792. ARD.INSERT_TIME "insertTime"
  1793. FROM AMSTRUCK_RAIL_DAYPLAN ARD
  1794. left join RMS_SHIPPER RS
  1795. on ARD.SHIPMENT_UNIT_ID =RS.SHIPPER_ID
  1796. left join RMS_MATERIAL RM
  1797. on RM.MATERIAL_ID=ARD.MATERIAL_ID
  1798. left Join RMS_MATERIAL_TYPE RMT
  1799. on RMT.MATERIAL_TYPE_ID=RM.MATERIAL_TYPE_ID
  1800. where ARD.DAYPLAN_RECEIVE_STATUS=1 and ARD.CARRIER_ID=#{carrierId}
  1801. )
  1802. <!-- <where>-->
  1803. <!-- <if test="shipperName != null">-->
  1804. <!-- and-->
  1805. <!-- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">-->
  1806. <!-- "shipperName" like '%${item}%'-->
  1807. <!-- </foreach>-->
  1808. <!-- </if>-->
  1809. <!-- <if test="TruckNumber != null">-->
  1810. <!-- and-->
  1811. <!-- <foreach collection="TruckNumber" item="item" open="(" separator="or" close=")">-->
  1812. <!-- "TruckNumber" like '%${item}%'-->
  1813. <!-- </foreach>-->
  1814. <!-- </if>-->
  1815. <!-- <if test="DayPlanDeliveryPlace != null">-->
  1816. <!-- and-->
  1817. <!-- <foreach collection="DayPlanDeliveryPlace" item="item" open="(" separator="or" close=")">-->
  1818. <!-- "DayPlanDeliveryPlace" like '%${item}%'-->
  1819. <!-- </foreach>-->
  1820. <!-- <if test="receiveUnit != null">-->
  1821. <!-- and-->
  1822. <!-- <foreach collection="receiveUnit" item="item" open="(" separator="or" close=")">-->
  1823. <!-- "receiveUnit" like '%${item}%'-->
  1824. <!-- </foreach>-->
  1825. <!-- </if>-->
  1826. <!-- <if test="materialName != null">-->
  1827. <!-- and-->
  1828. <!-- <foreach collection="materialName" item="item" open="(" separator="or" close=")">-->
  1829. <!-- "materialName" like '%${item}%'-->
  1830. <!-- </foreach>-->
  1831. <!-- </if>-->
  1832. <!-- <if test="remark != null">-->
  1833. <!-- and-->
  1834. <!-- <foreach collection="remark" item="item" open="(" separator="or" close=")">-->
  1835. <!-- "remark" like '%${item}%'-->
  1836. <!-- </foreach>-->
  1837. <!-- </if>-->
  1838. <!-- </if>-->
  1839. <!--</where>-->
  1840. <!-- <include refid="orderBy">-->
  1841. <!-- </include>-->
  1842. <!-- <if test="orderField == null ">-->
  1843. <!-- order by "insertTime" desc-->
  1844. <!-- </if>-->
  1845. </select>
  1846. <!--查询所有已接收的水渣发运计划-->
  1847. <select id="selectWaterSlagDayPlanAndRecived" resultType="java.util.Map" parameterType="java.lang.Integer">
  1848. SELECT *
  1849. FROM (
  1850. SELECT
  1851. ARD.DAYPLAN_ID "dayPlanId",
  1852. ARD.DAYPLAN_NO "No",
  1853. RS.SHIPPER_NAME "shipperName",
  1854. ARD.DAYPLAN_RECEIVE_UNIT "receiveUnit",
  1855. ARD.DAYPLAN_DELIVERY_DATE "deliveryDate",
  1856. ARD.DAYPLAN_MATERIAL_WEIGHT "weight",
  1857. RM.MATERIAL_NAME "materialName",
  1858. ARD.INSERT_UPDATE_REMARK "remark",
  1859. ARD.INSERT_TIME "insertTime"
  1860. FROM AMSTRUCK_RAIL_DAYPLAN ARD
  1861. LEFT JOIN RMS_SHIPPER RS
  1862. ON ARD.SHIPMENT_UNIT_ID =RS.SHIPPER_ID
  1863. LEFT JOIN RMS_MATERIAL RM
  1864. ON RM.MATERIAL_ID=ARD.MATERIAL_ID
  1865. LEFT JOIN RMS_MATERIAL_TYPE RMT
  1866. ON RMT.MATERIAL_TYPE_ID=RM.MATERIAL_TYPE_ID
  1867. where ARD.DAYPLAN_RECEIVE_STATUS=1 AND ARD.CARRIER_ID=#{carrierId}
  1868. )
  1869. <!--<where>-->
  1870. <!-- <if test="shipperName != null">-->
  1871. <!-- and-->
  1872. <!-- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">-->
  1873. <!-- "shipperName" like '%${item}%'-->
  1874. <!-- </foreach>-->
  1875. <!-- </if>-->
  1876. <!-- <if test="DayPlanDeliveryPlace != null">-->
  1877. <!-- and-->
  1878. <!-- <foreach collection="DayPlanDeliveryPlace" item="item" open="(" separator="or" close=")">-->
  1879. <!-- "DayPlanDeliveryPlace" like '%${item}%'-->
  1880. <!-- </foreach>-->
  1881. <!-- <if test="receiveUnit != null">-->
  1882. <!-- and-->
  1883. <!-- <foreach collection="receiveUnit" item="item" open="(" separator="or" close=")">-->
  1884. <!-- "receiveUnit" like '%${item}%'-->
  1885. <!-- </foreach>-->
  1886. <!-- </if>-->
  1887. <!-- <if test="materialName != null">-->
  1888. <!-- and-->
  1889. <!-- <foreach collection="materialName" item="item" open="(" separator="or" close=")">-->
  1890. <!-- "materialName" like '%${item}%'-->
  1891. <!-- </foreach>-->
  1892. <!-- </if>-->
  1893. <!-- <if test="remark != null">-->
  1894. <!-- and-->
  1895. <!-- <foreach collection="remark" item="item" open="(" separator="or" close=")">-->
  1896. <!-- "remark" like '%${item}%'-->
  1897. <!-- </foreach>-->
  1898. <!-- </if>-->
  1899. <!-- </if>-->
  1900. <!--</where>-->
  1901. <include refid="orderBy"></include>
  1902. </select>
  1903. <!--根据发运计划id查找物资id -->
  1904. <select id="selectMaterialIdAndWeightByDayPlanId" resultType="java.util.Map" parameterType="java.lang.Integer">
  1905. select APM.MATERIAL_ID "materialId",
  1906. APM.DAYPLAN_MATERIAL_WEIGHT "materialWeight"
  1907. from AMSTRUCK_RAIL_DAYPLAN APM
  1908. WHERE APM.DAYPLAN_ID = #{dayPlanId}
  1909. </select>
  1910. <!--查询根据销售订单生成的运输订单 -->
  1911. <select id="selectAllOrderForSale" resultType="java.util.LinkedHashMap" parameterType="java.util.Map">
  1912. SELECT
  1913. ASO.SALE_NUMBER "saleNumber",
  1914. RS.SHIPPER_NAME "shipperName",
  1915. RC.CONSIGNEE_COMPANY_NAME "consigneeName",
  1916. RRA.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1917. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "truckNo",
  1918. ASOM.SALE_DATE_OF_RECEIPT "receiptOfdate",
  1919. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1920. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1921. ASOM.INSERT_UPDATE_REMARK "insertUpdateRemark",
  1922. RC2.CAPACITY_NUMBER "capacityNumber",
  1923. OO.ORDER_ID "orderId",
  1924. (
  1925. SELECT
  1926. ASTM.SALE_ORDER_MATERIAL_NUMBER
  1927. FROM
  1928. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1929. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1930. WHERE
  1931. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1932. ) "saleOrderMaterialNumber",
  1933. (
  1934. SELECT
  1935. ASTM.MATERIAL_THEORETICAL_WEIGHT
  1936. FROM
  1937. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1938. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1939. WHERE
  1940. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1941. ) "materialTheoreticalWeight",
  1942. (
  1943. SELECT
  1944. RM.MATERIAL_NAME "materialName"
  1945. FROM
  1946. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1947. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
  1948. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1949. WHERE
  1950. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1951. ) "materialName",
  1952. (
  1953. SELECT
  1954. ASTM.MATERIAL_ID "materialId"
  1955. FROM
  1956. AMS_SALE_TRUCKNO_MATERIAL ASTM
  1957. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
  1958. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM2 ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  1959. WHERE
  1960. ASOM.SALE_ORDER_MATERIAL_ID = ASOM2.SALE_ORDER_MATERIAL_ID
  1961. ) "materialId"
  1962. FROM OMSTRUCK_ORDER OO
  1963. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  1964. LEFT JOIN AMS_SALE_ORDER ASO ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  1965. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  1966. LEFT JOIN RMS_CONSIGNEE RC ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  1967. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
  1968. LEFT JOIN RMS_CAPACITY RC2 ON RC2.CAPACITY_ID=OO.CAPACITY_ID
  1969. <where>
  1970. <if test="saleOrderMaterialId != null">
  1971. and ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  1972. </if>
  1973. <if test="orderStatus!=null">
  1974. and OO.ORDER_STATUS = #{orderStatus}
  1975. </if>
  1976. <if test="orderTypee != null">
  1977. and OO.ORDER_TYPE = #{orderTypee}
  1978. </if>
  1979. </where>
  1980. <include refid="orderBy"></include>
  1981. </select>
  1982. <!--销售查询已经形成水渣日计划 -->
  1983. <select id="selectWaterSlagForOrder" resultType="java.util.Map" parameterType="java.util.Map">
  1984. select *
  1985. from (
  1986. SELECT ARD.DAYPLAN_NO "No",
  1987. RS.SHIPPER_NAME "shipperName",
  1988. ARD.DAYPLAN_TRUCK_NUMBER "TruckNumber",
  1989. ARD.DAYPLAN_DELIVERY_PLACE "DayPlanDeliveryPlace",
  1990. ARD.DAYPLAN_RECEIVE_UNIT "receiveUnit",
  1991. ARD.DAYPLAN_DELIVERY_DATE "deliveryDate",
  1992. ARD.DAYPLAN_MATERIAL_WEIGHT "weight",
  1993. ARD.INSERT_UPDATE_REMARK "remark",
  1994. ARD.INSERT_TIME "insertTime",
  1995. OO.ORDER_ID "orderId",
  1996. RM.MATERIAL_NAME "materialName"
  1997. FROM OMSTRUCK_ORDER OO
  1998. LEFT JOIN AMSTRUCK_RAIL_DAYPLAN ARD
  1999. ON ARD.DAYPLAN_ID=OO.ORDER_PLAN_ID
  2000. LEFT JOIN RMS_MATERIAL RM
  2001. ON RM.MATERIAL_ID=ARD.MATERIAL_ID
  2002. left join RMS_SHIPPER RS
  2003. on ARD.SHIPMENT_UNIT_ID =RS.SHIPPER_ID
  2004. <where>
  2005. <if test="carrierId!=null">
  2006. and ARD.CARRIER_ID=#{carrierId}
  2007. </if>
  2008. <if test="dayPlanId!=null">
  2009. and ARD.DAYPLAN_ID=#{dayPlanId}
  2010. </if>
  2011. <if test="orderType!=null">
  2012. and OO.ORDER_TYPE=#{orderType}
  2013. </if>
  2014. <if test="orderStatus!=null">
  2015. and OO.ORDER_STATUS=#{orderStatus}
  2016. </if>
  2017. <if test="materialId!=null">
  2018. and RM.MATERIAL_ID=#{materialId}
  2019. </if>
  2020. </where>
  2021. )
  2022. <include refid="orderBy"></include>
  2023. </select>
  2024. <!--销售查询已经形成订单得水渣日计划-->
  2025. <select id="selectCokeRailPlanForOrder" resultType="java.util.Map" parameterType="java.util.Map">
  2026. select *
  2027. from (
  2028. SELECT ARD.DAYPLAN_NO "No",
  2029. ARD.DAYPLAN_ID "dayPlanId",
  2030. RS.SHIPPER_NAME "shipperName",
  2031. ARD.DAYPLAN_TRUCK_NUMBER "TruckNumber",
  2032. ARD.DAYPLAN_DELIVERY_PLACE "DayPlanDeliveryPlace",
  2033. ARD.DAYPLAN_RECEIVE_UNIT "receiveUnit",
  2034. ARD.DAYPLAN_DELIVERY_DATE "deliveryDate",
  2035. ARD.DAYPLAN_MATERIAL_WEIGHT "weight",
  2036. RM.MATERIAL_NAME "materialName",
  2037. ARD.INSERT_UPDATE_REMARK "remark",
  2038. ARD.INSERT_TIME "insertTime",
  2039. OO.ORDER_ID "orderId"
  2040. FROM OMSTRUCK_ORDER OO
  2041. LEFT JOIN AMSTRUCK_RAIL_DAYPLAN ARD
  2042. ON ARD.DAYPLAN_ID=OO.ORDER_PLAN_ID
  2043. left join RMS_SHIPPER RS
  2044. on ARD.SHIPMENT_UNIT_ID =RS.SHIPPER_ID
  2045. left join RMS_MATERIAL RM
  2046. on RM.MATERIAL_ID=ARD.MATERIAL_ID
  2047. left join OMSTRUCK_ORDER OO
  2048. ON OO.ORDER_PLAN_ID=ARD.DAYPLAN_ID
  2049. <where>
  2050. <if test="carrierId!=null">
  2051. and ARD.CARRIER_ID=#{carrierId}
  2052. </if>
  2053. <if test="dayPlanId!=null">
  2054. and ARD.DAYPLAN_ID=#{dayPlanId}
  2055. </if>
  2056. <if test="orderType!=null">
  2057. and OO.ORDER_TYPE=#{orderType}
  2058. </if>
  2059. <if test="orderStatus!=null">
  2060. and OO.ORDER_STATUS=#{orderStatus}
  2061. </if>
  2062. <if test="materialId!=null">
  2063. and RM.MATERIAL_ID=#{materialId}
  2064. </if>
  2065. </where>
  2066. )
  2067. <include refid="orderBy"></include>
  2068. </select>
  2069. <!-- 根据承运商查找销售订单-->
  2070. <select id="selectSteelSaleForCarrier" resultType="java.util.LinkedHashMap" parameterType="java.lang.Integer">
  2071. select ASO.SALE_NUMBER "saleNumber",
  2072. RS.SHIPPER_NAME "shipperName",
  2073. RC.CONSIGNEE_COMPANY_NAME "consigneeName",
  2074. RRA.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  2075. ASOM.SALE_DATE_OF_RECEIPT "receiptOfdate",
  2076. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  2077. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  2078. RC2.CARRIER_NAME "carrierName",
  2079. ASO.SALE_ORDER_ID "saleOderId"
  2080. from AMS_SALE_ORDER ASO
  2081. left join AMS_SALE_ORDER_MATERIAL ASOM
  2082. on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2083. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2084. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2085. left join OMSTRUCK_ORDER OO
  2086. on OO.ORDER_PLAN_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2087. left join RMS_DRIVER_CAPACITY RDC
  2088. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  2089. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  2090. LEFT JOIN RMS_CONSIGNEE RC ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  2091. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
  2092. left join RMS_CARRIER RC2 ON RC2.CARRIER_ID = RDC.CARRIER_ID
  2093. WHERE RDC.CARRIER_ID = #{carrierId}
  2094. and OO.ORDER_TYPE = 1
  2095. AND OO.ORDER_STATUS = 4
  2096. </select>
  2097. <select id="selectInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.lang.Integer">
  2098. select OO.ORDER_NUMBER "orderNumber",
  2099. RM.MATERIAL_NAME "materialName",
  2100. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  2101. RM.MATERIAL_THEORETICAL_WEIGHT "orderTheoreticalWeight",
  2102. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  2103. OO.INSERT_UPDATE_REMARK "remark",
  2104. RC.CAPACITY_NUMBER "capacityNumber"
  2105. from AMS_SALE_ORDER ASO
  2106. left join AMS_SALE_ORDER_MATERIAL ASOM
  2107. on asom.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2108. left join OMSTRUCK_ORDER OO
  2109. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2110. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  2111. ON OOM.ORDER_ID = OO.ORDER_ID
  2112. LEFT JOIN RMS_DRIVER_CAPACITY RDC
  2113. ON RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  2114. LEFT JOIN RMS_CAPACITY RC
  2115. ON RC.CAPACITY_ID = RDC.CAPACITY_ID
  2116. LEFT JOIN RMS_MATERIAL RM
  2117. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  2118. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  2119. and OO.ORDER_TYPE = 1
  2120. AND OO.ORDER_STATUS = 4
  2121. </select>
  2122. <!--根据承运商查找发运计划-->
  2123. <select id="selectCokeRailPlan" resultType="java.util.Map" parameterType="java.util.Map">
  2124. select ARD.DAYPLAN_NO "dayPlanNo",
  2125. ARD.DAYPLAN_DELIVERY_DATE "dayPlanDeliverydate",
  2126. ARD.DAYPLAN_TRUCK_NUMBER "dayTruckNumber",
  2127. ARD.DAYPLAN_DELIVERY_PLACE "dayPlanDeliveryPlace",
  2128. ARD.DAYPLAN_RECEIVE_UNIT "dayPlanReceiveUnit",
  2129. RS.SHIPPER_NAME "shipperName",
  2130. ARD.DAYPLAN_ID "dayPlanId"
  2131. from AMSTRUCK_RAIL_DAYPLAN ARD
  2132. LEFT JOIN OMSTRUCK_ORDER OO
  2133. ON OO.ORDER_PLAN_ID = ARD.DAYPLAN_ID
  2134. LEFT JOIN RMS_SHIPPER RS
  2135. ON RS.SHIPPER_ID = ARD.SHIPMENT_UNIT_ID
  2136. LEFT JOIN RMS_DRIVER_CAPACITY RDC
  2137. ON RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  2138. WHERE RDC.CARRIER_ID = #{carrierId}
  2139. and OO.ORDER_TYPE = #{orderType}
  2140. AND OO.ORDER_STATUS = 4
  2141. </select>
  2142. <!-- 根据发运计划id查找信息 -->
  2143. <select id="selectInfoByDayPlanId" parameterType="java.lang.Integer" resultType="java.util.Map">
  2144. select OO.ORDER_NUMBER "orderNumber",
  2145. RM.MATERIAL_NAME "materialName",
  2146. ARD.DAYPLAN_MATERIAL_WEIGHT "materialWeight",
  2147. RC.CAPACITY_NUMBER "capacityNumber",
  2148. OO.INSERT_UPDATE_REMARK "remark"
  2149. from AMSTRUCK_RAIL_DAYPLAN ARD
  2150. left join OMSTRUCK_ORDER OO
  2151. ON OO.ORDER_PLAN_ID = ARD.DAYPLAN_ID
  2152. LEFT JOIN RMS_MATERIAL RM
  2153. ON RM.MATERIAL_ID = ARD.MATERIAL_ID
  2154. LEFT JOIN RMS_DRIVER_CAPACITY RDC
  2155. ON RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  2156. LEFT JOIN RMS_CAPACITY RC
  2157. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2158. where OO.ORDER_TYPE = #{orderType}
  2159. and ARD.DAYPLAN_ID = #{dayPlanId}
  2160. AND OO.ORDER_STATUS = 4
  2161. </select>
  2162. <select id="getOrderUnReceive" resultType="java.util.Map"></select>
  2163. <!-- 车牌号下拉 -->
  2164. <select id="getDriverCapacity" resultType="java.util.Map">
  2165. SELECT RCA.CAPACITY_NUMBER AS "label",
  2166. RDC.DRIVER_CAPACITY_ID AS "value"
  2167. FROM RMS_DRIVER_CAPACITY RDC
  2168. LEFT JOIN RMS_CAPACITY RCA
  2169. ON RDC.CAPACITY_ID = RCA.CAPACITY_ID
  2170. WHERE RCA.CAPACITY_STATUS = 0
  2171. </select>
  2172. <!-- 派单信息 -->
  2173. <select id="getTruckNoDispatchMap" parameterType="DECIMAL" resultType="java.util.Map">
  2174. SELECT ADSO.DISPATCH_ID AS "dispatchId",
  2175. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "saleOrderMaterialTruckNo",
  2176. ASO.SALE_NUMBER AS "saleNumber",
  2177. ADSO.DISPATCH_DEAL_TIME AS "dispatchDealTime",
  2178. RSH.SHIPPER_NAME AS "shipperName",
  2179. RC.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2180. RRA.ADDRESS_DELIVERY_ADDRESS AS "addressDeliveryAddress",
  2181. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2182. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2183. RCA.CARRIER_NAME AS "carrierName"
  2184. FROM AMS_DISPATCH_SALE_ORDER ADSO
  2185. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2186. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2187. LEFT JOIN AMS_SALE_ORDER ASO
  2188. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2189. LEFT JOIN RMS_SHIPPER RSH
  2190. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2191. LEFT JOIN RMS_CONSIGNEE RC
  2192. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  2193. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2194. ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
  2195. LEFT JOIN RMS_CARRIER RCA
  2196. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2197. WHERE ADSO.DISPATCH_STATUS = 0
  2198. AND ADSO.DISPATCH_ID = #{dispatchId}
  2199. </select>
  2200. <select id="getMaterialMessages" parameterType="DECIMAL" resultType="java.util.Map">
  2201. SELECT RM.MATERIAL_NAME AS "materialName",
  2202. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2203. ASTM.MATERIAL_THEORETICAL_WEIGHT AS "materialTheoreticalWeight",
  2204. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "saleOrderMaterialNumber",
  2205. ASTM.MATERIAL_ID AS "materialId"
  2206. FROM AMS_DISPATCH_SALE_ORDER ADSO
  2207. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2208. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2209. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2210. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2211. LEFT JOIN RMS_MATERIAL RM
  2212. ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
  2213. WHERE ADSO.DISPATCH_ID = #{dispatchId}
  2214. </select>
  2215. <!--得到销售订单与物资中间表id-->
  2216. <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="DECIMAL">
  2217. SELECT ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId"
  2218. FROM AMS_DISPATCH_SALE_ORDER ADSO
  2219. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2220. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2221. WHERE ADSO.DISPATCH_ID = #{dispatchId}
  2222. </select>
  2223. <select id="getCapacityId" parameterType="DECIMAL" resultType="DECIMAL">
  2224. SELECT *
  2225. FROM (SELECT RDC.CAPACITY_ID AS "capacityId"
  2226. FROM RMS_DRIVER_CAPACITY RDC
  2227. WHERE RDC.DRIVER_CAPACITY_ID = #{driverCapacityId}
  2228. ORDER BY RDC.INSERT_TIME)
  2229. WHERE ROWNUM = 1
  2230. </select>
  2231. </mapper>