AmsSaleOrderMapper.xml 195 KB

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