AmsSaleOrderMapper.xml 191 KB

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