AmsSaleOrderMapper.xml 129 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118
  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.AmsSaleOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsSaleOrder">
  5. <id column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId" />
  6. <result column="PLAN_ID" jdbcType="DECIMAL" property="planId" />
  7. <result column="SALE_NUMBER" jdbcType="VARCHAR" property="saleNumber" />
  8. <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId" />
  9. <result column="RECEIVE_ID" jdbcType="DECIMAL" property="receiveId" />
  10. <result column="SALE_ACCOUNT_BALANCE" jdbcType="DECIMAL" property="saleAccountBalance" />
  11. <result column="SALE_CURRENT_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleCurrentOrderAmount" />
  12. <result column="SALE_HISTORICAL_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleHistoricalOrderAmount" />
  13. <result column="SALE_ORDER_STATUS" jdbcType="DECIMAL" property="saleOrderStatus" />
  14. <result column="SALE_ORDER_RECEIVE_CUSTOMER" jdbcType="VARCHAR" property="saleOrderReceiveCustomer" />
  15. <result column="SALE_ORDER_ISSELF_MENTION" jdbcType="VARCHAR" property="saleOrderIsselfMention" />
  16. <result column="SALE_UNIT_PRICE" jdbcType="DECIMAL" property="saleUnitPrice" />
  17. <result column="SALE_ORDER_TAX" jdbcType="VARCHAR" property="saleOrderTax" />
  18. <result column="SALE_REMARK" jdbcType="VARCHAR" property="saleRemark" />
  19. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  20. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  21. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  22. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  23. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  24. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  25. <result column="CLOSE_STATUS" jdbcType="DECIMAL" property="closeStatus" />
  26. <result column="SALER_ID" jdbcType="DECIMAL" property="salerId" />
  27. <result column="SALE_TYPE" jdbcType="DECIMAL" property="saleType" />
  28. </resultMap>
  29. <sql id="columns">
  30. SALE_ORDER_ID, PLAN_ID, SALE_NUMBER, SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  31. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT, SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  32. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE, SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  33. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
  34. SALER_ID, SALE_TYPE
  35. </sql>
  36. <sql id="columns_alias">
  37. t.SALE_ORDER_ID, t.PLAN_ID, t.SALE_NUMBER, t.SHIPPER_ID, t.RECEIVE_ID, t.SALE_ACCOUNT_BALANCE,
  38. t.SALE_CURRENT_ORDER_AMOUNT, t.SALE_HISTORICAL_ORDER_AMOUNT, t.SALE_ORDER_STATUS,
  39. t.SALE_ORDER_RECEIVE_CUSTOMER, t.SALE_ORDER_ISSELF_MENTION, t.SALE_UNIT_PRICE, t.SALE_ORDER_TAX,
  40. t.SALE_REMARK, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  41. t.INSERT_UPDATE_REMARK, t.DELETED, t.CLOSE_STATUS, t.SALER_ID, t.SALE_TYPE
  42. </sql>
  43. <sql id="select">
  44. SELECT <include refid="columns" /> FROM AMS_SALE_ORDER
  45. </sql>
  46. <sql id="select_alias">
  47. SELECT <include refid="columns_alias" /> FROM AMS_SALE_ORDER t
  48. </sql>
  49. <sql id="where">
  50. <where>
  51. <if test="saleOrderId != null">
  52. and SALE_ORDER_ID = #{saleOrderId}
  53. </if>
  54. <if test="planId != null">
  55. and PLAN_ID = #{planId}
  56. </if>
  57. <if test="saleNumber != null and saleNumber != ''">
  58. and SALE_NUMBER = #{saleNumber}
  59. </if>
  60. <if test="shipperId != null">
  61. and SHIPPER_ID = #{shipperId}
  62. </if>
  63. <if test="receiveId != null">
  64. and RECEIVE_ID = #{receiveId}
  65. </if>
  66. <if test="saleAccountBalance != null">
  67. and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  68. </if>
  69. <if test="saleCurrentOrderAmount != null">
  70. and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  71. </if>
  72. <if test="saleHistoricalOrderAmount != null">
  73. and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  74. </if>
  75. <if test="saleOrderStatus != null">
  76. and SALE_ORDER_STATUS = #{saleOrderStatus}
  77. </if>
  78. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  79. and SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
  80. </if>
  81. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  82. and SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
  83. </if>
  84. <if test="saleUnitPrice != null">
  85. and SALE_UNIT_PRICE = #{saleUnitPrice}
  86. </if>
  87. <if test="saleOrderTax != null and saleOrderTax != ''">
  88. and SALE_ORDER_TAX = #{saleOrderTax}
  89. </if>
  90. <if test="saleRemark != null and saleRemark != ''">
  91. and SALE_REMARK = #{saleRemark}
  92. </if>
  93. <if test="insertUsername != null and insertUsername != ''">
  94. and INSERT_USERNAME = #{insertUsername}
  95. </if>
  96. <if test="insertTime != null">
  97. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  98. </if>
  99. <if test="updateUsername != null and updateUsername != ''">
  100. and UPDATE_USERNAME = #{updateUsername}
  101. </if>
  102. <if test="updateTime != null">
  103. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  104. </if>
  105. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  106. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  107. </if>
  108. <if test="deleted != null">
  109. and DELETED = #{deleted}
  110. </if>
  111. <if test="closeStatus != null">
  112. and CLOSE_STATUS = #{closeStatus}
  113. </if>
  114. <if test="salerId != null">
  115. and SALER_ID = #{salerId}
  116. </if>
  117. <if test="saleType != null">
  118. and SALE_TYPE = #{saleType}
  119. </if>
  120. </where>
  121. </sql>
  122. <sql id="whereLike">
  123. <where>
  124. <if test="saleOrderId != null">
  125. and SALE_ORDER_ID = #{saleOrderId}
  126. </if>
  127. <if test="planId != null">
  128. and PLAN_ID = #{planId}
  129. </if>
  130. <if test="saleNumber != null and saleNumber != ''">
  131. and SALE_NUMBER LIKE '%${saleNumber}%'
  132. </if>
  133. <if test="shipperId != null">
  134. and SHIPPER_ID = #{shipperId}
  135. </if>
  136. <if test="receiveId != null">
  137. and RECEIVE_ID = #{receiveId}
  138. </if>
  139. <if test="saleAccountBalance != null">
  140. and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  141. </if>
  142. <if test="saleCurrentOrderAmount != null">
  143. and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  144. </if>
  145. <if test="saleHistoricalOrderAmount != null">
  146. and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  147. </if>
  148. <if test="saleOrderStatus != null">
  149. and SALE_ORDER_STATUS = #{saleOrderStatus}
  150. </if>
  151. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  152. and SALE_ORDER_RECEIVE_CUSTOMER LIKE '%${saleOrderReceiveCustomer}%'
  153. </if>
  154. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  155. and SALE_ORDER_ISSELF_MENTION LIKE '%${saleOrderIsselfMention}%'
  156. </if>
  157. <if test="saleUnitPrice != null">
  158. and SALE_UNIT_PRICE = #{saleUnitPrice}
  159. </if>
  160. <if test="saleOrderTax != null and saleOrderTax != ''">
  161. and SALE_ORDER_TAX LIKE '%${saleOrderTax}%'
  162. </if>
  163. <if test="saleRemark != null and saleRemark != ''">
  164. and SALE_REMARK LIKE '%${saleRemark}%'
  165. </if>
  166. <if test="insertUsername != null and insertUsername != ''">
  167. and INSERT_USERNAME LIKE '%${insertUsername}%'
  168. </if>
  169. <if test="insertTime != null">
  170. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  171. </if>
  172. <if test="updateUsername != null and updateUsername != ''">
  173. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  174. </if>
  175. <if test="updateTime != null">
  176. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  177. </if>
  178. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  179. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  180. </if>
  181. <if test="deleted != null">
  182. and DELETED = #{deleted}
  183. </if>
  184. <if test="closeStatus != null">
  185. and CLOSE_STATUS = #{closeStatus}
  186. </if>
  187. <if test="salerId != null">
  188. and SALER_ID = #{salerId}
  189. </if>
  190. <if test="saleType != null">
  191. and SALE_TYPE = #{saleType}
  192. </if>
  193. </where>
  194. </sql>
  195. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  196. delete from AMS_SALE_ORDER
  197. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  198. </delete>
  199. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  200. delete from AMS_SALE_ORDER
  201. where 1!=1
  202. <if test="planId != null">
  203. or PLAN_ID = #{planId}
  204. </if>
  205. <if test="saleNumber != null and saleNumber != ''">
  206. or SALE_NUMBER = #{saleNumber}
  207. </if>
  208. <if test="shipperId != null">
  209. or SHIPPER_ID = #{shipperId}
  210. </if>
  211. <if test="receiveId != null">
  212. or RECEIVE_ID = #{receiveId}
  213. </if>
  214. <if test="saleAccountBalance != null">
  215. or SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  216. </if>
  217. <if test="saleCurrentOrderAmount != null">
  218. or SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  219. </if>
  220. <if test="saleHistoricalOrderAmount != null">
  221. or SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  222. </if>
  223. <if test="saleOrderStatus != null">
  224. or SALE_ORDER_STATUS = #{saleOrderStatus}
  225. </if>
  226. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  227. or SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
  228. </if>
  229. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  230. or SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
  231. </if>
  232. <if test="saleUnitPrice != null">
  233. or SALE_UNIT_PRICE = #{saleUnitPrice}
  234. </if>
  235. <if test="saleOrderTax != null and saleOrderTax != ''">
  236. or SALE_ORDER_TAX = #{saleOrderTax}
  237. </if>
  238. <if test="saleRemark != null and saleRemark != ''">
  239. or SALE_REMARK = #{saleRemark}
  240. </if>
  241. <if test="insertUsername != null and insertUsername != ''">
  242. or INSERT_USERNAME = #{insertUsername}
  243. </if>
  244. <if test="insertTime != null">
  245. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  246. </if>
  247. <if test="updateUsername != null and updateUsername != ''">
  248. or UPDATE_USERNAME = #{updateUsername}
  249. </if>
  250. <if test="updateTime != null">
  251. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  252. </if>
  253. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  254. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  255. </if>
  256. <if test="deleted != null">
  257. or DELETED = #{deleted}
  258. </if>
  259. <if test="closeStatus != null">
  260. or CLOSE_STATUS = #{closeStatus}
  261. </if>
  262. <if test="salerId != null">
  263. or SALER_ID = #{salerId}
  264. </if>
  265. <if test="saleType != null">
  266. or SALE_TYPE = #{saleType}
  267. </if>
  268. </delete>
  269. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  270. insert into AMS_SALE_ORDER (SALE_ORDER_ID, PLAN_ID, SALE_NUMBER,
  271. SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  272. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
  273. SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  274. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
  275. SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  276. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  277. INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
  278. SALER_ID, SALE_TYPE)
  279. values (#{saleOrderId,jdbcType=DECIMAL}, #{planId,jdbcType=DECIMAL}, #{saleNumber,jdbcType=VARCHAR},
  280. #{shipperId,jdbcType=DECIMAL}, #{receiveId,jdbcType=DECIMAL}, #{saleAccountBalance,jdbcType=DECIMAL},
  281. #{saleCurrentOrderAmount,jdbcType=DECIMAL}, #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  282. #{saleOrderStatus,jdbcType=DECIMAL}, #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  283. #{saleOrderIsselfMention,jdbcType=VARCHAR}, #{saleUnitPrice,jdbcType=DECIMAL},
  284. #{saleOrderTax,jdbcType=VARCHAR}, #{saleRemark,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
  285. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  286. #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, #{closeStatus,jdbcType=DECIMAL},
  287. #{salerId,jdbcType=DECIMAL}, #{saleType,jdbcType=DECIMAL})
  288. </insert>
  289. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  290. insert into AMS_SALE_ORDER
  291. <trim prefix="(" suffix=")" suffixOverrides=",">
  292. <if test="saleOrderId != null">
  293. SALE_ORDER_ID,
  294. </if>
  295. <if test="planId != null">
  296. PLAN_ID,
  297. </if>
  298. <if test="saleNumber != null">
  299. SALE_NUMBER,
  300. </if>
  301. <if test="shipperId != null">
  302. SHIPPER_ID,
  303. </if>
  304. <if test="receiveId != null">
  305. RECEIVE_ID,
  306. </if>
  307. <if test="saleAccountBalance != null">
  308. SALE_ACCOUNT_BALANCE,
  309. </if>
  310. <if test="saleCurrentOrderAmount != null">
  311. SALE_CURRENT_ORDER_AMOUNT,
  312. </if>
  313. <if test="saleHistoricalOrderAmount != null">
  314. SALE_HISTORICAL_ORDER_AMOUNT,
  315. </if>
  316. <if test="saleOrderStatus != null">
  317. SALE_ORDER_STATUS,
  318. </if>
  319. <if test="saleOrderReceiveCustomer != null">
  320. SALE_ORDER_RECEIVE_CUSTOMER,
  321. </if>
  322. <if test="saleOrderIsselfMention != null">
  323. SALE_ORDER_ISSELF_MENTION,
  324. </if>
  325. <if test="saleUnitPrice != null">
  326. SALE_UNIT_PRICE,
  327. </if>
  328. <if test="saleOrderTax != null">
  329. SALE_ORDER_TAX,
  330. </if>
  331. <if test="saleRemark != null">
  332. SALE_REMARK,
  333. </if>
  334. <if test="insertUsername != null">
  335. INSERT_USERNAME,
  336. </if>
  337. <if test="insertTime != null">
  338. INSERT_TIME,
  339. </if>
  340. <if test="updateUsername != null">
  341. UPDATE_USERNAME,
  342. </if>
  343. <if test="updateTime != null">
  344. UPDATE_TIME,
  345. </if>
  346. <if test="insertUpdateRemark != null">
  347. INSERT_UPDATE_REMARK,
  348. </if>
  349. <if test="deleted != null">
  350. DELETED,
  351. </if>
  352. <if test="closeStatus != null">
  353. CLOSE_STATUS,
  354. </if>
  355. <if test="salerId != null">
  356. SALER_ID,
  357. </if>
  358. <if test="saleType != null">
  359. SALE_TYPE,
  360. </if>
  361. </trim>
  362. <trim prefix="values (" suffix=")" suffixOverrides=",">
  363. <if test="saleOrderId != null">
  364. #{saleOrderId,jdbcType=DECIMAL},
  365. </if>
  366. <if test="planId != null">
  367. #{planId,jdbcType=DECIMAL},
  368. </if>
  369. <if test="saleNumber != null">
  370. #{saleNumber,jdbcType=VARCHAR},
  371. </if>
  372. <if test="shipperId != null">
  373. #{shipperId,jdbcType=DECIMAL},
  374. </if>
  375. <if test="receiveId != null">
  376. #{receiveId,jdbcType=DECIMAL},
  377. </if>
  378. <if test="saleAccountBalance != null">
  379. #{saleAccountBalance,jdbcType=DECIMAL},
  380. </if>
  381. <if test="saleCurrentOrderAmount != null">
  382. #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  383. </if>
  384. <if test="saleHistoricalOrderAmount != null">
  385. #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  386. </if>
  387. <if test="saleOrderStatus != null">
  388. #{saleOrderStatus,jdbcType=DECIMAL},
  389. </if>
  390. <if test="saleOrderReceiveCustomer != null">
  391. #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  392. </if>
  393. <if test="saleOrderIsselfMention != null">
  394. #{saleOrderIsselfMention,jdbcType=VARCHAR},
  395. </if>
  396. <if test="saleUnitPrice != null">
  397. #{saleUnitPrice,jdbcType=DECIMAL},
  398. </if>
  399. <if test="saleOrderTax != null">
  400. #{saleOrderTax,jdbcType=VARCHAR},
  401. </if>
  402. <if test="saleRemark != null">
  403. #{saleRemark,jdbcType=VARCHAR},
  404. </if>
  405. <if test="insertUsername != null">
  406. #{insertUsername,jdbcType=VARCHAR},
  407. </if>
  408. <if test="insertTime != null">
  409. #{insertTime,jdbcType=TIMESTAMP},
  410. </if>
  411. <if test="updateUsername != null">
  412. #{updateUsername,jdbcType=VARCHAR},
  413. </if>
  414. <if test="updateTime != null">
  415. #{updateTime,jdbcType=TIMESTAMP},
  416. </if>
  417. <if test="insertUpdateRemark != null">
  418. #{insertUpdateRemark,jdbcType=VARCHAR},
  419. </if>
  420. <if test="deleted != null">
  421. #{deleted,jdbcType=DECIMAL},
  422. </if>
  423. <if test="closeStatus != null">
  424. #{closeStatus,jdbcType=DECIMAL},
  425. </if>
  426. <if test="salerId != null">
  427. #{salerId,jdbcType=DECIMAL},
  428. </if>
  429. <if test="saleType != null">
  430. #{saleType,jdbcType=DECIMAL},
  431. </if>
  432. </trim>
  433. </insert>
  434. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  435. update AMS_SALE_ORDER
  436. set PLAN_ID = #{planId,jdbcType=DECIMAL},
  437. SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
  438. SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  439. RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
  440. SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
  441. SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  442. SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  443. SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
  444. SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  445. SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
  446. SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
  447. SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
  448. SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
  449. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  450. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  451. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  452. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  453. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  454. DELETED = #{deleted,jdbcType=DECIMAL},
  455. CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
  456. SALER_ID = #{salerId,jdbcType=DECIMAL},
  457. SALE_TYPE = #{saleType,jdbcType=DECIMAL}
  458. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  459. </update>
  460. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  461. update AMS_SALE_ORDER
  462. <set>
  463. <if test="planId != null">
  464. PLAN_ID = #{planId,jdbcType=DECIMAL},
  465. </if>
  466. <if test="saleNumber != null">
  467. SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
  468. </if>
  469. <if test="shipperId != null">
  470. SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  471. </if>
  472. <if test="receiveId != null">
  473. RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
  474. </if>
  475. <if test="saleAccountBalance != null">
  476. SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
  477. </if>
  478. <if test="saleCurrentOrderAmount != null">
  479. SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  480. </if>
  481. <if test="saleHistoricalOrderAmount != null">
  482. SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  483. </if>
  484. <if test="saleOrderStatus != null">
  485. SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
  486. </if>
  487. <if test="saleOrderReceiveCustomer != null">
  488. SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  489. </if>
  490. <if test="saleOrderIsselfMention != null">
  491. SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
  492. </if>
  493. <if test="saleUnitPrice != null">
  494. SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
  495. </if>
  496. <if test="saleOrderTax != null">
  497. SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
  498. </if>
  499. <if test="saleRemark != null">
  500. SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
  501. </if>
  502. <if test="insertUsername != null">
  503. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  504. </if>
  505. <if test="insertTime != null">
  506. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  507. </if>
  508. <if test="updateUsername != null">
  509. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  510. </if>
  511. <if test="updateTime != null">
  512. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  513. </if>
  514. <if test="insertUpdateRemark != null">
  515. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  516. </if>
  517. <if test="deleted != null">
  518. DELETED = #{deleted,jdbcType=DECIMAL},
  519. </if>
  520. <if test="closeStatus != null">
  521. CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
  522. </if>
  523. <if test="salerId != null">
  524. SALER_ID = #{salerId,jdbcType=DECIMAL},
  525. </if>
  526. <if test="saleType != null">
  527. SALE_TYPE = #{saleType,jdbcType=DECIMAL},
  528. </if>
  529. </set>
  530. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  531. </update>
  532. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  533. <include refid="select" />
  534. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  535. </select>
  536. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  537. <include refid="select" />
  538. <include refid="where" />
  539. </select>
  540. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  541. <include refid="select" />
  542. <include refid="whereLike" />
  543. </select>
  544. <insert id="batchInsert" parameterType="java.util.List">
  545. insert into AMS_SALE_ORDER
  546. (SALE_ORDER_ID,
  547. PLAN_ID, SALE_NUMBER, SHIPPER_ID,
  548. RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  549. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
  550. SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  551. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
  552. SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  553. INSERT_TIME, UPDATE_USERNAME,
  554. UPDATE_TIME, INSERT_UPDATE_REMARK,
  555. DELETED, CLOSE_STATUS, SALER_ID,
  556. SALE_TYPE)
  557. ( <foreach collection="list" item="item" separator="union all">
  558. select
  559. #{item.saleOrderId,jdbcType=DECIMAL},
  560. #{item.planId,jdbcType=DECIMAL}, #{item.saleNumber,jdbcType=VARCHAR}, #{item.shipperId,jdbcType=DECIMAL},
  561. #{item.receiveId,jdbcType=DECIMAL}, #{item.saleAccountBalance,jdbcType=DECIMAL},
  562. #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}, #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL},
  563. #{item.saleOrderStatus,jdbcType=DECIMAL}, #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR},
  564. #{item.saleOrderIsselfMention,jdbcType=VARCHAR}, #{item.saleUnitPrice,jdbcType=DECIMAL},
  565. #{item.saleOrderTax,jdbcType=VARCHAR}, #{item.saleRemark,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  566. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  567. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  568. #{item.deleted,jdbcType=DECIMAL}, #{item.closeStatus,jdbcType=DECIMAL}, #{item.salerId,jdbcType=DECIMAL},
  569. #{item.saleType,jdbcType=DECIMAL} from dual
  570. </foreach> )
  571. </insert>
  572. <update id="batchUpdate" parameterType="java.util.List">
  573. update AMS_SALE_ORDER
  574. set
  575. SALE_ORDER_ID=
  576. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  577. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
  578. </foreach>
  579. ,PLAN_ID=
  580. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  581. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
  582. </foreach>
  583. ,SALE_NUMBER=
  584. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  585. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleNumber,jdbcType=VARCHAR}
  586. </foreach>
  587. ,SHIPPER_ID=
  588. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  589. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
  590. </foreach>
  591. ,RECEIVE_ID=
  592. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  593. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.receiveId,jdbcType=DECIMAL}
  594. </foreach>
  595. ,SALE_ACCOUNT_BALANCE=
  596. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  597. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleAccountBalance,jdbcType=DECIMAL}
  598. </foreach>
  599. ,SALE_CURRENT_ORDER_AMOUNT=
  600. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  601. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}
  602. </foreach>
  603. ,SALE_HISTORICAL_ORDER_AMOUNT=
  604. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  605. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL}
  606. </foreach>
  607. ,SALE_ORDER_STATUS=
  608. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  609. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderStatus,jdbcType=DECIMAL}
  610. </foreach>
  611. ,SALE_ORDER_RECEIVE_CUSTOMER=
  612. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  613. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR}
  614. </foreach>
  615. ,SALE_ORDER_ISSELF_MENTION=
  616. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  617. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderIsselfMention,jdbcType=VARCHAR}
  618. </foreach>
  619. ,SALE_UNIT_PRICE=
  620. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  621. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleUnitPrice,jdbcType=DECIMAL}
  622. </foreach>
  623. ,SALE_ORDER_TAX=
  624. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  625. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderTax,jdbcType=VARCHAR}
  626. </foreach>
  627. ,SALE_REMARK=
  628. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  629. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleRemark,jdbcType=VARCHAR}
  630. </foreach>
  631. ,INSERT_USERNAME=
  632. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  633. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  634. </foreach>
  635. ,INSERT_TIME=
  636. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  637. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  638. </foreach>
  639. ,UPDATE_USERNAME=
  640. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  641. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  642. </foreach>
  643. ,UPDATE_TIME=
  644. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  645. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  646. </foreach>
  647. ,INSERT_UPDATE_REMARK=
  648. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  649. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  650. </foreach>
  651. ,DELETED=
  652. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  653. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  654. </foreach>
  655. ,CLOSE_STATUS=
  656. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  657. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.closeStatus,jdbcType=DECIMAL}
  658. </foreach>
  659. ,SALER_ID=
  660. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  661. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.salerId,jdbcType=DECIMAL}
  662. </foreach>
  663. ,SALE_TYPE=
  664. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  665. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleType,jdbcType=DECIMAL}
  666. </foreach>
  667. where SALE_ORDER_ID in
  668. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  669. #{item.saleOrderId,jdbcType=DECIMAL}
  670. </foreach>
  671. </update>
  672. <delete id="batchDelete" parameterType="java.util.List">
  673. delete from AMS_SALE_ORDER
  674. where SALE_ORDER_ID in
  675. <foreach close=")" collection="list" item="id" open="(" separator=",">
  676. #{id}
  677. </foreach>
  678. </delete>
  679. <!-- 友情提示!!!-->
  680. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  681. <sql id="orderBy">
  682. <if test="orderField != null and orderField != ''">
  683. order by "${orderField}"
  684. <if test="orderType != null and orderType != ''">
  685. ${orderType}
  686. </if>
  687. </if>
  688. <if test="orderField == null ">
  689. order by "insertTime" desc
  690. </if>
  691. </sql>
  692. <!--根据销售订单号排序-->
  693. <sql id="orderBy1">
  694. <if test="orderField != null and orderField != ''">
  695. order by "${orderField}"
  696. <if test="orderType != null and orderType != ''">
  697. ${orderType}
  698. </if>
  699. </if>
  700. <if test="orderField == null ">
  701. order by "saleNumber" desc
  702. </if>
  703. </sql>
  704. <select id="getSaleOrderInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  705. select * from(
  706. select a_s_order.SALE_ORDER_ID "saleOrderId",
  707. a_s_order.SALE_NUMBER "saleNumber",
  708. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  709. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  710. r_shipper.SHIPPER_NAME "shipperName",
  711. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  712. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  713. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  714. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  715. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  716. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  717. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  718. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  719. a_s_order.SALE_REMARK "saleRemark",
  720. a_s_order.INSERT_TIME "insertTime"
  721. from AMS_SALE_ORDER a_s_order
  722. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  723. sum(tt.sum1) saleSum1,
  724. sum(tt.sum2) saleSum2
  725. from AMS_SALE_ORDER_MATERIAL sale_material
  726. left join
  727. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  728. sum(truckno_material.material_theoretical_weight) sum1,
  729. sum(truckno_material.sale_order_material_number) sum2
  730. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  731. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  732. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  733. group by
  734. sale_material.SALE_ORDER_ID) allmaterial_info
  735. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  736. left join RMS_SHIPPER r_shipper
  737. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  738. left join RMS_CONSIGNEE r_consignee
  739. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  740. where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0)
  741. <where>
  742. <if test="saleNumber != null">
  743. and
  744. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  745. "saleNumber" like '%${item}%'
  746. </foreach>
  747. </if>
  748. <if test="materialTheoreticalWeight != null">
  749. and
  750. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  751. "materialTheoreticalWeight" like '%${item}%'
  752. </foreach>
  753. </if>
  754. <if test="saleOrderMaterialNumber != null">
  755. and
  756. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  757. "saleOrderMaterialNumber" like '%${item}%'
  758. </foreach>
  759. </if>
  760. <if test="shipperName != null">
  761. and
  762. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  763. "shipperName" like '%${item}%'
  764. </foreach>
  765. </if>
  766. <if test="consigneeCompanyName != null">
  767. and
  768. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  769. "consigneeCompanyName" like '%${item}%'
  770. </foreach>
  771. </if>
  772. <if test="saleOrderIsselfMention != null">
  773. and
  774. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  775. "saleOrderIsselfMention" like '%${item}%'
  776. </foreach>
  777. </if>
  778. <if test="saleAccountBalance != null">
  779. and
  780. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  781. "saleAccountBalance" like '%${item}%'
  782. </foreach>
  783. </if>
  784. <if test="saleCurrentOrderAmount != null">
  785. and
  786. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  787. "saleCurrentOrderAmount" like '%${item}%'
  788. </foreach>
  789. </if>
  790. <if test="saleHistoricalOrderAmout != null">
  791. and
  792. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  793. "saleHistoricalOrderAmout" like '%${item}%'
  794. </foreach>
  795. </if>
  796. <if test="saleOrderReceiveCustomer != null">
  797. and
  798. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  799. "saleOrderReceiveCustomer" like '%${item}%'
  800. </foreach>
  801. </if>
  802. <if test="saleUnitPrice != null">
  803. and
  804. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  805. "saleUnitPrice" like '%${item}%'
  806. </foreach>
  807. </if>
  808. <if test="saleOrderTax != null">
  809. and
  810. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  811. "saleOrderTax" like '%${item}%'
  812. </foreach>
  813. </if>
  814. <if test="saleRemark != null">
  815. and
  816. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  817. "saleRemark" like '%${item}%'
  818. </foreach>
  819. </if>
  820. </where>
  821. <include refid="orderBy"></include>
  822. </select>
  823. <select id="getSaleOrderReported" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  824. select * from(
  825. select a_s_order.SALE_ORDER_ID "saleOrderId",
  826. a_s_order.SALE_NUMBER "saleNumber",
  827. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  828. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  829. r_shipper.SHIPPER_NAME "shipperName",
  830. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  831. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  832. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  833. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  834. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  835. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  836. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  837. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  838. a_s_order.SALE_REMARK "saleRemark",
  839. a_s_order.INSERT_TIME "insertTime"
  840. from AMS_SALE_ORDER a_s_order
  841. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  842. sum(tt.sum1) saleSum1,
  843. sum(tt.sum2) saleSum2
  844. from AMS_SALE_ORDER_MATERIAL sale_material
  845. left join
  846. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  847. sum(truckno_material.material_theoretical_weight) sum1,
  848. sum(truckno_material.sale_order_material_number) sum2
  849. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  850. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  851. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  852. group by
  853. sale_material.SALE_ORDER_ID) allmaterial_info
  854. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  855. left join RMS_SHIPPER r_shipper
  856. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  857. left join RMS_CONSIGNEE r_consignee
  858. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  859. where a_s_order.SALE_ORDER_STATUS=1)
  860. <where>
  861. <if test="saleNumber != null">
  862. and
  863. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  864. "saleNumber" like '%${item}%'
  865. </foreach>
  866. </if>
  867. <if test="materialTheoreticalWeight != null">
  868. and
  869. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  870. "materialTheoreticalWeight" like '%${item}%'
  871. </foreach>
  872. </if>
  873. <if test="saleOrderMaterialNumber != null">
  874. and
  875. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  876. "saleOrderMaterialNumber" like '%${item}%'
  877. </foreach>
  878. </if>
  879. <if test="shipperName != null">
  880. and
  881. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  882. "shipperName" like '%${item}%'
  883. </foreach>
  884. </if>
  885. <if test="consigneeCompanyName != null">
  886. and
  887. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  888. "consigneeCompanyName" like '%${item}%'
  889. </foreach>
  890. </if>
  891. <if test="saleOrderIsselfMention != null">
  892. and
  893. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  894. "saleOrderIsselfMention" like '%${item}%'
  895. </foreach>
  896. </if>
  897. <if test="saleAccountBalance != null">
  898. and
  899. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  900. "saleAccountBalance" like '%${item}%'
  901. </foreach>
  902. </if>
  903. <if test="saleCurrentOrderAmount != null">
  904. and
  905. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  906. "saleCurrentOrderAmount" like '%${item}%'
  907. </foreach>
  908. </if>
  909. <if test="saleHistoricalOrderAmout != null">
  910. and
  911. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  912. "saleHistoricalOrderAmout" like '%${item}%'
  913. </foreach>
  914. </if>
  915. <if test="saleOrderReceiveCustomer != null">
  916. and
  917. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  918. "saleOrderReceiveCustomer" like '%${item}%'
  919. </foreach>
  920. </if>
  921. <if test="saleUnitPrice != null">
  922. and
  923. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  924. "saleUnitPrice" like '%${item}%'
  925. </foreach>
  926. </if>
  927. <if test="saleOrderTax != null">
  928. and
  929. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  930. "saleOrderTax" like '%${item}%'
  931. </foreach>
  932. </if>
  933. <if test="saleRemark != null">
  934. and
  935. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  936. "saleRemark" like '%${item}%'
  937. </foreach>
  938. </if>
  939. </where>
  940. <include refid="orderBy"></include>
  941. </select>
  942. <select id="getSaleOrderDetail" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  943. select * from(
  944. select sale_material.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  945. sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  946. receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
  947. sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  948. sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  949. sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  950. sale_material.INSERT_TIME "insertTime"
  951. from AMS_SALE_ORDER_MATERIAL sale_material
  952. left join AMS_SALE_ORDER a_s_order
  953. on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  954. left join RMS_RECEIVE_ADDRESS receive_address
  955. on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
  956. where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0 and sale_material.UPDATED=0)
  957. <where>
  958. <if test="saleOrderMaterialTruckNo != null">
  959. and
  960. <foreach collection="saleOrderMaterialTruckNo" item="item" open="(" separator="or" close=")">
  961. "saleOrderMaterialTruckNo" like '%${item}%'
  962. </foreach>
  963. </if>
  964. <if test="materialName != null">
  965. and
  966. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  967. "materialName" like '%${item}%'
  968. </foreach>
  969. </if>
  970. <if test="materialSpecification != null">
  971. and
  972. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  973. "materialSpecification" like '%${item}%'
  974. </foreach>
  975. </if>
  976. <if test="saleOrderMaterialNumber != null">
  977. and
  978. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  979. "saleOrderMaterialNumber" like '%${item}%'
  980. </foreach>
  981. </if>
  982. <if test="materialTheoreticalWeight != null">
  983. and
  984. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  985. "materialTheoreticalWeight" like '%${item}%'
  986. </foreach>
  987. </if>
  988. <if test="saleShippingAddress != null">
  989. and
  990. <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
  991. "saleShippingAddress" like '%${item}%'
  992. </foreach>
  993. </if>
  994. <if test="saleDateOfReceipt != null">
  995. and
  996. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  997. "saleDateOfReceipt" like '%${item}%'
  998. </foreach>
  999. </if>
  1000. <if test="saleOrderConsignee != null">
  1001. and
  1002. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  1003. "saleOrderConsignee" like '%${item}%'
  1004. </foreach>
  1005. </if>
  1006. <if test="saleOrderConsigneeTel != null">
  1007. and
  1008. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  1009. "saleOrderConsigneeTel" like '%${item}%'
  1010. </foreach>
  1011. </if>
  1012. </where>
  1013. <include refid="orderBy"></include>
  1014. </select>
  1015. <select id="getSaleOrderUpdateLog" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1016. select * from(
  1017. select
  1018. sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  1019. receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
  1020. sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1021. sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1022. sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1023. sale_material.INSERT_TIME "insertTime"
  1024. from AMS_SALE_ORDER_MATERIAL sale_material
  1025. left join AMS_SALE_ORDER a_s_order
  1026. on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  1027. left join RMS_RECEIVE_ADDRESS receive_address
  1028. on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
  1029. where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0)
  1030. <where>
  1031. <if test="saleShippingAddress != null">
  1032. and
  1033. <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
  1034. "saleShippingAddress" like '%${item}%'
  1035. </foreach>
  1036. </if>
  1037. <if test="saleDateOfReceipt != null">
  1038. and
  1039. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  1040. "saleDateOfReceipt" like '%${item}%'
  1041. </foreach>
  1042. </if>
  1043. <if test="saleOrderConsignee != null">
  1044. and
  1045. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  1046. "saleOrderConsignee" like '%${item}%'
  1047. </foreach>
  1048. </if>
  1049. <if test="saleOrderConsigneeTel != null">
  1050. and
  1051. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  1052. "saleOrderConsigneeTel" like '%${item}%'
  1053. </foreach>
  1054. </if>
  1055. </where>
  1056. <include refid="orderBy"></include>
  1057. </select>
  1058. <!--销售计划-->
  1059. <select id="getSalePlanName" resultType="java.util.LinkedHashMap">
  1060. select
  1061. a_s_plan.PLAN_ID "id",
  1062. a_s_plan.PLAN_ID "value",
  1063. a_s_plan.PLAN_NAME "label"
  1064. from AMS_SALE_PLAN a_s_plan
  1065. </select>
  1066. <!-- 收货客户-->
  1067. <select id="getShipperName" resultType="java.util.LinkedHashMap">
  1068. select
  1069. SHIPPER_ID "id",
  1070. SHIPPER_ID "value",
  1071. SHIPPER_NAME "label"
  1072. from RMS_SHIPPER
  1073. </select>
  1074. <!-- 收货客户-->
  1075. <select id="getConsigneeCompanyName" resultType="java.util.LinkedHashMap">
  1076. select
  1077. CONSIGNEE_ID "id",
  1078. CONSIGNEE_ID "value",
  1079. CONSIGNEE_COMPANY_NAME "label"
  1080. from RMS_CONSIGNEE
  1081. where rownum &lt; 20
  1082. </select>
  1083. <!-- <select id="selectMaxId" resultType="java.math.BigDecimal">-->
  1084. <!-- select max(SALE_ORDER_ID) from AMS_SALE_ORDER-->
  1085. <!-- </select>-->
  1086. <select id="selectBySaleOrderId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  1087. select
  1088. a_s_order.PLAN_ID "planId",
  1089. a_s_order.SHIPPER_ID "shipperId",
  1090. a_s_order.RECEIVE_ID "consigneeId",
  1091. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1092. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1093. a_s_order.SALE_REMARK "saleRemark"
  1094. from AMS_SALE_ORDER a_s_order
  1095. where a_s_order.SALE_ORDER_ID = #{saleOrderId}
  1096. </select>
  1097. <update id="deleteBySaleOrderId" parameterType="java.math.BigDecimal">
  1098. update AMS_SALE_ORDER_MATERIAL set DELETED = 1 where SALE_ORDER_ID = #{saleOrderId}
  1099. </update>
  1100. <select id="getAmsSaleOrderApproved" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1101. select * from(
  1102. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1103. a_s_order.SALE_NUMBER "saleNumber",
  1104. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  1105. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  1106. r_shipper.SHIPPER_NAME "shipperName",
  1107. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1108. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1109. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1110. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1111. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1112. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1113. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1114. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1115. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1116. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1117. a_s_order.SALE_REMARK "saleRemark",
  1118. a_s_order.INSERT_TIME "insertTime"
  1119. from AMS_SALE_ORDER a_s_order
  1120. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  1121. sum(tt.sum1) saleSum1,
  1122. sum(tt.sum2) saleSum2
  1123. from AMS_SALE_ORDER_MATERIAL sale_material
  1124. left join
  1125. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  1126. sum(truckno_material.material_theoretical_weight) sum1,
  1127. sum(truckno_material.sale_order_material_number) sum2
  1128. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  1129. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  1130. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  1131. group by
  1132. sale_material.SALE_ORDER_ID) allmaterial_info
  1133. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  1134. left join RMS_SHIPPER r_shipper
  1135. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1136. left join RMS_CONSIGNEE r_consignee
  1137. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1138. where a_s_order.SALE_ORDER_STATUS=4)
  1139. <where>
  1140. <if test="saleNumber != null">
  1141. and
  1142. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1143. "saleNumber" like '%${item}%'
  1144. </foreach>
  1145. </if>
  1146. <if test="materialTheoreticalWeight != null">
  1147. and
  1148. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1149. "materialTheoreticalWeight" like '%${item}%'
  1150. </foreach>
  1151. </if>
  1152. <if test="saleOrderMaterialNumber != null">
  1153. and
  1154. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1155. "saleOrderMaterialNumber" like '%${item}%'
  1156. </foreach>
  1157. </if>
  1158. <if test="shipperName != null">
  1159. and
  1160. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1161. "shipperName" like '%${item}%'
  1162. </foreach>
  1163. </if>
  1164. <if test="consigneeCompanyName != null">
  1165. and
  1166. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1167. "consigneeCompanyName" like '%${item}%'
  1168. </foreach>
  1169. </if>
  1170. <if test="consigneeWarrantyAmount != null">
  1171. and
  1172. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1173. "consigneeWarrantyAmount" like '%${item}%'
  1174. </foreach>
  1175. </if>
  1176. <if test="consigneeWarrantyWeight != null">
  1177. and
  1178. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1179. "consigneeWarrantyWeight" like '%${item}%'
  1180. </foreach>
  1181. </if>
  1182. <if test="saleOrderIsselfMention != null">
  1183. and
  1184. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1185. "saleOrderIsselfMention" like '%${item}%'
  1186. </foreach>
  1187. </if>
  1188. <if test="saleAccountBalance != null">
  1189. and
  1190. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1191. "saleAccountBalance" like '%${item}%'
  1192. </foreach>
  1193. </if>
  1194. <if test="saleCurrentOrderAmount != null">
  1195. and
  1196. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1197. "saleCurrentOrderAmount" like '%${item}%'
  1198. </foreach>
  1199. </if>
  1200. <if test="saleHistoricalOrderAmout != null">
  1201. and
  1202. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1203. "saleHistoricalOrderAmout" like '%${item}%'
  1204. </foreach>
  1205. </if>
  1206. <if test="saleOrderReceiveCustomer != null">
  1207. and
  1208. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1209. "saleOrderReceiveCustomer" like '%${item}%'
  1210. </foreach>
  1211. </if>
  1212. <if test="saleUnitPrice != null">
  1213. and
  1214. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1215. "saleUnitPrice" like '%${item}%'
  1216. </foreach>
  1217. </if>
  1218. <if test="saleOrderTax != null">
  1219. and
  1220. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1221. "saleOrderTax" like '%${item}%'
  1222. </foreach>
  1223. </if>
  1224. <if test="saleRemark != null">
  1225. and
  1226. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1227. "saleRemark" like '%${item}%'
  1228. </foreach>
  1229. </if>
  1230. </where>
  1231. <include refid="orderBy"></include>
  1232. </select>
  1233. <!-- 展示所有销售公司已审核的销售订单 -->
  1234. <select id="getSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1235. select ADSO.DISPATCH_ID "dispatchId",
  1236. ASOM.SALE_ORDER_ID "saleOrderId",
  1237. ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1238. ASO.SALE_NUMBER "saleNumber",
  1239. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  1240. CONCAT(CONCAT(CONCAT(ADDRESS_PROVINCE, ADDRESS_DISTRICT), ADDRESS_TOWN),
  1241. RRP.ADDRESS_DELIVERY_ADDRESS) "addressDeliveryAddress",
  1242. TO_CHAR(ASOM.SALE_DATE_OF_RECEIPT, 'yyyy-mm-dd') "saleDateOfReceipt",
  1243. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1244. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1245. RS.SHIPPER_NAME "shipperName",
  1246. RC.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1247. ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1248. ADSO.DISPATCH_TIME "dispatchTime",
  1249. ADSO.INSERT_TIME AS "insertTime"
  1250. FROM AMS_SALE_ORDER ASO
  1251. JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1252. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1253. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  1254. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1255. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1256. ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRP.PLACE_ID
  1257. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1258. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1259. LEFT JOIN RMS_SHIPPER RS
  1260. ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  1261. LEFT JOIN RMS_CONSIGNEE RC
  1262. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  1263. WHERE ASO.SALE_ORDER_STATUS IN (2, 4)
  1264. AND ADSO.DISPATCH_STATUS = #{status}
  1265. AND ADSO.DISPATCH_TYPE = 0
  1266. order by ADSO.INSERT_TIME DESC
  1267. </select>
  1268. <select id="selectCarrierIdByprovince" resultType="java.math.BigDecimal" parameterType="java.util.Map">
  1269. SELECT RC.CARRIER_ID "carrierId"
  1270. FROM RMS_BID_AREA RBA
  1271. LEFT JOIN RMS_CARRIER RC
  1272. ON RBA.BID_AREA_ID=RC.CARRIER_BID_AREA_ID
  1273. WHERE RBA.BID_AREA_PROVINCE=#{province} AND RBA.BID_AREA_CITY=#{ditrict} AND RBA.BID_AREA_COUNTY=#{addressTown}
  1274. </select>
  1275. <select id="selectProvince" resultType="java.util.Map" parameterType="java.lang.Integer">
  1276. SELECT RRA.ADDRESS_PROVINCE "province",
  1277. RRA.ADDRESS_DISTRICT "ditrict",
  1278. RRA.ADDRESS_TOWN "addressTown"
  1279. FROM RMS_RECEIVE_ADDRESS RRA
  1280. WHERE RRA.ADDRESS_ID=#{addressId}
  1281. </select>
  1282. <!-- 销售公司查询已审核的销售订单 -->
  1283. <select id="getSaleOrderListBySaleCompany" parameterType="java.util.Map" resultType="java.util.Map">
  1284. select * from(
  1285. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1286. a_s_order.SALE_NUMBER "saleNumber",
  1287. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  1288. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  1289. r_shipper.SHIPPER_NAME "shipperName",
  1290. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1291. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1292. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1293. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1294. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1295. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1296. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1297. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1298. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1299. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1300. a_s_order.SALE_REMARK "saleRemark",
  1301. a_s_order.INSERT_TIME "insertTime"
  1302. from AMS_SALE_ORDER a_s_order
  1303. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  1304. sum(tt.sum1) saleSum1,
  1305. sum(tt.sum2) saleSum2
  1306. from AMS_SALE_ORDER_MATERIAL sale_material
  1307. left join
  1308. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  1309. sum(truckno_material.material_theoretical_weight) sum1,
  1310. sum(truckno_material.sale_order_material_number) sum2
  1311. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  1312. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  1313. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  1314. group by
  1315. sale_material.SALE_ORDER_ID) allmaterial_info
  1316. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  1317. left join RMS_SHIPPER r_shipper
  1318. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1319. left join RMS_CONSIGNEE r_consignee
  1320. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1321. where a_s_order.SALE_ORDER_STATUS=2)
  1322. <where>
  1323. <if test="saleNumber != null">
  1324. and
  1325. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1326. "saleNumber" like '%${item}%'
  1327. </foreach>
  1328. </if>
  1329. <if test="materialTheoreticalWeight != null">
  1330. and
  1331. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1332. "materialTheoreticalWeight" like '%${item}%'
  1333. </foreach>
  1334. </if>
  1335. <if test="saleOrderMaterialNumber != null">
  1336. and
  1337. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1338. "saleOrderMaterialNumber" like '%${item}%'
  1339. </foreach>
  1340. </if>
  1341. <if test="shipperName != null">
  1342. and
  1343. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1344. "shipperName" like '%${item}%'
  1345. </foreach>
  1346. </if>
  1347. <if test="consigneeCompanyName != null">
  1348. and
  1349. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1350. "consigneeCompanyName" like '%${item}%'
  1351. </foreach>
  1352. </if>
  1353. <if test="consigneeWarrantyAmount != null">
  1354. and
  1355. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1356. "consigneeWarrantyAmount" like '%${item}%'
  1357. </foreach>
  1358. </if>
  1359. <if test="consigneeWarrantyWeight != null">
  1360. and
  1361. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1362. "consigneeWarrantyWeight" like '%${item}%'
  1363. </foreach>
  1364. </if>
  1365. <if test="saleOrderIsselfMention != null">
  1366. and
  1367. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1368. "saleOrderIsselfMention" like '%${item}%'
  1369. </foreach>
  1370. </if>
  1371. <if test="saleAccountBalance != null">
  1372. and
  1373. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1374. "saleAccountBalance" like '%${item}%'
  1375. </foreach>
  1376. </if>
  1377. <if test="saleCurrentOrderAmount != null">
  1378. and
  1379. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1380. "saleCurrentOrderAmount" like '%${item}%'
  1381. </foreach>
  1382. </if>
  1383. <if test="saleHistoricalOrderAmout != null">
  1384. and
  1385. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1386. "saleHistoricalOrderAmout" like '%${item}%'
  1387. </foreach>
  1388. </if>
  1389. <if test="saleOrderReceiveCustomer != null">
  1390. and
  1391. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1392. "saleOrderReceiveCustomer" like '%${item}%'
  1393. </foreach>
  1394. </if>
  1395. <if test="saleUnitPrice != null">
  1396. and
  1397. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1398. "saleUnitPrice" like '%${item}%'
  1399. </foreach>
  1400. </if>
  1401. <if test="saleOrderTax != null">
  1402. and
  1403. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1404. "saleOrderTax" like '%${item}%'
  1405. </foreach>
  1406. </if>
  1407. <if test="saleRemark != null">
  1408. and
  1409. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1410. "saleRemark" like '%${item}%'
  1411. </foreach>
  1412. </if>
  1413. </where>
  1414. <include refid="orderBy"></include>
  1415. </select>
  1416. <!-- 通过收货地址,匹配对应的承运商-->
  1417. <select id="getCarrier" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  1418. select rc.carrier_id from rms_receive_address rra LEFT join rms_carrier rc on rra.ADDRESS_ID = rc.CARRIER_BID_AREA_ID
  1419. WHERE rra.address_id = #{param}
  1420. </select>
  1421. <select id="selectInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  1422. select distinct ASO.SHIPPER_ID "shipperId",
  1423. ASO.RECEIVE_ID "reciveId",
  1424. ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1425. ASO.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReciveCustomer",
  1426. ASO.SALE_REMARK "saleRemark"
  1427. from AMS_SALE_ORDER ASO
  1428. left join AMS_SALE_ORDER_MATERIAL ASOM
  1429. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1430. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1431. on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
  1432. left join RMS_MATERIAL RM
  1433. on RM.MATERIAL_ID=ASTM.MATERIAL_ID
  1434. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1435. </select>
  1436. <!-- 根据销售订单id查找物资信息 -->
  1437. <select id="selectMaterialInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.util.LinkedHashMap">
  1438. select distinct ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "cxh",
  1439. ASTM.SALE_ORDER_MATERIAL_NUMBER "orderPlanWeight",
  1440. RM.MATERIAL_CODE "materialCode",
  1441. RM.MATERIAL_NAME "materialName",
  1442. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",
  1443. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  1444. RM.MATERIAL_ID "materialId",
  1445. ASTM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1446. ASTM.TRUCKNO_MATERIAL_ID "trucknoMaterialId",
  1447. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1448. ASOM.SALE_SHIPPING_ADDRESS_ID "saleShipperAddressId",
  1449. CONCAT( CONCAT( CONCAT( RRA.ADDRESS_PROVINCE, RRA.ADDRESS_DISTRICT ), RRA.ADDRESS_TOWN ), RRA.ADDRESS_DELIVERY_ADDRESS ) "saleShipperAddressName",
  1450. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1451. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
  1452. from AMS_SALE_ORDER ASO
  1453. left join AMS_SALE_ORDER_MATERIAL ASOM
  1454. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1455. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1456. on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
  1457. left join RMS_MATERIAL RM
  1458. on RM.MATERIAL_ID=ASTM.MATERIAL_ID
  1459. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1460. ON ASOM.SALE_SHIPPING_ADDRESS_ID=RRA.ADDRESS_ID
  1461. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1462. </select>
  1463. <select id="selectSaleOrderMaterialIdBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  1464. select ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1465. ASTM.TRUCKNO_MATERIAL_ID "TruckNoMaterialId"
  1466. from AMS_SALE_ORDER ASO
  1467. left join AMS_SALE_ORDER_MATERIAL ASOM
  1468. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1469. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1470. on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
  1471. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1472. </select>
  1473. <select id="getSaleOrderInfoes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1474. select * from(
  1475. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1476. a_s_order.SALE_NUMBER "saleNumber",
  1477. r_shipper.SHIPPER_NAME "shipperName",
  1478. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1479. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1480. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1481. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1482. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1483. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1484. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1485. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1486. a_s_order.SALE_REMARK "saleRemark",
  1487. a_s_order.INSERT_TIME "insertTime"
  1488. from AMS_SALE_ORDER a_s_order
  1489. left join RMS_SHIPPER r_shipper
  1490. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1491. left join RMS_CONSIGNEE r_consignee
  1492. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1493. where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0
  1494. <if test="consigneeSsoId != null" >
  1495. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1496. </if>
  1497. )
  1498. <where>
  1499. <if test="saleNumber != null">
  1500. and
  1501. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1502. "saleNumber" like '%${item}%'
  1503. </foreach>
  1504. </if>
  1505. <if test="shipperName != null">
  1506. and
  1507. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1508. "shipperName" like '%${item}%'
  1509. </foreach>
  1510. </if>
  1511. <if test="consigneeCompanyName != null">
  1512. and
  1513. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1514. "consigneeCompanyName" like '%${item}%'
  1515. </foreach>
  1516. </if>
  1517. <if test="saleOrderIsselfMention != null">
  1518. and
  1519. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1520. "saleOrderIsselfMention" like '%${item}%'
  1521. </foreach>
  1522. </if>
  1523. <if test="saleAccountBalance != null">
  1524. and
  1525. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1526. "saleAccountBalance" like '%${item}%'
  1527. </foreach>
  1528. </if>
  1529. <if test="saleCurrentOrderAmount != null">
  1530. and
  1531. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1532. "saleCurrentOrderAmount" like '%${item}%'
  1533. </foreach>
  1534. </if>
  1535. <if test="saleHistoricalOrderAmout != null">
  1536. and
  1537. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1538. "saleHistoricalOrderAmout" like '%${item}%'
  1539. </foreach>
  1540. </if>
  1541. <if test="saleOrderReceiveCustomer != null">
  1542. and
  1543. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1544. "saleOrderReceiveCustomer" like '%${item}%'
  1545. </foreach>
  1546. </if>
  1547. <if test="saleUnitPrice != null">
  1548. and
  1549. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1550. "saleUnitPrice" like '%${item}%'
  1551. </foreach>
  1552. </if>
  1553. <if test="saleOrderTax != null">
  1554. and
  1555. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1556. "saleOrderTax" like '%${item}%'
  1557. </foreach>
  1558. </if>
  1559. <if test="saleRemark != null">
  1560. and
  1561. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1562. "saleRemark" like '%${item}%'
  1563. </foreach>
  1564. </if>
  1565. </where>
  1566. <include refid="orderBy"></include>
  1567. </select>
  1568. <select id="getSaleOrderReportedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1569. select * from(
  1570. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1571. a_s_order.SALE_NUMBER "saleNumber",
  1572. r_shipper.SHIPPER_NAME "shipperName",
  1573. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1574. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1575. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1576. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1577. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1578. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1579. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1580. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1581. a_s_order.SALE_REMARK "saleRemark",
  1582. a_s_order.INSERT_TIME "insertTime"
  1583. from AMS_SALE_ORDER a_s_order
  1584. left join RMS_SHIPPER r_shipper
  1585. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1586. left join RMS_CONSIGNEE r_consignee
  1587. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1588. where a_s_order.SALE_ORDER_STATUS=1
  1589. and a_s_order.DELETED = 0
  1590. <if test="consigneeSsoId != null">
  1591. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1592. </if>
  1593. )
  1594. <where>
  1595. <if test="saleNumber != null">
  1596. and
  1597. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1598. "saleNumber" like '%${item}%'
  1599. </foreach>
  1600. </if>
  1601. <if test="shipperName != null">
  1602. and
  1603. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1604. "shipperName" like '%${item}%'
  1605. </foreach>
  1606. </if>
  1607. <if test="consigneeCompanyName != null">
  1608. and
  1609. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1610. "consigneeCompanyName" like '%${item}%'
  1611. </foreach>
  1612. </if>
  1613. <if test="saleOrderIsselfMention != null">
  1614. and
  1615. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1616. "saleOrderIsselfMention" like '%${item}%'
  1617. </foreach>
  1618. </if>
  1619. <if test="saleAccountBalance != null">
  1620. and
  1621. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1622. "saleAccountBalance" like '%${item}%'
  1623. </foreach>
  1624. </if>
  1625. <if test="saleCurrentOrderAmount != null">
  1626. and
  1627. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1628. "saleCurrentOrderAmount" like '%${item}%'
  1629. </foreach>
  1630. </if>
  1631. <if test="saleHistoricalOrderAmout != null">
  1632. and
  1633. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1634. "saleHistoricalOrderAmout" like '%${item}%'
  1635. </foreach>
  1636. </if>
  1637. <if test="saleOrderReceiveCustomer != null">
  1638. and
  1639. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1640. "saleOrderReceiveCustomer" like '%${item}%'
  1641. </foreach>
  1642. </if>
  1643. <if test="saleUnitPrice != null">
  1644. and
  1645. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1646. "saleUnitPrice" like '%${item}%'
  1647. </foreach>
  1648. </if>
  1649. <if test="saleOrderTax != null">
  1650. and
  1651. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1652. "saleOrderTax" like '%${item}%'
  1653. </foreach>
  1654. </if>
  1655. <if test="saleRemark != null">
  1656. and
  1657. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1658. "saleRemark" like '%${item}%'
  1659. </foreach>
  1660. </if>
  1661. </where>
  1662. <include refid="orderBy"></include>
  1663. </select>
  1664. <!-- 销售公司查询已审核的焦炭销售订单 -->
  1665. <select id="getCokeSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1666. select * from(
  1667. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1668. a_s_order.SALE_NUMBER "saleNumber",
  1669. r_shipper.SHIPPER_NAME "shipperName",
  1670. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1671. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1672. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1673. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1674. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1675. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1676. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1677. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1678. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1679. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1680. a_s_order.SALE_REMARK "saleRemark",
  1681. a_s_order.INSERT_TIME "insertTime",
  1682. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
  1683. RM.MATERIAL_NAME "materialName",
  1684. a_s_order.CLOSE_STATUS "closeStatus"
  1685. from AMS_SALE_ORDER a_s_order
  1686. left join RMS_SHIPPER r_shipper
  1687. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1688. left join RMS_CONSIGNEE r_consignee
  1689. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1690. left join AMS_SALE_MATERIAL ASM
  1691. on ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1692. left join RMS_MATERIAL RM
  1693. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  1694. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1695. and a_s_order.CLOSE_STATUS is not null
  1696. and a_s_order.DELETED = 0) SSSR
  1697. <if test="con != null" >
  1698. where SSSR."consigneeCompanyName" LIKE #{con}
  1699. </if>
  1700. <if test="con != null" >
  1701. or SSSR."saleNumber" LIKE #{con}
  1702. </if>
  1703. <where>
  1704. <if test="saleNumber != null">
  1705. and
  1706. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1707. "saleNumber" like '%${item}%'
  1708. </foreach>
  1709. </if>
  1710. <if test="materialName != null">
  1711. and
  1712. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1713. "materialName" like '%${item}%'
  1714. </foreach>
  1715. </if>
  1716. <if test="statusStr != null">
  1717. and
  1718. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1719. "statusStr" like '%${item}%'
  1720. </foreach>
  1721. </if>
  1722. <if test="shipperName != null">
  1723. and
  1724. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1725. "shipperName" like '%${item}%'
  1726. </foreach>
  1727. </if>
  1728. <if test="consigneeCompanyName != null">
  1729. and
  1730. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1731. "consigneeCompanyName" like '%${item}%'
  1732. </foreach>
  1733. </if>
  1734. <if test="consigneeWarrantyAmount != null">
  1735. and
  1736. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1737. "consigneeWarrantyAmount" like '%${item}%'
  1738. </foreach>
  1739. </if>
  1740. <if test="consigneeWarrantyWeight != null">
  1741. and
  1742. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1743. "consigneeWarrantyWeight" like '%${item}%'
  1744. </foreach>
  1745. </if>
  1746. <if test="saleOrderIsselfMention != null">
  1747. and
  1748. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1749. "saleOrderIsselfMention" like '%${item}%'
  1750. </foreach>
  1751. </if>
  1752. <if test="saleAccountBalance != null">
  1753. and
  1754. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1755. "saleAccountBalance" like '%${item}%'
  1756. </foreach>
  1757. </if>
  1758. <if test="saleCurrentOrderAmount != null">
  1759. and
  1760. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1761. "saleCurrentOrderAmount" like '%${item}%'
  1762. </foreach>
  1763. </if>
  1764. <if test="saleHistoricalOrderAmout != null">
  1765. and
  1766. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1767. "saleHistoricalOrderAmout" like '%${item}%'
  1768. </foreach>
  1769. </if>
  1770. <if test="saleOrderReceiveCustomer != null">
  1771. and
  1772. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1773. "saleOrderReceiveCustomer" like '%${item}%'
  1774. </foreach>
  1775. </if>
  1776. <if test="saleUnitPrice != null">
  1777. and
  1778. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1779. "saleUnitPrice" like '%${item}%'
  1780. </foreach>
  1781. </if>
  1782. <if test="saleOrderTax != null">
  1783. and
  1784. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1785. "saleOrderTax" like '%${item}%'
  1786. </foreach>
  1787. </if>
  1788. <if test="saleRemark != null">
  1789. and
  1790. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1791. "saleRemark" like '%${item}%'
  1792. </foreach>
  1793. </if>
  1794. </where>
  1795. <include refid="orderBy"></include>
  1796. </select>
  1797. <select id="getSaleOrderListBySaleCompanyes" parameterType="java.util.Map" resultType="java.util.Map">
  1798. select * from(
  1799. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1800. a_s_order.SALE_NUMBER "saleNumber",
  1801. r_shipper.SHIPPER_NAME "shipperName",
  1802. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1803. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1804. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1805. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1806. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1807. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1808. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1809. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1810. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1811. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1812. a_s_order.SALE_REMARK "saleRemark",
  1813. a_s_order.INSERT_TIME "insertTime",
  1814. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
  1815. a_s_order.INSERT_UPDATE_REMARK "materialName"
  1816. from AMS_SALE_ORDER a_s_order
  1817. left join RMS_SHIPPER r_shipper
  1818. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1819. left join RMS_CONSIGNEE r_consignee
  1820. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1821. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1822. and a_s_order.CLOSE_STATUS is null
  1823. and a_s_order.DELETED = 0
  1824. <if test="con != null">
  1825. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1826. </if>
  1827. <if test="shipperId != null">
  1828. and a_s_order.SHIPPER_ID = #{shipperId}
  1829. </if>
  1830. <if test="saleType != null">
  1831. and a_s_order.SALE_TYPE = #{saleType}
  1832. </if>
  1833. <if test="saleType == null">
  1834. and a_s_order.SALE_TYPE is null
  1835. </if>
  1836. <if test="consigneeSsoId != null">
  1837. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1838. </if>
  1839. ORDER BY a_s_order.UPDATE_TIME DESC
  1840. )
  1841. <where>
  1842. <if test="saleNumber != null">
  1843. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1844. "saleNumber" like '%${item}%'
  1845. </foreach>
  1846. </if>
  1847. <if test="statusStr != null">
  1848. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1849. and "statusStr" like '%${item}%'
  1850. </foreach>
  1851. </if>
  1852. <!-- <if test="startTime != null">-->
  1853. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  1854. <!-- </if>-->
  1855. <!-- <if test="endTime != null">-->
  1856. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  1857. <!-- </if>-->
  1858. <if test="shipperName != null">
  1859. and
  1860. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1861. "shipperName" like '%${item}%'
  1862. </foreach>
  1863. </if>
  1864. <if test="consigneeCompanyName != null">
  1865. and
  1866. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1867. "consigneeCompanyName" like '%${item}%'
  1868. </foreach>
  1869. </if>
  1870. <if test="consigneeWarrantyAmount != null">
  1871. and
  1872. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1873. "consigneeWarrantyAmount" like '%${item}%'
  1874. </foreach>
  1875. </if>
  1876. <if test="consigneeWarrantyWeight != null">
  1877. and
  1878. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1879. "consigneeWarrantyWeight" like '%${item}%'
  1880. </foreach>
  1881. </if>
  1882. <if test="saleOrderIsselfMention != null">
  1883. and
  1884. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1885. "saleOrderIsselfMention" like '%${item}%'
  1886. </foreach>
  1887. </if>
  1888. <if test="saleAccountBalance != null">
  1889. and
  1890. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1891. "saleAccountBalance" like '%${item}%'
  1892. </foreach>
  1893. </if>
  1894. <if test="saleCurrentOrderAmount != null">
  1895. and
  1896. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1897. "saleCurrentOrderAmount" like '%${item}%'
  1898. </foreach>
  1899. </if>
  1900. <if test="saleHistoricalOrderAmout != null">
  1901. and
  1902. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1903. "saleHistoricalOrderAmout" like '%${item}%'
  1904. </foreach>
  1905. </if>
  1906. <if test="saleOrderReceiveCustomer != null">
  1907. and
  1908. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1909. "saleOrderReceiveCustomer" like '%${item}%'
  1910. </foreach>
  1911. </if>
  1912. <if test="saleUnitPrice != null">
  1913. and
  1914. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1915. "saleUnitPrice" like '%${item}%'
  1916. </foreach>
  1917. </if>
  1918. <if test="saleOrderTax != null">
  1919. and
  1920. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1921. "saleOrderTax" like '%${item}%'
  1922. </foreach>
  1923. </if>
  1924. <if test="saleRemark != null">
  1925. and
  1926. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1927. "saleRemark" like '%${item}%'
  1928. </foreach>
  1929. </if>
  1930. </where>
  1931. </select>
  1932. <select id="getAmsSaleOrderApprovedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1933. select * from(
  1934. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1935. a_s_order.SALE_NUMBER "saleNumber",
  1936. r_shipper.SHIPPER_NAME "shipperName",
  1937. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1938. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1939. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1940. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1941. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1942. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1943. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1944. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1945. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
  1946. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1947. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1948. a_s_order.SALE_REMARK "saleRemark",
  1949. a_s_order.INSERT_TIME "insertTime"
  1950. from AMS_SALE_ORDER a_s_order
  1951. left join RMS_SHIPPER r_shipper
  1952. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1953. left join RMS_CONSIGNEE r_consignee
  1954. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1955. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1956. AND a_s_order.SHIPPER_ID = 2
  1957. <if test="con != null">
  1958. and instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0
  1959. </if>
  1960. )
  1961. <where>
  1962. <if test="saleNumber != null">
  1963. and
  1964. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1965. "saleNumber" like '%${item}%'
  1966. </foreach>
  1967. </if>
  1968. <if test="statusStr != null">
  1969. and
  1970. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1971. "statusStr" like '%${item}%'
  1972. </foreach>
  1973. </if>
  1974. <if test="shipperName != null">
  1975. and
  1976. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1977. "shipperName" like '%${item}%'
  1978. </foreach>
  1979. </if>
  1980. <if test="consigneeCompanyName != null">
  1981. and
  1982. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1983. "consigneeCompanyName" like '%${item}%'
  1984. </foreach>
  1985. </if>
  1986. <if test="consigneeWarrantyAmount != null">
  1987. and
  1988. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1989. "consigneeWarrantyAmount" like '%${item}%'
  1990. </foreach>
  1991. </if>
  1992. <if test="consigneeWarrantyWeight != null">
  1993. and
  1994. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1995. "consigneeWarrantyWeight" like '%${item}%'
  1996. </foreach>
  1997. </if>
  1998. <if test="saleOrderIsselfMention != null">
  1999. and
  2000. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2001. "saleOrderIsselfMention" like '%${item}%'
  2002. </foreach>
  2003. </if>
  2004. <if test="saleAccountBalance != null">
  2005. and
  2006. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2007. "saleAccountBalance" like '%${item}%'
  2008. </foreach>
  2009. </if>
  2010. <if test="saleCurrentOrderAmount != null">
  2011. and
  2012. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2013. "saleCurrentOrderAmount" like '%${item}%'
  2014. </foreach>
  2015. </if>
  2016. <if test="saleHistoricalOrderAmout != null">
  2017. and
  2018. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2019. "saleHistoricalOrderAmout" like '%${item}%'
  2020. </foreach>
  2021. </if>
  2022. <if test="saleOrderReceiveCustomer != null">
  2023. and
  2024. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2025. "saleOrderReceiveCustomer" like '%${item}%'
  2026. </foreach>
  2027. </if>
  2028. <if test="saleUnitPrice != null">
  2029. and
  2030. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2031. "saleUnitPrice" like '%${item}%'
  2032. </foreach>
  2033. </if>
  2034. <if test="saleOrderTax != null">
  2035. and
  2036. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2037. "saleOrderTax" like '%${item}%'
  2038. </foreach>
  2039. </if>
  2040. <if test="saleRemark != null">
  2041. and
  2042. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2043. "saleRemark" like '%${item}%'
  2044. </foreach>
  2045. </if>
  2046. </where>
  2047. <include refid="orderBy"></include>
  2048. </select>
  2049. <select id="getSaleOrderAndMaterialById" resultType="java.util.Map" parameterType="java.util.Map">
  2050. SELECT *
  2051. FROM (
  2052. select ASO.SALE_ORDER_ID as "saleOrderId",
  2053. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2054. RM.MATERIAL_ID as "materialId",
  2055. ASO.SALE_NUMBER as "saleNumber",
  2056. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2057. RS.SHIPPER_NAME as "shipperName",
  2058. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2059. RM.MATERIAL_NAME as "materialName",
  2060. ASM.MATERIAL_NUMBER as "materialNumber",
  2061. ASM.MATERIAL_WEIGHT as "materialWeight",
  2062. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2063. RM.MATERIAL_CODE as "materialCode",
  2064. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  2065. nvl(sumWeight.weight ,0) as "netWeight",
  2066. nvl(sumWeight2.weight ,0) as "weight",
  2067. nvl(carCount.coun ,0) as "carCount"
  2068. from AMS_SALE_ORDER ASO
  2069. left join RMS_SHIPPER RS
  2070. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2071. left join RMS_CONSIGNEE RC
  2072. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2073. left join AMS_SALE_MATERIAL ASM
  2074. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2075. left join RMS_MATERIAL RM
  2076. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2077. left join (
  2078. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  2079. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2080. left join Omstruck_Order o_order
  2081. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2082. left join Tmstruck_Total_Result t_t_result
  2083. on o_order.order_id=t_t_result.order_id
  2084. left join Tmstruck_Weight_Result t_w_result
  2085. on t_t_result.result_total_id=t_w_result.result_total_id
  2086. GROUP BY
  2087. a_s_o_Material.SALE_ORDER_ID
  2088. ) sumWeight
  2089. on sumWeight.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2090. left join (
  2091. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2092. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2093. left join Omstruck_Order o_order
  2094. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2095. left join Tmstruck_Total_Result t_t_result
  2096. on o_order.order_id=t_t_result.order_id
  2097. left join Tmstruck_Weight_Result t_w_result
  2098. on t_t_result.result_total_id=t_w_result.result_total_id
  2099. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  2100. on o_order.order_id=o_o_material.ORDER_ID
  2101. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  2102. GROUP BY
  2103. a_s_o_Material.SALE_ORDER_ID
  2104. ) sumWeight2
  2105. on sumWeight2.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2106. left join (
  2107. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2108. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2109. left join Omstruck_Order o_order
  2110. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2111. left join Tmstruck_Total_Result t_t_result
  2112. on o_order.order_id=t_t_result.order_id
  2113. left join Tmstruck_Weight_Result t_w_result
  2114. on t_t_result.result_total_id=t_w_result.result_total_id
  2115. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  2116. GROUP BY
  2117. a_s_o_Material.SALE_ORDER_ID
  2118. ) carCount
  2119. on carCount.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2120. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2121. )
  2122. <where>
  2123. <if test="saleNumber != null">
  2124. and
  2125. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2126. "saleNumber" like '%${item}%'
  2127. </foreach>
  2128. </if>
  2129. <if test="shipperName != null">
  2130. and
  2131. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2132. "shipperName" like '%${item}%'
  2133. </foreach>
  2134. </if>
  2135. <if test="consigneeCompanyName != null">
  2136. and
  2137. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2138. "consigneeCompanyName" like '%${item}%'
  2139. </foreach>
  2140. </if>
  2141. <if test="materialName != null">
  2142. and
  2143. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2144. "materialName" like '%${item}%'
  2145. </foreach>
  2146. </if>
  2147. <if test="specificationModel != null">
  2148. and
  2149. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2150. "specificationModel" like '%${item}%'
  2151. </foreach>
  2152. </if>
  2153. <if test="materialCode != null">
  2154. and
  2155. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2156. "materialCode" like '%${item}%'
  2157. </foreach>
  2158. </if>
  2159. </where>
  2160. </select>
  2161. <select id="getSaleOrderAndMaterialById2" resultType="java.util.Map" parameterType="java.util.Map">
  2162. SELECT *
  2163. FROM (
  2164. select ASO.SALE_ORDER_ID as "saleOrderId",
  2165. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2166. RM.MATERIAL_ID as "materialId",
  2167. ASO.SALE_NUMBER as "saleNumber",
  2168. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2169. RS.SHIPPER_NAME as "shipperName",
  2170. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2171. RM.MATERIAL_NAME as "materialName",
  2172. ASM.MATERIAL_NUMBER as "materialNumber",
  2173. ASM.MATERIAL_WEIGHT as "materialWeight",
  2174. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2175. RM.MATERIAL_CODE as "materialCode"
  2176. from AMS_SALE_ORDER ASO
  2177. left join RMS_SHIPPER RS
  2178. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2179. left join RMS_CONSIGNEE RC
  2180. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2181. left join AMS_SALE_MATERIAL ASM
  2182. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2183. left join RMS_MATERIAL RM
  2184. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2185. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2186. )
  2187. <where>
  2188. <if test="saleNumber != null">
  2189. and
  2190. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2191. "saleNumber" like '%${item}%'
  2192. </foreach>
  2193. </if>
  2194. <if test="shipperName != null">
  2195. and
  2196. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2197. "shipperName" like '%${item}%'
  2198. </foreach>
  2199. </if>
  2200. <if test="consigneeCompanyName != null">
  2201. and
  2202. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2203. "consigneeCompanyName" like '%${item}%'
  2204. </foreach>
  2205. </if>
  2206. <if test="materialName != null">
  2207. and
  2208. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2209. "materialName" like '%${item}%'
  2210. </foreach>
  2211. </if>
  2212. <if test="specificationModel != null">
  2213. and
  2214. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2215. "specificationModel" like '%${item}%'
  2216. </foreach>
  2217. </if>
  2218. <if test="materialCode != null">
  2219. and
  2220. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2221. "materialCode" like '%${item}%'
  2222. </foreach>
  2223. </if>
  2224. </where>
  2225. </select>
  2226. <select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
  2227. SELECT * FROM (SELECT
  2228. RM.MATERIAL_NAME AS "materialName"
  2229. FROM AMS_SALE_MATERIAL ASM
  2230. LEFT JOIN RMS_MATERIAL RM
  2231. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2232. WHERE ASM.SALE_ORDER_ID = #{saleOrderId}
  2233. <if test="con != null">
  2234. AND instr(RM.MATERIAL_NAME, #{con}) > 0
  2235. </if>
  2236. )
  2237. <where>
  2238. <if test="materialName != null">
  2239. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2240. "materialName" like '%${item}%'
  2241. </foreach>
  2242. </if>
  2243. </where>
  2244. </select>
  2245. <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
  2246. SELECT SUM(twr.RESULT_NET_WEIGHT)
  2247. FROM AMS_SALE_ORDER_MATERIAL asom
  2248. left join OMSTRUCK_ORDER oo on oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  2249. left join TMSTRUCK_TOTAL_RESULT ttr on ttr.ORDER_ID = oo.ORDER_ID
  2250. left join TMSTRUCK_WEIGHT_RESULT twr on twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  2251. where asom.sale_order_id = #{saleOrderId}
  2252. </select>
  2253. <select id="getCarNum" parameterType="DECIMAL" resultType="DECIMAL">
  2254. SELECT COUNT(ASOM.SALE_ORDER_MATERIAL_ID)
  2255. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2256. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2257. </select>
  2258. <select id="getTruckNoAndMaterial" parameterType="DECIMAL" resultType="java.util.Map" >
  2259. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2260. RM.MATERIAL_NAME AS "materialName",
  2261. ASM.MATERIAL_ID AS "materialId",
  2262. ASM.MATERIAL_NUMBER AS "materialNumber",
  2263. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2264. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2265. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  2266. RM.MATERIAL_CODE AS "materialCode",
  2267. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  2268. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2269. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2270. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2271. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2272. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2273. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  2274. RC.CAPACITY_NUMBER AS "capacityNumber",
  2275. ADSO.CARRIER_ID AS "carrierId",
  2276. RCA.CARRIER_NAME AS "carrierName",
  2277. ASOM.TRUCK_REMARK AS "truckRemark"
  2278. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  2279. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2280. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2281. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2282. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2283. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2284. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2285. LEFT JOIN AMS_SALE_MATERIAL ASM
  2286. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  2287. LEFT JOIN RMS_MATERIAL RM
  2288. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2289. LEFT JOIN OMSTRUCK_ORDER OO
  2290. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2291. LEFT JOIN RMS_CAPACITY RC
  2292. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2293. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2294. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2295. LEFT JOIN RMS_CARRIER RCA
  2296. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2297. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2298. AND OO.ORDER_ID IS NULL
  2299. AND ADSO.DISPATCH_ID IS NOT NULL
  2300. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2301. </select>
  2302. <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
  2303. SELECT RRP.ADDRESS_ID AS "adddressId"
  2304. FROM RMS_RECEIVE_PLACE RRP
  2305. WHERE RRP.PLACE_ID = #{placeId}
  2306. </select>
  2307. <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
  2308. SELECT DISTINCT RC.CARRIER_ID AS "id",
  2309. RC.CARRIER_ID AS "value",
  2310. RC.CARRIER_NAME AS "label",
  2311. ACTP.PRICE_ID AS "priceId",
  2312. ACTP.PRICE_VALUE AS "priceValue"
  2313. FROM RMS_RECEIVE_PLACE RRP
  2314. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2315. ON ACTP.PLACE_ID = RRP.PLACE_ID
  2316. LEFT JOIN RMS_CARRIER RC
  2317. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  2318. WHERE RRP.PLACE_ID = #{placeId}
  2319. AND ACTP.CARRIER_ID IS NOT NULL
  2320. AND ACTP.DELETED = 0
  2321. ORDER BY ACTP.PRICE_VALUE DESC
  2322. </select>
  2323. <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
  2324. SELECT ACTP.PRICE_ID AS "priceId",
  2325. ACTP.PRICE_VALUE AS "priceValue"
  2326. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2327. WHERE ACTP.CARRIER_ID = #{carrierId}
  2328. AND ACTP.PLACE_ID = #{placeId}
  2329. AND ACTP.DELETED = 0
  2330. </select>
  2331. <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
  2332. select DISTINCT * from(
  2333. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2334. a_s_order.SALE_NUMBER "saleNumber",
  2335. r_shipper.SHIPPER_NAME "shipperName",
  2336. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2337. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2338. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2339. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2340. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2341. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2342. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2343. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2344. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2345. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2346. a_s_order.SALE_REMARK "saleRemark",
  2347. a_s_order.INSERT_TIME "insertTime",
  2348. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
  2349. a_s_order.INSERT_UPDATE_REMARK "materialName",
  2350. a_s_order.UPDATE_TIME "updateTime"
  2351. from AMS_SALE_ORDER a_s_order
  2352. left join RMS_SHIPPER r_shipper
  2353. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2354. left join RMS_CONSIGNEE r_consignee
  2355. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2356. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2357. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2358. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2359. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2360. LEFT JOIN RMS_CARRIER RC
  2361. ON RC.CARRIER_ID = ADSO.CARRIER_ID
  2362. LEFT JOIN OMSTRUCK_ORDER OO
  2363. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2364. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2365. and a_s_order.CLOSE_STATUS is null
  2366. and a_s_order.DELETED = 0
  2367. and ADSO.DISPATCH_TYPE = 2
  2368. and OO.ORDER_ID IS NULL
  2369. <if test="con != null">
  2370. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2371. </if>
  2372. <if test="carrierSsoId != null" >
  2373. and RC.CARRIER_SSO_ID = #{carrierSsoId}
  2374. </if>
  2375. )
  2376. <where>
  2377. <if test="saleNumber != null">
  2378. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2379. "saleNumber" like '%${item}%'
  2380. </foreach>
  2381. </if>
  2382. <if test="shipperName != null">
  2383. and
  2384. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2385. "shipperName" like '%${item}%'
  2386. </foreach>
  2387. </if>
  2388. <if test="consigneeCompanyName != null">
  2389. and
  2390. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2391. "consigneeCompanyName" like '%${item}%'
  2392. </foreach>
  2393. </if>
  2394. <if test="consigneeWarrantyAmount != null">
  2395. and
  2396. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2397. "consigneeWarrantyAmount" like '%${item}%'
  2398. </foreach>
  2399. </if>
  2400. <if test="consigneeWarrantyWeight != null">
  2401. and
  2402. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2403. "consigneeWarrantyWeight" like '%${item}%'
  2404. </foreach>
  2405. </if>
  2406. <if test="saleOrderIsselfMention != null">
  2407. and
  2408. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2409. "saleOrderIsselfMention" like '%${item}%'
  2410. </foreach>
  2411. </if>
  2412. <if test="saleAccountBalance != null">
  2413. and
  2414. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2415. "saleAccountBalance" like '%${item}%'
  2416. </foreach>
  2417. </if>
  2418. <if test="saleCurrentOrderAmount != null">
  2419. and
  2420. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2421. "saleCurrentOrderAmount" like '%${item}%'
  2422. </foreach>
  2423. </if>
  2424. <if test="saleHistoricalOrderAmout != null">
  2425. and
  2426. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2427. "saleHistoricalOrderAmout" like '%${item}%'
  2428. </foreach>
  2429. </if>
  2430. <if test="saleOrderReceiveCustomer != null">
  2431. and
  2432. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2433. "saleOrderReceiveCustomer" like '%${item}%'
  2434. </foreach>
  2435. </if>
  2436. <if test="saleUnitPrice != null">
  2437. and
  2438. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2439. "saleUnitPrice" like '%${item}%'
  2440. </foreach>
  2441. </if>
  2442. <if test="saleOrderTax != null">
  2443. and
  2444. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2445. "saleOrderTax" like '%${item}%'
  2446. </foreach>
  2447. </if>
  2448. <if test="saleRemark != null">
  2449. and
  2450. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2451. "saleRemark" like '%${item}%'
  2452. </foreach>
  2453. </if>
  2454. </where>
  2455. order by "updateTime" DESC
  2456. </select>
  2457. <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
  2458. select * from(
  2459. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2460. a_s_order.SALE_NUMBER "saleNumber",
  2461. r_shipper.SHIPPER_NAME "shipperName",
  2462. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2463. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2464. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2465. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2466. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2467. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2468. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2469. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2470. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2471. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2472. a_s_order.SALE_REMARK "saleRemark",
  2473. a_s_order.INSERT_TIME "insertTime",
  2474. a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
  2475. a_s_order.SALE_ORDER_STATUS "statusStr",
  2476. a_s_order.INSERT_UPDATE_REMARK "materialName"
  2477. from AMS_SALE_ORDER_CARRIER a_s_o_carrier
  2478. left join RMS_CARRIER r_carrier
  2479. on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
  2480. left join AMS_SALE_ORDER a_s_order
  2481. on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  2482. left join RMS_SHIPPER r_shipper
  2483. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2484. left join RMS_CONSIGNEE r_consignee
  2485. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2486. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2487. and a_s_order.CLOSE_STATUS is null
  2488. and a_s_order.DELETED = 0
  2489. <if test="carrierSsoId != null">
  2490. and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
  2491. </if>
  2492. <if test="con != null">
  2493. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2494. </if>
  2495. )
  2496. <where>
  2497. <if test="saleNumber != null">
  2498. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2499. "saleNumber" like '%${item}%'
  2500. </foreach>
  2501. </if>
  2502. <if test="shipperName != null">
  2503. and
  2504. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2505. "shipperName" like '%${item}%'
  2506. </foreach>
  2507. </if>
  2508. <if test="consigneeCompanyName != null">
  2509. and
  2510. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2511. "consigneeCompanyName" like '%${item}%'
  2512. </foreach>
  2513. </if>
  2514. <if test="consigneeWarrantyAmount != null">
  2515. and
  2516. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2517. "consigneeWarrantyAmount" like '%${item}%'
  2518. </foreach>
  2519. </if>
  2520. <if test="consigneeWarrantyWeight != null">
  2521. and
  2522. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2523. "consigneeWarrantyWeight" like '%${item}%'
  2524. </foreach>
  2525. </if>
  2526. <if test="saleOrderIsselfMention != null">
  2527. and
  2528. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2529. "saleOrderIsselfMention" like '%${item}%'
  2530. </foreach>
  2531. </if>
  2532. <if test="saleAccountBalance != null">
  2533. and
  2534. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2535. "saleAccountBalance" like '%${item}%'
  2536. </foreach>
  2537. </if>
  2538. <if test="saleCurrentOrderAmount != null">
  2539. and
  2540. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2541. "saleCurrentOrderAmount" like '%${item}%'
  2542. </foreach>
  2543. </if>
  2544. <if test="saleHistoricalOrderAmout != null">
  2545. and
  2546. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2547. "saleHistoricalOrderAmout" like '%${item}%'
  2548. </foreach>
  2549. </if>
  2550. <if test="saleOrderReceiveCustomer != null">
  2551. and
  2552. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2553. "saleOrderReceiveCustomer" like '%${item}%'
  2554. </foreach>
  2555. </if>
  2556. <if test="saleUnitPrice != null">
  2557. and
  2558. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2559. "saleUnitPrice" like '%${item}%'
  2560. </foreach>
  2561. </if>
  2562. <if test="saleOrderTax != null">
  2563. and
  2564. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2565. "saleOrderTax" like '%${item}%'
  2566. </foreach>
  2567. </if>
  2568. <if test="saleRemark != null">
  2569. and
  2570. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2571. "saleRemark" like '%${item}%'
  2572. </foreach>
  2573. </if>
  2574. </where>
  2575. <include refid="orderBy1"></include>
  2576. </select>
  2577. <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2578. SELECT *
  2579. FROM (
  2580. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2581. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2582. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2583. "addressDeliveryAddress",
  2584. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2585. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已审批',4, '财务已审批')
  2586. AS "approvalStatus",
  2587. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2588. RSH.SHIPPER_NAME AS "shipperName",
  2589. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2590. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2591. ASOM.INSERT_TIME AS "insertTime",
  2592. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2593. ASO.SALE_ORDER_ID AS "saleOrderId"
  2594. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2595. LEFT JOIN AMS_SALE_ORDER ASO
  2596. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2597. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2598. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2599. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2600. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2601. LEFT JOIN RMS_SHIPPER RSH
  2602. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2603. LEFT JOIN RMS_CONSIGNEE RCO
  2604. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2605. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2606. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2607. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  2608. AND ASOM.ISSUE_STATUS IS NULL
  2609. AND ADSO.CARRIER_ID IS NULL
  2610. AND ASO.DELETED = 0
  2611. )
  2612. <where>
  2613. <if test="saleNumber != null">
  2614. and
  2615. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2616. "saleNumber" like '%${item}%'
  2617. </foreach>
  2618. </if>
  2619. <if test="truckNo != null">
  2620. and
  2621. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2622. "truckNo" like '%${item}%'
  2623. </foreach>
  2624. </if>
  2625. <if test="addressDeliveryAddress != null">
  2626. and
  2627. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2628. "addressDeliveryAddress" like '%${item}%'
  2629. </foreach>
  2630. </if>
  2631. <if test="saleDateOfReceipt != null">
  2632. and
  2633. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2634. "saleDateOfReceipt" like '%${item}%'
  2635. </foreach>
  2636. </if>
  2637. <if test="saleOrderConsignee != null">
  2638. and
  2639. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2640. "saleOrderConsignee" like '%${item}%'
  2641. </foreach>
  2642. </if>
  2643. <if test="saleOrderConsigneeTel != null">
  2644. and
  2645. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2646. "saleOrderConsigneeTel" like '%${item}%'
  2647. </foreach>
  2648. </if>
  2649. <if test="shipperName != null">
  2650. and
  2651. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2652. "shipperName" like '%${item}%'
  2653. </foreach>
  2654. </if>
  2655. <if test="consigneeCompanyName != null">
  2656. and
  2657. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2658. "consigneeCompanyName" like '%${item}%'
  2659. </foreach>
  2660. </if>
  2661. <if test="isselfMention != null">
  2662. and
  2663. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2664. "isselfMention" like '%${item}%'
  2665. </foreach>
  2666. </if>
  2667. </where>
  2668. <include refid="orderBy"></include>
  2669. </select>
  2670. <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
  2671. SELECT
  2672. RM.MATERIAL_ID AS "materialId",
  2673. RM.MATERIAL_NAME AS "materialName",
  2674. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2675. RM.MATERIAL_CODE AS "materialCode",
  2676. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
  2677. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2678. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2679. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2680. LEFT JOIN AMS_SALE_MATERIAL ASM
  2681. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2682. LEFT JOIN RMS_MATERIAL RM
  2683. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2684. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2685. </select>
  2686. <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2687. SELECT DISTINCT *
  2688. FROM (
  2689. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2690. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2691. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2692. "addressDeliveryAddress",
  2693. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2694. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已审批',4, '财务已审批')
  2695. AS "approvalStatus",
  2696. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2697. RSH.SHIPPER_NAME AS "shipperName",
  2698. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2699. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2700. ASOM.INSERT_TIME AS "insertTime",
  2701. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2702. ASO.SALE_ORDER_ID AS "saleOrderId",
  2703. RCA.CARRIER_NAME AS "carrierName"
  2704. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2705. LEFT JOIN AMS_SALE_ORDER ASO
  2706. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2707. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2708. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2709. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2710. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2711. LEFT JOIN RMS_SHIPPER RSH
  2712. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2713. LEFT JOIN RMS_CONSIGNEE RCO
  2714. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2715. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2716. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2717. LEFT JOIN OMSTRUCK_ORDER OO
  2718. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2719. LEFT JOIN RMS_CARRIER RCA
  2720. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2721. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  2722. AND ASOM.ISSUE_STATUS IS NULL
  2723. AND ADSO.DISPATCH_TYPE = 2
  2724. AND OO.ORDER_ID IS NULL
  2725. AND ASO.DELETED = 0
  2726. )
  2727. <where>
  2728. <if test="saleNumber != null">
  2729. and
  2730. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2731. "saleNumber" like '%${item}%'
  2732. </foreach>
  2733. </if>
  2734. <if test="carrierName != null">
  2735. and
  2736. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  2737. "carrierName" like '%${item}%'
  2738. </foreach>
  2739. </if>
  2740. <if test="truckNo != null">
  2741. and
  2742. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2743. "truckNo" like '%${item}%'
  2744. </foreach>
  2745. </if>
  2746. <if test="addressDeliveryAddress != null">
  2747. and
  2748. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2749. "addressDeliveryAddress" like '%${item}%'
  2750. </foreach>
  2751. </if>
  2752. <if test="saleDateOfReceipt != null">
  2753. and
  2754. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2755. "saleDateOfReceipt" like '%${item}%'
  2756. </foreach>
  2757. </if>
  2758. <if test="saleOrderConsignee != null">
  2759. and
  2760. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2761. "saleOrderConsignee" like '%${item}%'
  2762. </foreach>
  2763. </if>
  2764. <if test="saleOrderConsigneeTel != null">
  2765. and
  2766. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2767. "saleOrderConsigneeTel" like '%${item}%'
  2768. </foreach>
  2769. </if>
  2770. <if test="shipperName != null">
  2771. and
  2772. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2773. "shipperName" like '%${item}%'
  2774. </foreach>
  2775. </if>
  2776. <if test="consigneeCompanyName != null">
  2777. and
  2778. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2779. "consigneeCompanyName" like '%${item}%'
  2780. </foreach>
  2781. </if>
  2782. <if test="isselfMention != null">
  2783. and
  2784. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2785. "isselfMention" like '%${item}%'
  2786. </foreach>
  2787. </if>
  2788. </where>
  2789. <include refid="orderBy"></include>
  2790. </select>
  2791. <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
  2792. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2793. RM.MATERIAL_NAME AS "materialName",
  2794. ASM.MATERIAL_ID AS "materialId",
  2795. ASM.MATERIAL_NUMBER AS "materialNumber",
  2796. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2797. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2798. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  2799. RM.MATERIAL_CODE AS "materialCode",
  2800. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  2801. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2802. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2803. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2804. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2805. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2806. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  2807. RC.CAPACITY_NUMBER AS "capacityNumber",
  2808. ADSO.CARRIER_ID AS "carrierId",
  2809. ASOM.TRUCK_REMARK AS "truckRemark"
  2810. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  2811. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2812. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2813. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2814. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2815. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2816. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2817. LEFT JOIN AMS_SALE_MATERIAL ASM
  2818. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  2819. LEFT JOIN RMS_MATERIAL RM
  2820. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2821. LEFT JOIN OMSTRUCK_ORDER OO
  2822. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2823. LEFT JOIN RMS_CAPACITY RC
  2824. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2825. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2826. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2827. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2828. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2829. </select>
  2830. <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2831. SELECT DISTINCT *
  2832. FROM (
  2833. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2834. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2835. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2836. "addressDeliveryAddress",
  2837. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2838. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已审批',4, '财务已审批')
  2839. AS "approvalStatus",
  2840. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2841. RSH.SHIPPER_NAME AS "shipperName",
  2842. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2843. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2844. ASOM.INSERT_TIME AS "insertTime",
  2845. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2846. ASO.SALE_ORDER_ID AS "saleOrderId",
  2847. RCA.CARRIER_NAME AS "carrierName"
  2848. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2849. LEFT JOIN AMS_SALE_ORDER ASO
  2850. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2851. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2852. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2853. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2854. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2855. LEFT JOIN RMS_SHIPPER RSH
  2856. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2857. LEFT JOIN RMS_CONSIGNEE RCO
  2858. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2859. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2860. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2861. LEFT JOIN OMSTRUCK_ORDER OO
  2862. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2863. LEFT JOIN RMS_CARRIER RCA
  2864. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2865. WHERE OO.ORDER_TYPE = 1
  2866. AND ASO.SALE_ORDER_STATUS IN (2,4)
  2867. AND ASOM.ISSUE_STATUS IS NULL
  2868. AND ADSO.DISPATCH_TYPE = 2
  2869. AND OO.ORDER_ID IS NOT NULL
  2870. AND OO.ORDER_STATUS IN (4,5)
  2871. )
  2872. <where>
  2873. <if test="saleNumber != null">
  2874. and
  2875. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2876. "saleNumber" like '%${item}%'
  2877. </foreach>
  2878. </if>
  2879. <if test="carrierName != null">
  2880. and
  2881. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  2882. "carrierName" like '%${item}%'
  2883. </foreach>
  2884. </if>
  2885. <if test="truckNo != null">
  2886. and
  2887. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2888. "truckNo" like '%${item}%'
  2889. </foreach>
  2890. </if>
  2891. <if test="addressDeliveryAddress != null">
  2892. and
  2893. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2894. "addressDeliveryAddress" like '%${item}%'
  2895. </foreach>
  2896. </if>
  2897. <if test="saleDateOfReceipt != null">
  2898. and
  2899. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2900. "saleDateOfReceipt" like '%${item}%'
  2901. </foreach>
  2902. </if>
  2903. <if test="saleOrderConsignee != null">
  2904. and
  2905. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2906. "saleOrderConsignee" like '%${item}%'
  2907. </foreach>
  2908. </if>
  2909. <if test="saleOrderConsigneeTel != null">
  2910. and
  2911. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2912. "saleOrderConsigneeTel" like '%${item}%'
  2913. </foreach>
  2914. </if>
  2915. <if test="shipperName != null">
  2916. and
  2917. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2918. "shipperName" like '%${item}%'
  2919. </foreach>
  2920. </if>
  2921. <if test="consigneeCompanyName != null">
  2922. and
  2923. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2924. "consigneeCompanyName" like '%${item}%'
  2925. </foreach>
  2926. </if>
  2927. <if test="isselfMention != null">
  2928. and
  2929. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2930. "isselfMention" like '%${item}%'
  2931. </foreach>
  2932. </if>
  2933. </where>
  2934. <include refid="orderBy"></include>
  2935. </select>
  2936. <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
  2937. SELECT ACTP.PRICE_ID AS "priceId"
  2938. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2939. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2940. ON ASOM.SALE_SHIPPING_ADDRESS_ID = ACTP.PLACE_ID
  2941. WHERE ACTP.CARRIER_ID = #{carrierId}
  2942. AND ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2943. </select>
  2944. <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
  2945. SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
  2946. FROM RMS_CONSIGNEE RC
  2947. WHERE RC.CONSIGNEE_ID = #{receiveId}
  2948. </select>
  2949. <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
  2950. SELECT RC.CARRIER_ID AS "carrierId"
  2951. FROM RMS_CARRIER RC
  2952. WHERE RC.CARRIER_NAME = #{consigneeName}
  2953. </select>
  2954. <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
  2955. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
  2956. ASO.SALE_REMARK AS "saleRemark",
  2957. ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
  2958. RSH.SHIPPER_ID AS "shipperId",
  2959. RSH.SHIPPER_NAME AS "shipperName",
  2960. RCO.CONSIGNEE_ID AS "receiveId",
  2961. RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
  2962. RSA.SALER_ID AS "salerId",
  2963. RSA.SALER_NAME AS "salerName"
  2964. FROM AMS_SALE_ORDER ASO
  2965. LEFT JOIN RMS_SHIPPER RSH
  2966. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2967. LEFT JOIN RMS_CONSIGNEE RCO
  2968. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2969. LEFT JOIN RMS_SALER RSA
  2970. ON RSA.SALER_ID = ASO.SALER_ID
  2971. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  2972. </select>
  2973. <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
  2974. SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2975. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2976. RRA.ADDRESS_ID AS "shipperAddressId",
  2977. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
  2978. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2979. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2980. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2981. ASM.MATERIAL_ID AS "materialId",
  2982. RM.MATERIAL_NAME AS "materialName",
  2983. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
  2984. RM.MATERIAL_CODE AS "materialCode",
  2985. ASM.MATERIAL_NUMBER AS "materialNumber",
  2986. ASM.STEEL_METER AS "steelMeters",
  2987. ASM.IS_POUND_SALE AS "isPoundSale"
  2988. FROM AMS_SALE_ORDER ASO
  2989. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2990. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2991. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2992. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2993. LEFT JOIN AMS_SALE_MATERIAL ASM
  2994. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2995. LEFT JOIN RMS_MATERIAL RM
  2996. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2997. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2998. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2999. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3000. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3001. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3002. </select>
  3003. <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.Map" >
  3004. SELECT DISTINCT *
  3005. FROM (SELECT RRP.PLACE_ID "placeId",
  3006. RRP.ADDRESS_DELIVERY_ADDRESS "place",
  3007. RRA.ADDRESS_ID "shipperAddressId",
  3008. RRA.ADDRESS_PROVINCE "addressProvince",
  3009. RRA.ADDRESS_DISTRICT "addressDistrict",
  3010. RRA.ADDRESS_TOWN "addressTown",
  3011. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
  3012. FROM AMS_SALE_ORDER ASO
  3013. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3014. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3015. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3016. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3017. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3018. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3019. WHERE ASO.RECEIVE_ID = #{receiveId}
  3020. AND RRP.PLACE_ID IS NOT NULL
  3021. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3022. )
  3023. WHERE rownum <![CDATA[
  3024. <
  3025. ]]> 2
  3026. </select>
  3027. <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
  3028. SELECT DISTINCT *
  3029. FROM (
  3030. SELECT RS.SALER_NAME "salerName",
  3031. RS.SALER_ID "salerId"
  3032. FROM AMS_SALE_ORDER ASO
  3033. LEFT JOIN RMS_SALER RS
  3034. ON RS.SALER_ID = ASO.SALER_ID
  3035. WHERE ASO.RECEIVE_ID = #{receiveId}
  3036. AND RS.SALER_ID IS NOT NULL
  3037. ORDER BY ASO.SALE_ORDER_ID DESC
  3038. )
  3039. WHERE rownum <![CDATA[
  3040. <
  3041. ]]> 2
  3042. </select>
  3043. <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
  3044. SELECT DISTINCT *
  3045. FROM (
  3046. SELECT OO.DRIVER_TEL "driverTel"
  3047. FROM RMS_CAPACITY RCA
  3048. LEFT JOIN OMSTRUCK_ORDER OO
  3049. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3050. WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
  3051. AND OO.ORDER_TYPE = 1
  3052. ORDER BY OO.ORDER_ID
  3053. )
  3054. WHERE ROWNUM <![CDATA[
  3055. <
  3056. ]]> 2
  3057. </select>
  3058. </mapper>