AmsSaleOrderMapper.xml 172 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171
  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. RM.MATERIAL_NAME "materialName",
  1489. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1490. RM.MATERIAL_MODEL "materialModel",
  1491. ASM.MATERIAL_NUMBER "materialNumber",
  1492. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1493. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1494. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
  1495. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId"
  1496. from AMS_SALE_ORDER a_s_order
  1497. left join RMS_SHIPPER r_shipper
  1498. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1499. left join RMS_CONSIGNEE r_consignee
  1500. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1501. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1502. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1503. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1504. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1505. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1506. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  1507. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1508. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1509. LEFT JOIN AMS_SALE_MATERIAL ASM
  1510. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1511. LEFT JOIN RMS_MATERIAL RM
  1512. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1513. LEFT JOIN RMS_SALER R_SALER
  1514. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1515. where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0
  1516. <if test="con != null">
  1517. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1518. </if>
  1519. <if test="consigneeSsoId != null" >
  1520. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1521. </if>
  1522. <if test="saler != null" >
  1523. and R_SALER.SALER_NAME = #{saler}
  1524. </if>
  1525. <if test="oneDate != null">
  1526. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1527. </if>
  1528. <if test="startDate != null">
  1529. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1530. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1531. </if>
  1532. )
  1533. <where>
  1534. <if test="saleNumber != null">
  1535. and
  1536. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1537. "saleNumber" like '%${item}%'
  1538. </foreach>
  1539. </if>
  1540. <if test="materialName != null">
  1541. and
  1542. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1543. "materialName" like '%${item}%'
  1544. </foreach>
  1545. </if>
  1546. <if test="specificationModel != null">
  1547. and
  1548. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  1549. "specificationModel" like '%${item}%'
  1550. </foreach>
  1551. </if>
  1552. <if test="materialModel != null">
  1553. and
  1554. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1555. "materialModel" like '%${item}%'
  1556. </foreach>
  1557. </if>
  1558. <if test="shipperName != null">
  1559. and
  1560. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1561. "shipperName" like '%${item}%'
  1562. </foreach>
  1563. </if>
  1564. <if test="consigneeCompanyName != null">
  1565. and
  1566. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1567. "consigneeCompanyName" like '%${item}%'
  1568. </foreach>
  1569. </if>
  1570. <if test="saleOrderIsselfMention != null">
  1571. and
  1572. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1573. "saleOrderIsselfMention" like '%${item}%'
  1574. </foreach>
  1575. </if>
  1576. <if test="saleAccountBalance != null">
  1577. and
  1578. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1579. "saleAccountBalance" like '%${item}%'
  1580. </foreach>
  1581. </if>
  1582. <if test="saleCurrentOrderAmount != null">
  1583. and
  1584. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1585. "saleCurrentOrderAmount" like '%${item}%'
  1586. </foreach>
  1587. </if>
  1588. <if test="saleHistoricalOrderAmout != null">
  1589. and
  1590. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1591. "saleHistoricalOrderAmout" like '%${item}%'
  1592. </foreach>
  1593. </if>
  1594. <if test="saleOrderReceiveCustomer != null">
  1595. and
  1596. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1597. "saleOrderReceiveCustomer" like '%${item}%'
  1598. </foreach>
  1599. </if>
  1600. <if test="saleUnitPrice != null">
  1601. and
  1602. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1603. "saleUnitPrice" like '%${item}%'
  1604. </foreach>
  1605. </if>
  1606. <if test="saleOrderTax != null">
  1607. and
  1608. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1609. "saleOrderTax" like '%${item}%'
  1610. </foreach>
  1611. </if>
  1612. <if test="saleRemark != null">
  1613. and
  1614. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1615. "saleRemark" like '%${item}%'
  1616. </foreach>
  1617. </if>
  1618. </where>
  1619. <include refid="orderBy"></include>
  1620. </select>
  1621. <select id="getSaleOrderReportedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1622. select * from(
  1623. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1624. a_s_order.SALE_NUMBER "saleNumber",
  1625. r_shipper.SHIPPER_NAME "shipperName",
  1626. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1627. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1628. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1629. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1630. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1631. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1632. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1633. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1634. a_s_order.SALE_REMARK "saleRemark",
  1635. a_s_order.INSERT_TIME "insertTime",
  1636. RM.MATERIAL_NAME "materialName",
  1637. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1638. RM.MATERIAL_MODEL "materialModel",
  1639. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1640. ASM.MATERIAL_NUMBER "materialNumber",
  1641. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1642. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace"
  1643. from AMS_SALE_ORDER a_s_order
  1644. left join RMS_SHIPPER r_shipper
  1645. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1646. left join RMS_CONSIGNEE r_consignee
  1647. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1648. left join AMS_SALE_ORDER_MATERIAL ASOM
  1649. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1650. left join RMS_RECEIVE_PLACE RRP
  1651. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1652. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1653. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1654. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1655. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1656. LEFT JOIN AMS_SALE_MATERIAL ASM
  1657. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1658. LEFT JOIN RMS_MATERIAL RM
  1659. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1660. LEFT JOIN RMS_SALER R_SALER
  1661. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1662. where a_s_order.SALE_ORDER_STATUS=1
  1663. and a_s_order.DELETED = 0
  1664. <if test="con != null">
  1665. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1666. </if>
  1667. <if test="oneDate != null">
  1668. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1669. </if>
  1670. <if test="startDate != null">
  1671. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1672. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1673. </if>
  1674. <if test="consigneeSsoId != null">
  1675. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1676. </if>
  1677. <if test="saler != null" >
  1678. and R_SALER.SALER_NAME = #{saler}
  1679. </if>
  1680. )
  1681. <where>
  1682. <if test="saleNumber != null">
  1683. and
  1684. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1685. "saleNumber" like '%${item}%'
  1686. </foreach>
  1687. </if>
  1688. <if test="materialName != null">
  1689. and
  1690. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1691. "materialName" like '%${item}%'
  1692. </foreach>
  1693. </if>
  1694. <if test="materialModel != null">
  1695. and
  1696. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1697. "materialModel" like '%${item}%'
  1698. </foreach>
  1699. </if>
  1700. <if test="materialSpecification != null">
  1701. and
  1702. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1703. "materialSpecification" like '%${item}%'
  1704. </foreach>
  1705. </if>
  1706. <if test="shipperName != null">
  1707. and
  1708. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1709. "shipperName" like '%${item}%'
  1710. </foreach>
  1711. </if>
  1712. <if test="consigneeCompanyName != null">
  1713. and
  1714. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1715. "consigneeCompanyName" like '%${item}%'
  1716. </foreach>
  1717. </if>
  1718. <if test="saleOrderIsselfMention != null">
  1719. and
  1720. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1721. "saleOrderIsselfMention" like '%${item}%'
  1722. </foreach>
  1723. </if>
  1724. <if test="saleAccountBalance != null">
  1725. and
  1726. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1727. "saleAccountBalance" like '%${item}%'
  1728. </foreach>
  1729. </if>
  1730. <if test="saleCurrentOrderAmount != null">
  1731. and
  1732. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1733. "saleCurrentOrderAmount" like '%${item}%'
  1734. </foreach>
  1735. </if>
  1736. <if test="saleHistoricalOrderAmout != null">
  1737. and
  1738. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1739. "saleHistoricalOrderAmout" like '%${item}%'
  1740. </foreach>
  1741. </if>
  1742. <if test="saleOrderReceiveCustomer != null">
  1743. and
  1744. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1745. "saleOrderReceiveCustomer" like '%${item}%'
  1746. </foreach>
  1747. </if>
  1748. <if test="saleUnitPrice != null">
  1749. and
  1750. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1751. "saleUnitPrice" like '%${item}%'
  1752. </foreach>
  1753. </if>
  1754. <if test="saleOrderTax != null">
  1755. and
  1756. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1757. "saleOrderTax" like '%${item}%'
  1758. </foreach>
  1759. </if>
  1760. <if test="saleRemark != null">
  1761. and
  1762. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1763. "saleRemark" like '%${item}%'
  1764. </foreach>
  1765. </if>
  1766. </where>
  1767. <include refid="orderBy"></include>
  1768. </select>
  1769. <!-- 销售公司查询已审核的焦炭销售订单 -->
  1770. <select id="getCokeSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1771. select * from(
  1772. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1773. a_s_order.SALE_NUMBER "saleNumber",
  1774. r_shipper.SHIPPER_NAME "shipperName",
  1775. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1776. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1777. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1778. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1779. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1780. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1781. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1782. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1783. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1784. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1785. a_s_order.SALE_REMARK "saleRemark",
  1786. a_s_order.INSERT_TIME "insertTime",
  1787. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  1788. RM.MATERIAL_NAME "materialName",
  1789. a_s_order.CLOSE_STATUS "closeStatus"
  1790. from AMS_SALE_ORDER a_s_order
  1791. left join RMS_SHIPPER r_shipper
  1792. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1793. left join RMS_CONSIGNEE r_consignee
  1794. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1795. left join AMS_SALE_MATERIAL ASM
  1796. on ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1797. left join RMS_MATERIAL RM
  1798. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  1799. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1800. and a_s_order.CLOSE_STATUS is not null
  1801. and a_s_order.DELETED = 0) SSSR
  1802. <if test="con != null" >
  1803. where SSSR."consigneeCompanyName" LIKE #{con}
  1804. </if>
  1805. <if test="con != null" >
  1806. or SSSR."saleNumber" LIKE #{con}
  1807. </if>
  1808. <where>
  1809. <if test="saleNumber != null">
  1810. and
  1811. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1812. "saleNumber" like '%${item}%'
  1813. </foreach>
  1814. </if>
  1815. <if test="materialName != null">
  1816. and
  1817. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1818. "materialName" like '%${item}%'
  1819. </foreach>
  1820. </if>
  1821. <if test="statusStr != null">
  1822. and
  1823. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1824. "statusStr" like '%${item}%'
  1825. </foreach>
  1826. </if>
  1827. <if test="shipperName != null">
  1828. and
  1829. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1830. "shipperName" like '%${item}%'
  1831. </foreach>
  1832. </if>
  1833. <if test="consigneeCompanyName != null">
  1834. and
  1835. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1836. "consigneeCompanyName" like '%${item}%'
  1837. </foreach>
  1838. </if>
  1839. <if test="consigneeWarrantyAmount != null">
  1840. and
  1841. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1842. "consigneeWarrantyAmount" like '%${item}%'
  1843. </foreach>
  1844. </if>
  1845. <if test="consigneeWarrantyWeight != null">
  1846. and
  1847. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1848. "consigneeWarrantyWeight" like '%${item}%'
  1849. </foreach>
  1850. </if>
  1851. <if test="saleOrderIsselfMention != null">
  1852. and
  1853. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1854. "saleOrderIsselfMention" like '%${item}%'
  1855. </foreach>
  1856. </if>
  1857. <if test="saleAccountBalance != null">
  1858. and
  1859. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1860. "saleAccountBalance" like '%${item}%'
  1861. </foreach>
  1862. </if>
  1863. <if test="saleCurrentOrderAmount != null">
  1864. and
  1865. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1866. "saleCurrentOrderAmount" like '%${item}%'
  1867. </foreach>
  1868. </if>
  1869. <if test="saleHistoricalOrderAmout != null">
  1870. and
  1871. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1872. "saleHistoricalOrderAmout" like '%${item}%'
  1873. </foreach>
  1874. </if>
  1875. <if test="saleOrderReceiveCustomer != null">
  1876. and
  1877. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1878. "saleOrderReceiveCustomer" like '%${item}%'
  1879. </foreach>
  1880. </if>
  1881. <if test="saleUnitPrice != null">
  1882. and
  1883. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1884. "saleUnitPrice" like '%${item}%'
  1885. </foreach>
  1886. </if>
  1887. <if test="saleOrderTax != null">
  1888. and
  1889. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1890. "saleOrderTax" like '%${item}%'
  1891. </foreach>
  1892. </if>
  1893. <if test="saleRemark != null">
  1894. and
  1895. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1896. "saleRemark" like '%${item}%'
  1897. </foreach>
  1898. </if>
  1899. </where>
  1900. <include refid="orderBy"></include>
  1901. </select>
  1902. <select id="getSaleOrderListBySaleCompanyes" parameterType="java.util.Map" resultType="java.util.Map">
  1903. select * from(
  1904. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1905. a_s_order.SALE_NUMBER "saleNumber",
  1906. r_shipper.SHIPPER_NAME "shipperName",
  1907. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1908. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1909. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1910. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1911. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1912. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1913. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1914. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1915. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1916. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1917. a_s_order.SALE_REMARK "saleRemark",
  1918. a_s_order.INSERT_TIME "insertTime",
  1919. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  1920. RM.MATERIAL_NAME "materialName",
  1921. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1922. RM.MATERIAL_MODEL "materialModel",
  1923. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1924. ASM.MATERIAL_NUMBER "materialNumber",
  1925. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1926. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
  1927. ASM.SALE_WAREHOUSE "saleWareHouse",
  1928. a_s_order.DELETED "deleted",
  1929. a_s_order.SHIPPER_ID "shipperId",
  1930. a_s_order.RECEIVE_ID "receiveId",
  1931. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention",
  1932. a_s_order.SALER_ID "salerId"
  1933. from AMS_SALE_ORDER a_s_order
  1934. left join RMS_SHIPPER r_shipper
  1935. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1936. left join RMS_CONSIGNEE r_consignee
  1937. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1938. left join AMS_SALE_ORDER_MATERIAL ASOM
  1939. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1940. left join RMS_RECEIVE_PLACE RRP
  1941. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1942. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1943. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1944. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1945. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1946. LEFT JOIN AMS_SALE_MATERIAL ASM
  1947. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1948. LEFT JOIN RMS_MATERIAL RM
  1949. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1950. LEFT JOIN RMS_SALER R_SALER
  1951. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1952. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1953. and a_s_order.CLOSE_STATUS is null
  1954. and a_s_order.DELETED = 0
  1955. <if test="con != null">
  1956. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1957. </if>
  1958. <if test="oneDate != null">
  1959. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1960. </if>
  1961. <if test="startDate != null">
  1962. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1963. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1964. </if>
  1965. <if test="shipperId != null">
  1966. and a_s_order.SHIPPER_ID = #{shipperId}
  1967. </if>
  1968. <if test="saleType != null">
  1969. and a_s_order.SALE_TYPE = #{saleType}
  1970. </if>
  1971. <if test="saleType == null">
  1972. and a_s_order.SALE_TYPE is null
  1973. </if>
  1974. <if test="saler != null" >
  1975. and R_SALER.SALER_NAME = #{saler}
  1976. </if>
  1977. <if test="consigneeSsoId != null">
  1978. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1979. </if>
  1980. ORDER BY a_s_order.UPDATE_TIME DESC
  1981. )
  1982. <where>
  1983. <if test="saleNumber != null">
  1984. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1985. "saleNumber" like '%${item}%'
  1986. </foreach>
  1987. </if>
  1988. <if test="materialName != null">
  1989. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1990. "materialName" like '%${item}%'
  1991. </foreach>
  1992. </if>
  1993. <if test="materialSpecification != null">
  1994. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1995. "materialSpecification" like '%${item}%'
  1996. </foreach>
  1997. </if>
  1998. <if test="materialModel != null">
  1999. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2000. "materialModel" like '%${item}%'
  2001. </foreach>
  2002. </if>
  2003. <if test="statusStr != null">
  2004. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  2005. and "statusStr" like '%${item}%'
  2006. </foreach>
  2007. </if>
  2008. <!-- <if test="startTime != null">-->
  2009. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  2010. <!-- </if>-->
  2011. <!-- <if test="endTime != null">-->
  2012. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  2013. <!-- </if>-->
  2014. <if test="shipperName != null">
  2015. and
  2016. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2017. "shipperName" like '%${item}%'
  2018. </foreach>
  2019. </if>
  2020. <if test="consigneeCompanyName != null">
  2021. and
  2022. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2023. "consigneeCompanyName" like '%${item}%'
  2024. </foreach>
  2025. </if>
  2026. <if test="consigneeWarrantyAmount != null">
  2027. and
  2028. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2029. "consigneeWarrantyAmount" like '%${item}%'
  2030. </foreach>
  2031. </if>
  2032. <if test="consigneeWarrantyWeight != null">
  2033. and
  2034. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2035. "consigneeWarrantyWeight" like '%${item}%'
  2036. </foreach>
  2037. </if>
  2038. <if test="saleOrderIsselfMention != null">
  2039. and
  2040. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2041. "saleOrderIsselfMention" like '%${item}%'
  2042. </foreach>
  2043. </if>
  2044. <if test="saleAccountBalance != null">
  2045. and
  2046. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2047. "saleAccountBalance" like '%${item}%'
  2048. </foreach>
  2049. </if>
  2050. <if test="saleCurrentOrderAmount != null">
  2051. and
  2052. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2053. "saleCurrentOrderAmount" like '%${item}%'
  2054. </foreach>
  2055. </if>
  2056. <if test="saleHistoricalOrderAmout != null">
  2057. and
  2058. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2059. "saleHistoricalOrderAmout" like '%${item}%'
  2060. </foreach>
  2061. </if>
  2062. <if test="saleOrderReceiveCustomer != null">
  2063. and
  2064. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2065. "saleOrderReceiveCustomer" like '%${item}%'
  2066. </foreach>
  2067. </if>
  2068. <if test="saleUnitPrice != null">
  2069. and
  2070. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2071. "saleUnitPrice" like '%${item}%'
  2072. </foreach>
  2073. </if>
  2074. <if test="saleOrderTax != null">
  2075. and
  2076. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2077. "saleOrderTax" like '%${item}%'
  2078. </foreach>
  2079. </if>
  2080. <if test="saleRemark != null">
  2081. and
  2082. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2083. "saleRemark" like '%${item}%'
  2084. </foreach>
  2085. </if>
  2086. </where>
  2087. </select>
  2088. <select id="getAmsSaleOrderApprovedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  2089. select * from(
  2090. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2091. a_s_order.SALE_NUMBER "saleNumber",
  2092. r_shipper.SHIPPER_NAME "shipperName",
  2093. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2094. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2095. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2096. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2097. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2098. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2099. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2100. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2101. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2102. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2103. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2104. a_s_order.SALE_REMARK "saleRemark",
  2105. a_s_order.INSERT_TIME "insertTime"
  2106. from AMS_SALE_ORDER a_s_order
  2107. left join RMS_SHIPPER r_shipper
  2108. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2109. left join RMS_CONSIGNEE r_consignee
  2110. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2111. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2112. AND a_s_order.SHIPPER_ID = 2
  2113. <if test="con != null">
  2114. and instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0
  2115. </if>
  2116. )
  2117. <where>
  2118. <if test="saleNumber != null">
  2119. and
  2120. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2121. "saleNumber" like '%${item}%'
  2122. </foreach>
  2123. </if>
  2124. <if test="statusStr != null">
  2125. and
  2126. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  2127. "statusStr" like '%${item}%'
  2128. </foreach>
  2129. </if>
  2130. <if test="shipperName != null">
  2131. and
  2132. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2133. "shipperName" like '%${item}%'
  2134. </foreach>
  2135. </if>
  2136. <if test="consigneeCompanyName != null">
  2137. and
  2138. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2139. "consigneeCompanyName" like '%${item}%'
  2140. </foreach>
  2141. </if>
  2142. <if test="consigneeWarrantyAmount != null">
  2143. and
  2144. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2145. "consigneeWarrantyAmount" like '%${item}%'
  2146. </foreach>
  2147. </if>
  2148. <if test="consigneeWarrantyWeight != null">
  2149. and
  2150. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2151. "consigneeWarrantyWeight" like '%${item}%'
  2152. </foreach>
  2153. </if>
  2154. <if test="saleOrderIsselfMention != null">
  2155. and
  2156. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2157. "saleOrderIsselfMention" like '%${item}%'
  2158. </foreach>
  2159. </if>
  2160. <if test="saleAccountBalance != null">
  2161. and
  2162. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2163. "saleAccountBalance" like '%${item}%'
  2164. </foreach>
  2165. </if>
  2166. <if test="saleCurrentOrderAmount != null">
  2167. and
  2168. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2169. "saleCurrentOrderAmount" like '%${item}%'
  2170. </foreach>
  2171. </if>
  2172. <if test="saleHistoricalOrderAmout != null">
  2173. and
  2174. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2175. "saleHistoricalOrderAmout" like '%${item}%'
  2176. </foreach>
  2177. </if>
  2178. <if test="saleOrderReceiveCustomer != null">
  2179. and
  2180. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2181. "saleOrderReceiveCustomer" like '%${item}%'
  2182. </foreach>
  2183. </if>
  2184. <if test="saleUnitPrice != null">
  2185. and
  2186. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2187. "saleUnitPrice" like '%${item}%'
  2188. </foreach>
  2189. </if>
  2190. <if test="saleOrderTax != null">
  2191. and
  2192. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2193. "saleOrderTax" like '%${item}%'
  2194. </foreach>
  2195. </if>
  2196. <if test="saleRemark != null">
  2197. and
  2198. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2199. "saleRemark" like '%${item}%'
  2200. </foreach>
  2201. </if>
  2202. </where>
  2203. <include refid="orderBy"></include>
  2204. </select>
  2205. <select id="getSaleOrderAndMaterialById" resultType="java.util.Map" parameterType="java.util.Map">
  2206. SELECT *
  2207. FROM (
  2208. select ASO.SALE_ORDER_ID as "saleOrderId",
  2209. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2210. RM.MATERIAL_ID as "materialId",
  2211. ASO.SALE_NUMBER as "saleNumber",
  2212. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2213. RS.SHIPPER_NAME as "shipperName",
  2214. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2215. RM.MATERIAL_NAME as "materialName",
  2216. ASM.MATERIAL_NUMBER as "materialNumber",
  2217. ASM.MATERIAL_WEIGHT as "materialWeight",
  2218. ASM.SALE_WAREHOUSE as "saleWareHouse",
  2219. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2220. RM.MATERIAL_CODE as "materialCode",
  2221. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  2222. nvl(sumWeight.weight ,0) as "netWeight",
  2223. nvl(sumWeight2.weight ,0) as "weight",
  2224. nvl(carCount.coun ,0) as "carCount"
  2225. from AMS_SALE_ORDER ASO
  2226. left join RMS_SHIPPER RS
  2227. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2228. left join RMS_CONSIGNEE RC
  2229. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2230. left join AMS_SALE_MATERIAL ASM
  2231. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2232. left join RMS_MATERIAL RM
  2233. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2234. left join (
  2235. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  2236. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2237. left join Omstruck_Order o_order
  2238. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2239. left join Tmstruck_Total_Result t_t_result
  2240. on o_order.order_id=t_t_result.order_id
  2241. left join Tmstruck_Weight_Result t_w_result
  2242. on t_t_result.result_total_id=t_w_result.result_total_id
  2243. GROUP BY
  2244. a_s_o_Material.SALE_ORDER_ID
  2245. ) sumWeight
  2246. on sumWeight.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2247. left join (
  2248. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2249. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2250. left join Omstruck_Order o_order
  2251. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2252. left join Tmstruck_Total_Result t_t_result
  2253. on o_order.order_id=t_t_result.order_id
  2254. left join Tmstruck_Weight_Result t_w_result
  2255. on t_t_result.result_total_id=t_w_result.result_total_id
  2256. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  2257. on o_order.order_id=o_o_material.ORDER_ID
  2258. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  2259. GROUP BY
  2260. a_s_o_Material.SALE_ORDER_ID
  2261. ) sumWeight2
  2262. on sumWeight2.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2263. left join (
  2264. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2265. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  2266. left join Omstruck_Order o_order
  2267. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  2268. left join Tmstruck_Total_Result t_t_result
  2269. on o_order.order_id=t_t_result.order_id
  2270. left join Tmstruck_Weight_Result t_w_result
  2271. on t_t_result.result_total_id=t_w_result.result_total_id
  2272. where o_order.order_status in (2,4,5)
  2273. GROUP BY
  2274. a_s_o_Material.SALE_ORDER_ID
  2275. ) carCount
  2276. on carCount.SALE_ORDER_ID=ASO.SALE_ORDER_ID
  2277. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2278. )
  2279. <where>
  2280. <if test="saleNumber != null">
  2281. and
  2282. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2283. "saleNumber" like '%${item}%'
  2284. </foreach>
  2285. </if>
  2286. <if test="shipperName != null">
  2287. and
  2288. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2289. "shipperName" like '%${item}%'
  2290. </foreach>
  2291. </if>
  2292. <if test="consigneeCompanyName != null">
  2293. and
  2294. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2295. "consigneeCompanyName" like '%${item}%'
  2296. </foreach>
  2297. </if>
  2298. <if test="materialName != null">
  2299. and
  2300. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2301. "materialName" like '%${item}%'
  2302. </foreach>
  2303. </if>
  2304. <if test="specificationModel != null">
  2305. and
  2306. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2307. "specificationModel" like '%${item}%'
  2308. </foreach>
  2309. </if>
  2310. <if test="materialCode != null">
  2311. and
  2312. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2313. "materialCode" like '%${item}%'
  2314. </foreach>
  2315. </if>
  2316. </where>
  2317. </select>
  2318. <select id="getSaleOrderAndMaterialById2" resultType="java.util.Map" parameterType="java.util.Map">
  2319. SELECT *
  2320. FROM (
  2321. select ASO.SALE_ORDER_ID as "saleOrderId",
  2322. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2323. RM.MATERIAL_ID as "materialId",
  2324. ASO.SALE_NUMBER as "saleNumber",
  2325. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2326. RS.SHIPPER_NAME as "shipperName",
  2327. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2328. RM.MATERIAL_NAME as "materialName",
  2329. ASM.MATERIAL_NUMBER as "materialNumber",
  2330. ASM.MATERIAL_WEIGHT as "materialWeight",
  2331. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2332. RM.MATERIAL_CODE as "materialCode"
  2333. from AMS_SALE_ORDER ASO
  2334. left join RMS_SHIPPER RS
  2335. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2336. left join RMS_CONSIGNEE RC
  2337. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2338. left join AMS_SALE_MATERIAL ASM
  2339. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2340. left join RMS_MATERIAL RM
  2341. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2342. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2343. )
  2344. <where>
  2345. <if test="saleNumber != null">
  2346. and
  2347. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2348. "saleNumber" like '%${item}%'
  2349. </foreach>
  2350. </if>
  2351. <if test="shipperName != null">
  2352. and
  2353. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2354. "shipperName" like '%${item}%'
  2355. </foreach>
  2356. </if>
  2357. <if test="consigneeCompanyName != null">
  2358. and
  2359. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2360. "consigneeCompanyName" like '%${item}%'
  2361. </foreach>
  2362. </if>
  2363. <if test="materialName != null">
  2364. and
  2365. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2366. "materialName" like '%${item}%'
  2367. </foreach>
  2368. </if>
  2369. <if test="specificationModel != null">
  2370. and
  2371. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2372. "specificationModel" like '%${item}%'
  2373. </foreach>
  2374. </if>
  2375. <if test="materialCode != null">
  2376. and
  2377. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2378. "materialCode" like '%${item}%'
  2379. </foreach>
  2380. </if>
  2381. </where>
  2382. </select>
  2383. <select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
  2384. SELECT * FROM (SELECT
  2385. RM.MATERIAL_NAME AS "materialName",
  2386. ASM.SALE_WAREHOUSE AS "saleWareHouse"
  2387. FROM AMS_SALE_MATERIAL ASM
  2388. LEFT JOIN RMS_MATERIAL RM
  2389. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2390. WHERE ASM.SALE_ORDER_ID = #{saleOrderId}
  2391. <if test="con != null">
  2392. AND instr(RM.MATERIAL_NAME, #{con}) > 0
  2393. </if>
  2394. )
  2395. <where>
  2396. <if test="materialName != null">
  2397. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2398. "materialName" like '%${item}%'
  2399. </foreach>
  2400. </if>
  2401. </where>
  2402. </select>
  2403. <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
  2404. SELECT SUM(twr.RESULT_NET_WEIGHT)
  2405. FROM AMS_SALE_ORDER_MATERIAL asom
  2406. left join OMSTRUCK_ORDER oo on oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  2407. left join TMSTRUCK_TOTAL_RESULT ttr on ttr.ORDER_ID = oo.ORDER_ID
  2408. left join TMSTRUCK_WEIGHT_RESULT twr on twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  2409. where asom.sale_order_id = #{saleOrderId}
  2410. </select>
  2411. <select id="getCarNum" parameterType="DECIMAL" resultType="DECIMAL">
  2412. SELECT COUNT(ASOM.SALE_ORDER_MATERIAL_ID)
  2413. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2414. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2415. </select>
  2416. <select id="getTruckNoAndMaterial" parameterType="java.util.Map" resultType="java.util.Map" >
  2417. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2418. RM.MATERIAL_NAME AS "materialName",
  2419. ASM.MATERIAL_ID AS "materialId",
  2420. ASM.MATERIAL_NUMBER AS "materialNumber",
  2421. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2422. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2423. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  2424. RM.MATERIAL_CODE AS "materialCode",
  2425. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  2426. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2427. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2428. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2429. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2430. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2431. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  2432. RC.CAPACITY_NUMBER AS "capacityNumber",
  2433. ADSO.CARRIER_ID AS "carrierId",
  2434. RCA.CARRIER_NAME AS "carrierName",
  2435. ASOM.TRUCK_REMARK AS "truckRemark"
  2436. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  2437. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2438. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2439. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2440. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2441. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2442. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2443. LEFT JOIN AMS_SALE_MATERIAL ASM
  2444. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  2445. LEFT JOIN RMS_MATERIAL RM
  2446. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2447. LEFT JOIN OMSTRUCK_ORDER OO
  2448. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2449. LEFT JOIN RMS_CAPACITY RC
  2450. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2451. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2452. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2453. LEFT JOIN RMS_CARRIER RCA
  2454. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2455. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2456. <if test="carrierSsoId != null" >
  2457. AND RCA.CARRIER_SSO_ID = #{carrierSsoId}
  2458. </if>
  2459. AND OO.ORDER_ID IS NULL
  2460. AND ADSO.DISPATCH_ID IS NOT NULL
  2461. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2462. </select>
  2463. <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
  2464. SELECT RRP.ADDRESS_ID AS "adddressId"
  2465. FROM RMS_RECEIVE_PLACE RRP
  2466. WHERE RRP.PLACE_ID = #{placeId}
  2467. </select>
  2468. <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
  2469. SELECT DISTINCT RC.CARRIER_ID AS "id",
  2470. RC.CARRIER_ID AS "value",
  2471. RC.CARRIER_NAME AS "label",
  2472. ACTP.PRICE_ID AS "priceId",
  2473. ACTP.PRICE_VALUE AS "priceValue"
  2474. FROM RMS_RECEIVE_PLACE RRP
  2475. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2476. ON ACTP.PLACE_ID = RRP.PLACE_ID
  2477. LEFT JOIN RMS_CARRIER RC
  2478. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  2479. WHERE RRP.PLACE_ID = #{placeId}
  2480. AND ACTP.CARRIER_ID IS NOT NULL
  2481. AND ACTP.DELETED = 0
  2482. ORDER BY ACTP.PRICE_VALUE DESC
  2483. </select>
  2484. <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
  2485. SELECT ACTP.PRICE_ID AS "priceId",
  2486. ACTP.PRICE_VALUE AS "priceValue"
  2487. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2488. WHERE ACTP.CARRIER_ID = #{carrierId}
  2489. AND ACTP.PLACE_ID = #{placeId}
  2490. AND ACTP.DELETED = 0
  2491. </select>
  2492. <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
  2493. SELECT * FROM (
  2494. select DISTINCT * from(
  2495. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2496. a_s_order.SALE_NUMBER "saleNumber",
  2497. r_shipper.SHIPPER_NAME "shipperName",
  2498. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2499. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2500. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2501. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2502. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2503. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2504. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2505. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2506. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2507. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2508. a_s_order.SALE_REMARK "saleRemark",
  2509. a_s_order.INSERT_TIME "insertTime",
  2510. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2511. a_s_order.UPDATE_TIME "updateTime",
  2512. RM.MATERIAL_NAME "materialName",
  2513. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2514. RM.MATERIAL_MODEL "materialModel",
  2515. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  2516. ASM.MATERIAL_NUMBER "materialNumber",
  2517. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2518. from AMS_SALE_ORDER a_s_order
  2519. left join RMS_SHIPPER r_shipper
  2520. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2521. left join RMS_CONSIGNEE r_consignee
  2522. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2523. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2524. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2525. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2526. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2527. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2528. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2529. LEFT JOIN RMS_CARRIER RC
  2530. ON RC.CARRIER_ID = ADSO.CARRIER_ID
  2531. LEFT JOIN OMSTRUCK_ORDER OO
  2532. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2533. LEFT JOIN AMS_SALE_MATERIAL ASM
  2534. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2535. LEFT JOIN RMS_MATERIAL RM
  2536. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2537. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2538. and a_s_order.CLOSE_STATUS is null
  2539. and a_s_order.DELETED = 0
  2540. and ADSO.DISPATCH_TYPE = 2
  2541. and OO.ORDER_ID IS NULL
  2542. <if test="carrierSsoId != null" >
  2543. and RC.CARRIER_SSO_ID = #{carrierSsoId}
  2544. </if>
  2545. ) "CARRIER"
  2546. <where>
  2547. <if test="con != null">
  2548. "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
  2549. </if>
  2550. </where>
  2551. )
  2552. <where>
  2553. <if test="saleNumber != null">
  2554. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2555. "saleNumber" like '%${item}%'
  2556. </foreach>
  2557. </if>
  2558. <if test="materialName != null">
  2559. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2560. "materialName" like '%${item}%'
  2561. </foreach>
  2562. </if>
  2563. <if test="materialSpecification != null">
  2564. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2565. "materialSpecification" like '%${item}%'
  2566. </foreach>
  2567. </if>
  2568. <if test="materialModel != null">
  2569. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2570. "materialModel" like '%${item}%'
  2571. </foreach>
  2572. </if>
  2573. <if test="shipperName != null">
  2574. and
  2575. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2576. "shipperName" like '%${item}%'
  2577. </foreach>
  2578. </if>
  2579. <if test="consigneeCompanyName != null">
  2580. and
  2581. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2582. "consigneeCompanyName" like '%${item}%'
  2583. </foreach>
  2584. </if>
  2585. <if test="consigneeWarrantyAmount != null">
  2586. and
  2587. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2588. "consigneeWarrantyAmount" like '%${item}%'
  2589. </foreach>
  2590. </if>
  2591. <if test="consigneeWarrantyWeight != null">
  2592. and
  2593. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2594. "consigneeWarrantyWeight" like '%${item}%'
  2595. </foreach>
  2596. </if>
  2597. <if test="saleOrderIsselfMention != null">
  2598. and
  2599. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2600. "saleOrderIsselfMention" like '%${item}%'
  2601. </foreach>
  2602. </if>
  2603. <if test="saleAccountBalance != null">
  2604. and
  2605. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2606. "saleAccountBalance" like '%${item}%'
  2607. </foreach>
  2608. </if>
  2609. <if test="saleCurrentOrderAmount != null">
  2610. and
  2611. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2612. "saleCurrentOrderAmount" like '%${item}%'
  2613. </foreach>
  2614. </if>
  2615. <if test="saleHistoricalOrderAmout != null">
  2616. and
  2617. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2618. "saleHistoricalOrderAmout" like '%${item}%'
  2619. </foreach>
  2620. </if>
  2621. <if test="saleOrderReceiveCustomer != null">
  2622. and
  2623. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2624. "saleOrderReceiveCustomer" like '%${item}%'
  2625. </foreach>
  2626. </if>
  2627. <if test="saleUnitPrice != null">
  2628. and
  2629. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2630. "saleUnitPrice" like '%${item}%'
  2631. </foreach>
  2632. </if>
  2633. <if test="saleOrderTax != null">
  2634. and
  2635. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2636. "saleOrderTax" like '%${item}%'
  2637. </foreach>
  2638. </if>
  2639. <if test="saleRemark != null">
  2640. and
  2641. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2642. "saleRemark" like '%${item}%'
  2643. </foreach>
  2644. </if>
  2645. </where>
  2646. order by "updateTime" DESC
  2647. </select>
  2648. <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
  2649. select * from(
  2650. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2651. a_s_order.SALE_NUMBER "saleNumber",
  2652. r_shipper.SHIPPER_NAME "shipperName",
  2653. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2654. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2655. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2656. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2657. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2658. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2659. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2660. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2661. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2662. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2663. a_s_order.SALE_REMARK "saleRemark",
  2664. a_s_order.INSERT_TIME "insertTime",
  2665. a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
  2666. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2667. RM.MATERIAL_NAME "materialName",
  2668. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2669. RM.MATERIAL_MODEL "materialModel",
  2670. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2671. from AMS_SALE_ORDER_CARRIER a_s_o_carrier
  2672. left join RMS_CARRIER r_carrier
  2673. on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
  2674. left join AMS_SALE_ORDER a_s_order
  2675. on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  2676. left join RMS_SHIPPER r_shipper
  2677. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2678. left join RMS_CONSIGNEE r_consignee
  2679. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2680. LEFT JOIN AMS_SALE_MATERIAL ASM
  2681. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2682. LEFT JOIN RMS_MATERIAL RM
  2683. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2684. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2685. and a_s_order.CLOSE_STATUS is null
  2686. and a_s_order.DELETED = 0
  2687. <if test="carrierSsoId != null">
  2688. and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
  2689. </if>
  2690. <if test="con != null">
  2691. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2692. </if>
  2693. )
  2694. <where>
  2695. <if test="saleNumber != null">
  2696. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2697. "saleNumber" like '%${item}%'
  2698. </foreach>
  2699. </if>
  2700. <if test="materialName != null">
  2701. and
  2702. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2703. "materialName" like '%${item}%'
  2704. </foreach>
  2705. </if>
  2706. <if test="materialSpecification != null">
  2707. and
  2708. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2709. "materialSpecification" like '%${item}%'
  2710. </foreach>
  2711. </if>
  2712. <if test="materialModel != null">
  2713. and
  2714. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2715. "materialModel" like '%${item}%'
  2716. </foreach>
  2717. </if>
  2718. <if test="shipperName != null">
  2719. and
  2720. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2721. "shipperName" like '%${item}%'
  2722. </foreach>
  2723. </if>
  2724. <if test="consigneeCompanyName != null">
  2725. and
  2726. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2727. "consigneeCompanyName" like '%${item}%'
  2728. </foreach>
  2729. </if>
  2730. <if test="consigneeWarrantyAmount != null">
  2731. and
  2732. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2733. "consigneeWarrantyAmount" like '%${item}%'
  2734. </foreach>
  2735. </if>
  2736. <if test="consigneeWarrantyWeight != null">
  2737. and
  2738. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2739. "consigneeWarrantyWeight" like '%${item}%'
  2740. </foreach>
  2741. </if>
  2742. <if test="saleOrderIsselfMention != null">
  2743. and
  2744. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2745. "saleOrderIsselfMention" like '%${item}%'
  2746. </foreach>
  2747. </if>
  2748. <if test="saleAccountBalance != null">
  2749. and
  2750. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2751. "saleAccountBalance" like '%${item}%'
  2752. </foreach>
  2753. </if>
  2754. <if test="saleCurrentOrderAmount != null">
  2755. and
  2756. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2757. "saleCurrentOrderAmount" like '%${item}%'
  2758. </foreach>
  2759. </if>
  2760. <if test="saleHistoricalOrderAmout != null">
  2761. and
  2762. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2763. "saleHistoricalOrderAmout" like '%${item}%'
  2764. </foreach>
  2765. </if>
  2766. <if test="saleOrderReceiveCustomer != null">
  2767. and
  2768. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2769. "saleOrderReceiveCustomer" like '%${item}%'
  2770. </foreach>
  2771. </if>
  2772. <if test="saleUnitPrice != null">
  2773. and
  2774. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2775. "saleUnitPrice" like '%${item}%'
  2776. </foreach>
  2777. </if>
  2778. <if test="saleOrderTax != null">
  2779. and
  2780. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2781. "saleOrderTax" like '%${item}%'
  2782. </foreach>
  2783. </if>
  2784. <if test="saleRemark != null">
  2785. and
  2786. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2787. "saleRemark" like '%${item}%'
  2788. </foreach>
  2789. </if>
  2790. </where>
  2791. <include refid="orderBy1"></include>
  2792. </select>
  2793. <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2794. SELECT *
  2795. FROM (
  2796. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2797. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2798. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2799. "addressDeliveryAddress",
  2800. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2801. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已提交',4, '财务已审批')
  2802. AS "approvalStatus",
  2803. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2804. RSH.SHIPPER_NAME AS "shipperName",
  2805. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2806. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2807. ASOM.INSERT_TIME AS "insertTime",
  2808. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2809. ASO.SALE_ORDER_ID AS "saleOrderId",
  2810. RM.MATERIAL_NAME AS "materialName",
  2811. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  2812. RM.MATERIAL_MODEL AS "materialModel",
  2813. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2814. ASM.MATERIAL_NUMBER AS "materialNumber",
  2815. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
  2816. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2817. LEFT JOIN AMS_SALE_ORDER ASO
  2818. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2819. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2820. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2821. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2822. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2823. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2824. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2825. LEFT JOIN RMS_SHIPPER RSH
  2826. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2827. LEFT JOIN RMS_CONSIGNEE RCO
  2828. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2829. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2830. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2831. LEFT JOIN AMS_SALE_MATERIAL ASM
  2832. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2833. LEFT JOIN RMS_MATERIAL RM
  2834. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2835. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  2836. AND ASOM.ISSUE_STATUS IS NULL
  2837. AND ADSO.CARRIER_ID IS NULL
  2838. AND ASO.DELETED = 0
  2839. <if test="con != null" >
  2840. AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
  2841. </if>
  2842. )
  2843. <where>
  2844. <if test="saleNumber != null">
  2845. and
  2846. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2847. "saleNumber" like '%${item}%'
  2848. </foreach>
  2849. </if>
  2850. <if test="materialName != null">
  2851. and
  2852. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2853. "materialName" like '%${item}%'
  2854. </foreach>
  2855. </if>
  2856. <if test="materialModel != null">
  2857. and
  2858. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2859. "materialModel" like '%${item}%'
  2860. </foreach>
  2861. </if>
  2862. <if test="materialSpecification != null">
  2863. and
  2864. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2865. "materialSpecification" like '%${item}%'
  2866. </foreach>
  2867. </if>
  2868. <if test="truckNo != null">
  2869. and
  2870. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2871. "truckNo" like '%${item}%'
  2872. </foreach>
  2873. </if>
  2874. <if test="addressDeliveryAddress != null">
  2875. and
  2876. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2877. "addressDeliveryAddress" like '%${item}%'
  2878. </foreach>
  2879. </if>
  2880. <if test="saleDateOfReceipt != null">
  2881. and
  2882. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2883. "saleDateOfReceipt" like '%${item}%'
  2884. </foreach>
  2885. </if>
  2886. <if test="saleOrderConsignee != null">
  2887. and
  2888. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2889. "saleOrderConsignee" like '%${item}%'
  2890. </foreach>
  2891. </if>
  2892. <if test="saleOrderConsigneeTel != null">
  2893. and
  2894. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2895. "saleOrderConsigneeTel" like '%${item}%'
  2896. </foreach>
  2897. </if>
  2898. <if test="shipperName != null">
  2899. and
  2900. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2901. "shipperName" like '%${item}%'
  2902. </foreach>
  2903. </if>
  2904. <if test="consigneeCompanyName != null">
  2905. and
  2906. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2907. "consigneeCompanyName" like '%${item}%'
  2908. </foreach>
  2909. </if>
  2910. <if test="isselfMention != null">
  2911. and
  2912. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2913. "isselfMention" like '%${item}%'
  2914. </foreach>
  2915. </if>
  2916. </where>
  2917. <include refid="orderBy"></include>
  2918. </select>
  2919. <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
  2920. SELECT
  2921. RM.MATERIAL_ID AS "materialId",
  2922. RM.MATERIAL_NAME AS "materialName",
  2923. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2924. RM.MATERIAL_CODE AS "materialCode",
  2925. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
  2926. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2927. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2928. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2929. LEFT JOIN AMS_SALE_MATERIAL ASM
  2930. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2931. LEFT JOIN RMS_MATERIAL RM
  2932. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2933. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2934. </select>
  2935. <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2936. SELECT * FROM(
  2937. SELECT DISTINCT *
  2938. FROM (
  2939. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2940. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2941. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2942. "addressDeliveryAddress",
  2943. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2944. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已提交',4, '财务已审批')
  2945. AS "approvalStatus",
  2946. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2947. RSH.SHIPPER_NAME AS "shipperName",
  2948. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2949. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2950. ASOM.INSERT_TIME AS "insertTime",
  2951. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2952. ASO.SALE_ORDER_ID AS "saleOrderId",
  2953. RCA.CARRIER_NAME AS "carrierName",
  2954. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  2955. RM.MATERIAL_NAME AS "materialName",
  2956. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  2957. RM.MATERIAL_MODEL AS "materialModel",
  2958. RM.MATERIAL_SPECIFICATION || MATERIAL_MODEL AS "specificationModel",
  2959. ASM.MATERIAL_NUMBER AS "materialNumber"
  2960. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2961. LEFT JOIN AMS_SALE_ORDER ASO
  2962. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2963. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2964. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2965. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2966. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2967. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2968. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2969. LEFT JOIN RMS_SHIPPER RSH
  2970. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2971. LEFT JOIN RMS_CONSIGNEE RCO
  2972. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2973. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2974. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2975. LEFT JOIN OMSTRUCK_ORDER OO
  2976. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2977. LEFT JOIN RMS_CARRIER RCA
  2978. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2979. LEFT JOIN AMS_SALE_MATERIAL ASM
  2980. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2981. LEFT JOIN RMS_MATERIAL RM
  2982. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2983. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  2984. AND ASOM.ISSUE_STATUS IS NULL
  2985. AND ADSO.DISPATCH_TYPE = 2
  2986. AND OO.ORDER_ID IS NULL
  2987. AND ASO.DELETED = 0
  2988. ) "NOCAR"
  2989. <where>
  2990. <if test="con != null" >
  2991. "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
  2992. </if>
  2993. </where>
  2994. )
  2995. <where>
  2996. <if test="saleNumber != null">
  2997. and
  2998. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2999. "saleNumber" like '%${item}%'
  3000. </foreach>
  3001. </if>
  3002. <if test="materialName != null">
  3003. and
  3004. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3005. "materialName" like '%${item}%'
  3006. </foreach>
  3007. </if>
  3008. <if test="materialModel != null">
  3009. and
  3010. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3011. "materialModel" like '%${item}%'
  3012. </foreach>
  3013. </if>
  3014. <if test="materialSpecification != null">
  3015. and
  3016. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3017. "materialSpecification" like '%${item}%'
  3018. </foreach>
  3019. </if>
  3020. <if test="carrierName != null">
  3021. and
  3022. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3023. "carrierName" like '%${item}%'
  3024. </foreach>
  3025. </if>
  3026. <if test="truckNo != null">
  3027. and
  3028. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3029. "truckNo" like '%${item}%'
  3030. </foreach>
  3031. </if>
  3032. <if test="addressDeliveryAddress != null">
  3033. and
  3034. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3035. "addressDeliveryAddress" like '%${item}%'
  3036. </foreach>
  3037. </if>
  3038. <if test="saleDateOfReceipt != null">
  3039. and
  3040. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3041. "saleDateOfReceipt" like '%${item}%'
  3042. </foreach>
  3043. </if>
  3044. <if test="saleOrderConsignee != null">
  3045. and
  3046. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3047. "saleOrderConsignee" like '%${item}%'
  3048. </foreach>
  3049. </if>
  3050. <if test="saleOrderConsigneeTel != null">
  3051. and
  3052. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3053. "saleOrderConsigneeTel" like '%${item}%'
  3054. </foreach>
  3055. </if>
  3056. <if test="shipperName != null">
  3057. and
  3058. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3059. "shipperName" like '%${item}%'
  3060. </foreach>
  3061. </if>
  3062. <if test="consigneeCompanyName != null">
  3063. and
  3064. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3065. "consigneeCompanyName" like '%${item}%'
  3066. </foreach>
  3067. </if>
  3068. <if test="isselfMention != null">
  3069. and
  3070. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3071. "isselfMention" like '%${item}%'
  3072. </foreach>
  3073. </if>
  3074. </where>
  3075. <include refid="orderBy"></include>
  3076. </select>
  3077. <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
  3078. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3079. RM.MATERIAL_NAME AS "materialName",
  3080. ASM.MATERIAL_ID AS "materialId",
  3081. ASM.MATERIAL_NUMBER AS "materialNumber",
  3082. ASM.MATERIAL_WEIGHT AS "materialWeight",
  3083. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3084. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  3085. RM.MATERIAL_CODE AS "materialCode",
  3086. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  3087. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3088. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3089. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3090. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3091. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3092. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  3093. RC.CAPACITY_NUMBER AS "capacityNumber",
  3094. ADSO.CARRIER_ID AS "carrierId",
  3095. ASOM.TRUCK_REMARK AS "truckRemark"
  3096. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3097. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3098. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  3099. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3100. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3101. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3102. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3103. LEFT JOIN AMS_SALE_MATERIAL ASM
  3104. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  3105. LEFT JOIN RMS_MATERIAL RM
  3106. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3107. LEFT JOIN OMSTRUCK_ORDER OO
  3108. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3109. LEFT JOIN RMS_CAPACITY RC
  3110. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  3111. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3112. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3113. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3114. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  3115. </select>
  3116. <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  3117. SELECT * FROM (
  3118. SELECT DISTINCT *
  3119. FROM (
  3120. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3121. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3122. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3123. "addressDeliveryAddress",
  3124. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3125. DECODE(ASO.SALE_ORDER_STATUS,2, '销售已提交',4, '财务已审批')
  3126. AS "approvalStatus",
  3127. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3128. RSH.SHIPPER_NAME AS "shipperName",
  3129. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3130. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3131. ASOM.INSERT_TIME AS "insertTime",
  3132. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3133. ASO.SALE_ORDER_ID AS "saleOrderId",
  3134. RCA.CARRIER_NAME AS "carrierName",
  3135. RM.MATERIAL_NAME AS "materialName",
  3136. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3137. RM.MATERIAL_MODEL AS "materialModel",
  3138. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3139. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3140. RCP.CAPACITY_NUMBER AS "capacityNumber",
  3141. OO.DRIVER_TEL AS "drivelTel",
  3142. ASM.MATERIAL_NUMBER AS "materialNumber",
  3143. OO.ORDER_ID AS "orderId"
  3144. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3145. LEFT JOIN AMS_SALE_ORDER ASO
  3146. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3147. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3148. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3149. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3150. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3151. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3152. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3153. LEFT JOIN RMS_SHIPPER RSH
  3154. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3155. LEFT JOIN RMS_CONSIGNEE RCO
  3156. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3157. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3158. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3159. LEFT JOIN OMSTRUCK_ORDER OO
  3160. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3161. LEFT JOIN RMS_CAPACITY RCP
  3162. ON RCP.CAPACITY_ID = OO.CAPACITY_ID
  3163. LEFT JOIN RMS_CARRIER RCA
  3164. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3165. LEFT JOIN AMS_SALE_MATERIAL ASM
  3166. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3167. LEFT JOIN RMS_MATERIAL RM
  3168. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3169. WHERE OO.ORDER_TYPE = 1
  3170. AND ASO.SALE_ORDER_STATUS IN (2,4)
  3171. AND ASOM.ISSUE_STATUS IS NULL
  3172. AND ADSO.DISPATCH_TYPE = 2
  3173. AND OO.ORDER_ID IS NOT NULL
  3174. AND OO.ORDER_STATUS IN (4,5)
  3175. AND ASO.DELETED != 2
  3176. <if test="oneDate != null">
  3177. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASOM.INSERT_TIME
  3178. </if>
  3179. <if test="startDate != null">
  3180. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASOM.INSERT_TIME
  3181. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASOM.INSERT_TIME
  3182. </if>
  3183. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3184. ) "HAVECAR"
  3185. <where>
  3186. <if test="con != null" >
  3187. "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
  3188. </if>
  3189. </where>
  3190. )
  3191. <where>
  3192. <if test="saleNumber != null">
  3193. and
  3194. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3195. "saleNumber" like '%${item}%'
  3196. </foreach>
  3197. </if>
  3198. <if test="materialName != null">
  3199. and
  3200. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3201. "materialName" like '%${item}%'
  3202. </foreach>
  3203. </if>
  3204. <if test="materialSpecification != null">
  3205. and
  3206. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3207. "materialSpecification" like '%${item}%'
  3208. </foreach>
  3209. </if>
  3210. <if test="materialModel != null">
  3211. and
  3212. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3213. "materialModel" like '%${item}%'
  3214. </foreach>
  3215. </if>
  3216. <if test="materialName != null">
  3217. and
  3218. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3219. "materialName" like '%${item}%'
  3220. </foreach>
  3221. </if>
  3222. <if test="carrierName != null">
  3223. and
  3224. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3225. "carrierName" like '%${item}%'
  3226. </foreach>
  3227. </if>
  3228. <if test="truckNo != null">
  3229. and
  3230. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3231. "truckNo" like '%${item}%'
  3232. </foreach>
  3233. </if>
  3234. <if test="addressDeliveryAddress != null">
  3235. and
  3236. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3237. "addressDeliveryAddress" like '%${item}%'
  3238. </foreach>
  3239. </if>
  3240. <if test="saleDateOfReceipt != null">
  3241. and
  3242. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3243. "saleDateOfReceipt" like '%${item}%'
  3244. </foreach>
  3245. </if>
  3246. <if test="saleOrderConsignee != null">
  3247. and
  3248. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3249. "saleOrderConsignee" like '%${item}%'
  3250. </foreach>
  3251. </if>
  3252. <if test="saleOrderConsigneeTel != null">
  3253. and
  3254. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3255. "saleOrderConsigneeTel" like '%${item}%'
  3256. </foreach>
  3257. </if>
  3258. <if test="shipperName != null">
  3259. and
  3260. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3261. "shipperName" like '%${item}%'
  3262. </foreach>
  3263. </if>
  3264. <if test="consigneeCompanyName != null">
  3265. and
  3266. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3267. "consigneeCompanyName" like '%${item}%'
  3268. </foreach>
  3269. </if>
  3270. <if test="isselfMention != null">
  3271. and
  3272. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3273. "isselfMention" like '%${item}%'
  3274. </foreach>
  3275. </if>
  3276. </where>
  3277. </select>
  3278. <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
  3279. SELECT ACTP.PRICE_ID AS "priceId"
  3280. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3281. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3282. ON ASOM.SALE_SHIPPING_ADDRESS_ID = ACTP.PLACE_ID
  3283. WHERE ACTP.CARRIER_ID = #{carrierId}
  3284. AND ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3285. </select>
  3286. <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
  3287. SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
  3288. FROM RMS_CONSIGNEE RC
  3289. WHERE RC.CONSIGNEE_ID = #{receiveId}
  3290. </select>
  3291. <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
  3292. SELECT RC.CARRIER_ID AS "carrierId"
  3293. FROM RMS_CARRIER RC
  3294. WHERE RC.CARRIER_NAME = #{consigneeName}
  3295. </select>
  3296. <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
  3297. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
  3298. ASO.SALE_REMARK AS "saleRemark",
  3299. ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
  3300. RSH.SHIPPER_ID AS "shipperId",
  3301. RSH.SHIPPER_NAME AS "shipperName",
  3302. RCO.CONSIGNEE_ID AS "receiveId",
  3303. RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
  3304. RSA.SALER_ID AS "salerId",
  3305. RSA.SALER_NAME AS "salerName"
  3306. FROM AMS_SALE_ORDER ASO
  3307. LEFT JOIN RMS_SHIPPER RSH
  3308. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3309. LEFT JOIN RMS_CONSIGNEE RCO
  3310. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3311. LEFT JOIN RMS_SALER RSA
  3312. ON RSA.SALER_ID = ASO.SALER_ID
  3313. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3314. </select>
  3315. <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
  3316. SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3317. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3318. RRA.ADDRESS_ID AS "shipperAddressId",
  3319. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
  3320. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3321. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3322. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3323. ASM.MATERIAL_ID AS "materialId",
  3324. RM.MATERIAL_NAME AS "materialName",
  3325. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
  3326. RM.MATERIAL_CODE AS "materialCode",
  3327. ASM.MATERIAL_NUMBER AS "materialNumber",
  3328. ASM.STEEL_METER AS "steelMeters",
  3329. ASM.IS_POUND_SALE AS "isPoundSale"
  3330. FROM AMS_SALE_ORDER ASO
  3331. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3332. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3333. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3334. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3335. LEFT JOIN AMS_SALE_MATERIAL ASM
  3336. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3337. LEFT JOIN RMS_MATERIAL RM
  3338. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3339. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3340. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3341. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3342. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3343. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3344. </select>
  3345. <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.Map" >
  3346. SELECT DISTINCT *
  3347. FROM (SELECT RRP.PLACE_ID "placeId",
  3348. RRP.ADDRESS_DELIVERY_ADDRESS "place",
  3349. RRA.ADDRESS_ID "shipperAddressId",
  3350. RRA.ADDRESS_PROVINCE "addressProvince",
  3351. RRA.ADDRESS_DISTRICT "addressDistrict",
  3352. RRA.ADDRESS_TOWN "addressTown",
  3353. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
  3354. FROM AMS_SALE_ORDER ASO
  3355. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3356. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3357. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3358. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3359. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3360. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3361. WHERE ASO.RECEIVE_ID = #{receiveId}
  3362. AND RRP.PLACE_ID IS NOT NULL
  3363. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3364. )
  3365. WHERE rownum <![CDATA[
  3366. <
  3367. ]]> 2
  3368. </select>
  3369. <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
  3370. SELECT DISTINCT *
  3371. FROM (
  3372. SELECT RS.SALER_NAME "salerName",
  3373. RS.SALER_ID "salerId"
  3374. FROM AMS_SALE_ORDER ASO
  3375. LEFT JOIN RMS_SALER RS
  3376. ON RS.SALER_ID = ASO.SALER_ID
  3377. WHERE ASO.RECEIVE_ID = #{receiveId}
  3378. AND RS.SALER_ID IS NOT NULL
  3379. AND ASO.SALE_TYPE = 1
  3380. ORDER BY ASO.SALE_ORDER_ID DESC
  3381. )
  3382. WHERE rownum <![CDATA[
  3383. <
  3384. ]]> 2
  3385. </select>
  3386. <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
  3387. SELECT DISTINCT *
  3388. FROM (
  3389. SELECT OO.DRIVER_TEL "driverTel"
  3390. FROM RMS_CAPACITY RCA
  3391. LEFT JOIN OMSTRUCK_ORDER OO
  3392. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3393. WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
  3394. AND OO.ORDER_TYPE = 1
  3395. ORDER BY OO.ORDER_ID
  3396. )
  3397. WHERE ROWNUM <![CDATA[
  3398. <
  3399. ]]> 2
  3400. </select>
  3401. <!-- 查询内转焦炭订单 -->
  3402. <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3403. SELECT * FROM (
  3404. SELECT *from(
  3405. select
  3406. OO.ORDER_NUMBER "orderNumber",
  3407. ASO.SALE_NUMBER "saleNumber",
  3408. RC.CAPACITY_NUMBER "capacityNumber",
  3409. RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3410. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
  3411. ACTP.PRICE_VALUE "priceValue",
  3412. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  3413. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  3414. RS.SHIPPER_NAME "shipperName",
  3415. OO.ORDER_ID "orderId",
  3416. RC3.CARRIER_NAME "carrierName"
  3417. FROM OMSTRUCK_ORDER OO
  3418. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3419. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  3420. LEFT JOIN AMS_SALE_ORDER ASO
  3421. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  3422. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3423. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3424. LEFT JOIN RMS_CARRIER RC3
  3425. ON RC3.CARRIER_ID = ADSO.CARRIER_ID
  3426. LEFT JOIN RMS_CONSIGNEE RC2
  3427. ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
  3428. LEFT JOIN RMS_CAPACITY RC
  3429. ON OO.CAPACITY_ID=RC.CAPACITY_ID
  3430. LEFT JOIN RMS_SHIPPER RS
  3431. ON RS.SHIPPER_ID=ASO.SHIPPER_ID
  3432. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3433. ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  3434. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3435. ON OO.PRICE_ID=ACTP.PRICE_ID
  3436. WHERE OO.ORDER_TYPE = 2
  3437. AND ASO.SHIPPER_ID = 2
  3438. AND ASO.CLOSE_STATUS = 0
  3439. <where>
  3440. <if test="orderStatus!=null">
  3441. AND OO.ORDER_STATUS = #{orderStatus}
  3442. </if>
  3443. </where>
  3444. ) RRC
  3445. <if test="con != null">
  3446. WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
  3447. </if>
  3448. )
  3449. <where>
  3450. <if test="orderNumber != null">
  3451. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  3452. "orderNumber" like '%${item}%'
  3453. </foreach>
  3454. </if>
  3455. <if test="carrierName != null">
  3456. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3457. "carrierName" like '%${item}%'
  3458. </foreach>
  3459. </if>
  3460. <if test="saleNumber != null">
  3461. and
  3462. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3463. "saleNumber" like '%${item}%'
  3464. </foreach>
  3465. </if>
  3466. <if test="capacityNumber != null">
  3467. and
  3468. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  3469. "capacityNumber" like '%${item}%'
  3470. </foreach>
  3471. </if>
  3472. <if test="shipperName != null">
  3473. and
  3474. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3475. "shipperName" like '%${item}%'
  3476. </foreach>
  3477. </if>
  3478. <if test="consigneeCompanyName != null">
  3479. and
  3480. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3481. "consigneeCompanyName" like '%${item}%'
  3482. </foreach>
  3483. </if>
  3484. </where>
  3485. <include refid="orderBy">
  3486. </include>
  3487. <if test="orderField == null ">
  3488. order by "orderNumber" desc
  3489. </if>
  3490. </select>
  3491. <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
  3492. SELECT ADSO.DISPATCH_ID AS "dispatchId"
  3493. FROM AMS_DISPATCH_SALE_ORDER ADSO
  3494. WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3495. </select>
  3496. <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="java.util.Map" >
  3497. SELECT ASTM.MATERIAL_ID AS "saleMaterialId",
  3498. ASM.EAS_PRIMARY_ID AS "closeEntryId"
  3499. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3500. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3501. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3502. LEFT JOIN AMS_SALE_MATERIAL ASM
  3503. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3504. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3505. </select>
  3506. <select id="getSaleList" resultType="java.util.Map" >
  3507. SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
  3508. ASM.SALE_MATERIAL_ID "saleMaterialId",
  3509. ASM.MATERIAL_ID "materialId"
  3510. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3511. LEFT JOIN AMS_SALE_MATERIAL ASM
  3512. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3513. WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3514. AND ASM.MATERIAL_ID = #{materialId}
  3515. </select>
  3516. <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3517. select * from(
  3518. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3519. a_s_order.SALE_NUMBER "saleNumber",
  3520. r_shipper.SHIPPER_NAME "shipperName",
  3521. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3522. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3523. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3524. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3525. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3526. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3527. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3528. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3529. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3530. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3531. a_s_order.SALE_REMARK "saleRemark",
  3532. a_s_order.INSERT_TIME "insertTime",
  3533. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3534. RM.MATERIAL_NAME "materialName",
  3535. ASM.MATERIAL_WEIGHT "materialWeight",
  3536. ASM.SALE_WAREHOUSE "saleWareHouse",
  3537. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  3538. nvl(sumWeight.weight ,0) as "netWeight",
  3539. nvl(sumWeight2.weight ,0) as "weight",
  3540. nvl(carCount.coun ,0) as "carCount",
  3541. RCA.CARRIER_NAME as "carrierName"
  3542. from AMS_SALE_ORDER a_s_order
  3543. left join RMS_SHIPPER r_shipper
  3544. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3545. left join RMS_CONSIGNEE r_consignee
  3546. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3547. LEFT JOIN AMS_SALE_MATERIAL ASM
  3548. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3549. LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
  3550. ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3551. LEFT JOIN RMS_CARRIER RCA
  3552. ON RCA.CARRIER_ID = ASOC.CARRIER_ID
  3553. LEFT JOIN RMS_MATERIAL RM
  3554. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3555. left join (
  3556. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  3557. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3558. left join Omstruck_Order o_order
  3559. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3560. left join Tmstruck_Total_Result t_t_result
  3561. on o_order.order_id=t_t_result.order_id
  3562. left join Tmstruck_Weight_Result t_w_result
  3563. on t_t_result.result_total_id=t_w_result.result_total_id
  3564. GROUP BY
  3565. a_s_o_Material.SALE_ORDER_ID
  3566. ) sumWeight
  3567. on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3568. left join (
  3569. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3570. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3571. left join Omstruck_Order o_order
  3572. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3573. left join Tmstruck_Total_Result t_t_result
  3574. on o_order.order_id=t_t_result.order_id
  3575. left join Tmstruck_Weight_Result t_w_result
  3576. on t_t_result.result_total_id=t_w_result.result_total_id
  3577. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  3578. on o_order.order_id=o_o_material.ORDER_ID
  3579. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3580. GROUP BY
  3581. a_s_o_Material.SALE_ORDER_ID
  3582. ) sumWeight2
  3583. on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3584. left join (
  3585. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3586. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3587. left join Omstruck_Order o_order
  3588. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3589. left join Tmstruck_Total_Result t_t_result
  3590. on o_order.order_id=t_t_result.order_id
  3591. left join Tmstruck_Weight_Result t_w_result
  3592. on t_t_result.result_total_id=t_w_result.result_total_id
  3593. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3594. GROUP BY
  3595. a_s_o_Material.SALE_ORDER_ID
  3596. ) carCount
  3597. on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3598. where (ASM.SALE_WAREHOUSE = '副产品库'
  3599. or ASM.SALE_WAREHOUSE = '钒渣库')
  3600. and a_s_order.SALE_ORDER_STATUS in (2,4)
  3601. and a_s_order.CLOSE_STATUS is null
  3602. and a_s_order.DELETED = #{deleted}
  3603. and a_s_order.SHIPPER_ID = 1
  3604. and a_s_order.SALE_TYPE is null
  3605. <if test="con != null">
  3606. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3607. </if>
  3608. <if test="consigneeSsoId != null">
  3609. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3610. </if>
  3611. <if test="oneDate != null">
  3612. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3613. </if>
  3614. <if test="startDate != null">
  3615. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3616. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3617. </if>
  3618. ORDER BY a_s_order.UPDATE_TIME DESC
  3619. )
  3620. <where>
  3621. <if test="saleNumber != null">
  3622. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3623. "saleNumber" like '%${item}%'
  3624. </foreach>
  3625. </if>
  3626. <if test="materialName != null">
  3627. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3628. "materialName" like '%${item}%'
  3629. </foreach>
  3630. </if>
  3631. <if test="materialSpecification != null">
  3632. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3633. "materialSpecification" like '%${item}%'
  3634. </foreach>
  3635. </if>
  3636. <if test="materialModel != null">
  3637. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3638. "materialModel" like '%${item}%'
  3639. </foreach>
  3640. </if>
  3641. <if test="statusStr != null">
  3642. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3643. and "statusStr" like '%${item}%'
  3644. </foreach>
  3645. </if>
  3646. <if test="shipperName != null">
  3647. and
  3648. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3649. "shipperName" like '%${item}%'
  3650. </foreach>
  3651. </if>
  3652. <if test="consigneeCompanyName != null">
  3653. and
  3654. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3655. "consigneeCompanyName" like '%${item}%'
  3656. </foreach>
  3657. </if>
  3658. <if test="consigneeWarrantyAmount != null">
  3659. and
  3660. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3661. "consigneeWarrantyAmount" like '%${item}%'
  3662. </foreach>
  3663. </if>
  3664. <if test="consigneeWarrantyWeight != null">
  3665. and
  3666. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3667. "consigneeWarrantyWeight" like '%${item}%'
  3668. </foreach>
  3669. </if>
  3670. <if test="saleOrderIsselfMention != null">
  3671. and
  3672. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3673. "saleOrderIsselfMention" like '%${item}%'
  3674. </foreach>
  3675. </if>
  3676. <if test="saleAccountBalance != null">
  3677. and
  3678. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3679. "saleAccountBalance" like '%${item}%'
  3680. </foreach>
  3681. </if>
  3682. <if test="saleCurrentOrderAmount != null">
  3683. and
  3684. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3685. "saleCurrentOrderAmount" like '%${item}%'
  3686. </foreach>
  3687. </if>
  3688. <if test="saleHistoricalOrderAmout != null">
  3689. and
  3690. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3691. "saleHistoricalOrderAmout" like '%${item}%'
  3692. </foreach>
  3693. </if>
  3694. <if test="saleOrderReceiveCustomer != null">
  3695. and
  3696. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3697. "saleOrderReceiveCustomer" like '%${item}%'
  3698. </foreach>
  3699. </if>
  3700. <if test="saleUnitPrice != null">
  3701. and
  3702. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3703. "saleUnitPrice" like '%${item}%'
  3704. </foreach>
  3705. </if>
  3706. <if test="saleOrderTax != null">
  3707. and
  3708. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3709. "saleOrderTax" like '%${item}%'
  3710. </foreach>
  3711. </if>
  3712. <if test="saleRemark != null">
  3713. and
  3714. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3715. "saleRemark" like '%${item}%'
  3716. </foreach>
  3717. </if>
  3718. </where>
  3719. </select>
  3720. <!-- 关闭未进厂的运单 -->
  3721. <update id="closeOrderNotIn" parameterType="DECIMAL" >
  3722. UPDATE OMSTRUCK_ORDER OO
  3723. SET OO.ORDER_STATUS = 7
  3724. WHERE OO.ORDER_ID IN (
  3725. SELECT OO.ORDER_ID "orderId"
  3726. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3727. LEFT JOIN OMSTRUCK_ORDER OO
  3728. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3729. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  3730. ON TTR.ORDER_ID = OO.ORDER_ID
  3731. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  3732. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  3733. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  3734. AND TER.RESULT_ENTRY_GATE_TIME IS NULL
  3735. AND OO.ORDER_ID IS NOT NULL
  3736. AND OO.ORDER_STATUS IN (4,5)
  3737. )
  3738. </update>
  3739. <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
  3740. SELECT RCA.CAPACITY_NUMBER AS "r1c1",
  3741. OO.ORDER_NUMBER AS "r1c2",
  3742. RM.EAS_MATERIAL_ID AS "r1c3",
  3743. RM.MATERIAL_NAME AS "r1c4",
  3744. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
  3745. FROM OMSTRUCK_ORDER OO
  3746. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  3747. ON OOM.ORDER_ID = OO.ORDER_ID
  3748. LEFT JOIN RMS_MATERIAL RM
  3749. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  3750. LEFT JOIN RMS_CAPACITY RCA
  3751. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3752. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3753. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  3754. LEFT JOIN AMS_SALE_ORDER ASO
  3755. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3756. LEFT JOIN RMS_CONSIGNEE RC
  3757. ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  3758. </select>
  3759. <select id="getSteelOrderDeletedList" resultType="java.util.Map" parameterType="java.util.Map">
  3760. select * from(
  3761. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3762. a_s_order.SALE_NUMBER "saleNumber",
  3763. r_shipper.SHIPPER_NAME "shipperName",
  3764. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3765. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3766. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3767. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3768. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3769. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3770. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3771. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3772. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3773. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3774. a_s_order.SALE_REMARK "saleRemark",
  3775. a_s_order.INSERT_TIME "insertTime",
  3776. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3777. RM.MATERIAL_NAME "materialName",
  3778. RM.MATERIAL_SPECIFICATION "materialSpecification",
  3779. RM.MATERIAL_MODEL "materialModel",
  3780. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  3781. ASM.MATERIAL_NUMBER "materialNumber",
  3782. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  3783. ASM.SALE_WAREHOUSE "saleWareHouse",
  3784. a_s_order.DELETED "deleted"
  3785. from AMS_SALE_ORDER a_s_order
  3786. left join RMS_SHIPPER r_shipper
  3787. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3788. left join RMS_CONSIGNEE r_consignee
  3789. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3790. LEFT JOIN AMS_SALE_MATERIAL ASM
  3791. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3792. LEFT JOIN RMS_MATERIAL RM
  3793. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3794. LEFT JOIN RMS_SALER R_SALER
  3795. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  3796. where a_s_order.SALE_ORDER_STATUS in (2,4)
  3797. and a_s_order.DELETED = 1
  3798. and a_s_order.SALE_TYPE = 1
  3799. <if test="con != null">
  3800. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3801. </if>
  3802. <if test="saler != null" >
  3803. and R_SALER.SALER_NAME = #{saler}
  3804. </if>
  3805. <if test="oneDate != null">
  3806. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3807. </if>
  3808. <if test="startDate != null">
  3809. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3810. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3811. </if>
  3812. <if test="consigneeSsoId != null">
  3813. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3814. </if>
  3815. ORDER BY a_s_order.UPDATE_TIME DESC
  3816. )
  3817. <where>
  3818. <if test="saleNumber != null">
  3819. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3820. "saleNumber" like '%${item}%'
  3821. </foreach>
  3822. </if>
  3823. <if test="materialName != null">
  3824. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3825. "materialName" like '%${item}%'
  3826. </foreach>
  3827. </if>
  3828. <if test="materialSpecification != null">
  3829. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3830. "materialSpecification" like '%${item}%'
  3831. </foreach>
  3832. </if>
  3833. <if test="materialModel != null">
  3834. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3835. "materialModel" like '%${item}%'
  3836. </foreach>
  3837. </if>
  3838. <if test="statusStr != null">
  3839. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3840. and "statusStr" like '%${item}%'
  3841. </foreach>
  3842. </if>
  3843. <!-- <if test="startTime != null">-->
  3844. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  3845. <!-- </if>-->
  3846. <!-- <if test="endTime != null">-->
  3847. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  3848. <!-- </if>-->
  3849. <if test="shipperName != null">
  3850. and
  3851. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3852. "shipperName" like '%${item}%'
  3853. </foreach>
  3854. </if>
  3855. <if test="consigneeCompanyName != null">
  3856. and
  3857. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3858. "consigneeCompanyName" like '%${item}%'
  3859. </foreach>
  3860. </if>
  3861. <if test="consigneeWarrantyAmount != null">
  3862. and
  3863. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3864. "consigneeWarrantyAmount" like '%${item}%'
  3865. </foreach>
  3866. </if>
  3867. <if test="consigneeWarrantyWeight != null">
  3868. and
  3869. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3870. "consigneeWarrantyWeight" like '%${item}%'
  3871. </foreach>
  3872. </if>
  3873. <if test="saleOrderIsselfMention != null">
  3874. and
  3875. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3876. "saleOrderIsselfMention" like '%${item}%'
  3877. </foreach>
  3878. </if>
  3879. <if test="saleAccountBalance != null">
  3880. and
  3881. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3882. "saleAccountBalance" like '%${item}%'
  3883. </foreach>
  3884. </if>
  3885. <if test="saleCurrentOrderAmount != null">
  3886. and
  3887. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3888. "saleCurrentOrderAmount" like '%${item}%'
  3889. </foreach>
  3890. </if>
  3891. <if test="saleHistoricalOrderAmout != null">
  3892. and
  3893. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3894. "saleHistoricalOrderAmout" like '%${item}%'
  3895. </foreach>
  3896. </if>
  3897. <if test="saleOrderReceiveCustomer != null">
  3898. and
  3899. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3900. "saleOrderReceiveCustomer" like '%${item}%'
  3901. </foreach>
  3902. </if>
  3903. <if test="saleUnitPrice != null">
  3904. and
  3905. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3906. "saleUnitPrice" like '%${item}%'
  3907. </foreach>
  3908. </if>
  3909. <if test="saleOrderTax != null">
  3910. and
  3911. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3912. "saleOrderTax" like '%${item}%'
  3913. </foreach>
  3914. </if>
  3915. <if test="saleRemark != null">
  3916. and
  3917. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3918. "saleRemark" like '%${item}%'
  3919. </foreach>
  3920. </if>
  3921. </where>
  3922. </select>
  3923. <select id="getAllSteelSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map" >
  3924. select * from(
  3925. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3926. a_s_order.SALE_NUMBER "saleNumber",
  3927. r_shipper.SHIPPER_NAME "shipperName",
  3928. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3929. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3930. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3931. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3932. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3933. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3934. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3935. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3936. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3937. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3938. a_s_order.SALE_REMARK "saleRemark",
  3939. a_s_order.INSERT_TIME "insertTime",
  3940. DECODE(a_s_order.SALE_ORDER_STATUS || a_s_order.DELETED,00,'未上传',10,'已上传',20,'销售已提交',40,'财务已审批',21,'反审核',41,'反审核',22,'已关闭',42,'已关闭') "statusStr",
  3941. RM.MATERIAL_NAME "materialName",
  3942. RM.MATERIAL_SPECIFICATION "materialSpecification",
  3943. RM.MATERIAL_MODEL "materialModel",
  3944. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  3945. ASM.SALE_WAREHOUSE "saleWareHouse"
  3946. from AMS_SALE_ORDER a_s_order
  3947. left join RMS_SHIPPER r_shipper
  3948. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3949. left join RMS_CONSIGNEE r_consignee
  3950. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3951. LEFT JOIN AMS_SALE_MATERIAL ASM
  3952. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3953. LEFT JOIN RMS_MATERIAL RM
  3954. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3955. where a_s_order.CLOSE_STATUS is null
  3956. and a_s_order.DELETED = 0
  3957. <if test="con != null">
  3958. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3959. </if>
  3960. <if test="shipperId != null">
  3961. and a_s_order.SHIPPER_ID = #{shipperId}
  3962. </if>
  3963. <if test="saleType != null">
  3964. and a_s_order.SALE_TYPE = #{saleType}
  3965. </if>
  3966. <if test="saleType == null">
  3967. and a_s_order.SALE_TYPE is null
  3968. </if>
  3969. <if test="consigneeSsoId != null">
  3970. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3971. </if>
  3972. ORDER BY a_s_order.UPDATE_TIME DESC
  3973. )
  3974. <where>
  3975. <if test="saleNumber != null">
  3976. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3977. "saleNumber" like '%${item}%'
  3978. </foreach>
  3979. </if>
  3980. <if test="materialName != null">
  3981. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3982. "materialName" like '%${item}%'
  3983. </foreach>
  3984. </if>
  3985. <if test="materialSpecification != null">
  3986. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3987. "materialSpecification" like '%${item}%'
  3988. </foreach>
  3989. </if>
  3990. <if test="materialModel != null">
  3991. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3992. "materialModel" like '%${item}%'
  3993. </foreach>
  3994. </if>
  3995. <if test="statusStr != null">
  3996. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3997. and "statusStr" like '%${item}%'
  3998. </foreach>
  3999. </if>
  4000. <!-- <if test="startTime != null">-->
  4001. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4002. <!-- </if>-->
  4003. <!-- <if test="endTime != null">-->
  4004. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4005. <!-- </if>-->
  4006. <if test="shipperName != null">
  4007. and
  4008. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4009. "shipperName" like '%${item}%'
  4010. </foreach>
  4011. </if>
  4012. <if test="consigneeCompanyName != null">
  4013. and
  4014. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4015. "consigneeCompanyName" like '%${item}%'
  4016. </foreach>
  4017. </if>
  4018. <if test="consigneeWarrantyAmount != null">
  4019. and
  4020. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4021. "consigneeWarrantyAmount" like '%${item}%'
  4022. </foreach>
  4023. </if>
  4024. <if test="consigneeWarrantyWeight != null">
  4025. and
  4026. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4027. "consigneeWarrantyWeight" like '%${item}%'
  4028. </foreach>
  4029. </if>
  4030. <if test="saleOrderIsselfMention != null">
  4031. and
  4032. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4033. "saleOrderIsselfMention" like '%${item}%'
  4034. </foreach>
  4035. </if>
  4036. <if test="saleAccountBalance != null">
  4037. and
  4038. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4039. "saleAccountBalance" like '%${item}%'
  4040. </foreach>
  4041. </if>
  4042. <if test="saleCurrentOrderAmount != null">
  4043. and
  4044. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4045. "saleCurrentOrderAmount" like '%${item}%'
  4046. </foreach>
  4047. </if>
  4048. <if test="saleHistoricalOrderAmout != null">
  4049. and
  4050. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4051. "saleHistoricalOrderAmout" like '%${item}%'
  4052. </foreach>
  4053. </if>
  4054. <if test="saleOrderReceiveCustomer != null">
  4055. and
  4056. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4057. "saleOrderReceiveCustomer" like '%${item}%'
  4058. </foreach>
  4059. </if>
  4060. <if test="saleUnitPrice != null">
  4061. and
  4062. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4063. "saleUnitPrice" like '%${item}%'
  4064. </foreach>
  4065. </if>
  4066. <if test="saleOrderTax != null">
  4067. and
  4068. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4069. "saleOrderTax" like '%${item}%'
  4070. </foreach>
  4071. </if>
  4072. <if test="saleRemark != null">
  4073. and
  4074. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4075. "saleRemark" like '%${item}%'
  4076. </foreach>
  4077. </if>
  4078. </where>
  4079. </select>
  4080. <!-- 修改厂内未装货车辆的运单车牌号 -->
  4081. <update id="updateCapacityNumberInFactory" parameterType="java.util.Map" >
  4082. UPDATE OMSTRUCK_ORDER OO
  4083. SET OO.CAPACITY_ID = #{capacityId}
  4084. WHERE OO.ORDER_ID = #{orderId}
  4085. </update>
  4086. <select id="getCarrierByAddress" parameterType="DECIMAL" resultType="java.util.Map" >
  4087. SELECT DISTINCT ACTP.CARRIER_ID "carrierId"
  4088. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4089. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4090. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4091. WHERE RRP.ADDRESS_ID = #{addressId}
  4092. </select>
  4093. </mapper>