12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.dil.mapper.AmsSaleOrderMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsSaleOrder">
- <id column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId" />
- <result column="PLAN_ID" jdbcType="DECIMAL" property="planId" />
- <result column="SALE_NUMBER" jdbcType="VARCHAR" property="saleNumber" />
- <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId" />
- <result column="RECEIVE_ID" jdbcType="DECIMAL" property="receiveId" />
- <result column="SALE_ACCOUNT_BALANCE" jdbcType="DECIMAL" property="saleAccountBalance" />
- <result column="SALE_CURRENT_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleCurrentOrderAmount" />
- <result column="SALE_HISTORICAL_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleHistoricalOrderAmount" />
- <result column="SALE_ORDER_STATUS" jdbcType="DECIMAL" property="saleOrderStatus" />
- <result column="SALE_ORDER_RECEIVE_CUSTOMER" jdbcType="VARCHAR" property="saleOrderReceiveCustomer" />
- <result column="SALE_ORDER_ISSELF_MENTION" jdbcType="VARCHAR" property="saleOrderIsselfMention" />
- <result column="SALE_UNIT_PRICE" jdbcType="DECIMAL" property="saleUnitPrice" />
- <result column="SALE_ORDER_TAX" jdbcType="VARCHAR" property="saleOrderTax" />
- <result column="SALE_REMARK" jdbcType="VARCHAR" property="saleRemark" />
- <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
- <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
- <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
- <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
- <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
- <result column="CLOSE_STATUS" jdbcType="DECIMAL" property="closeStatus" />
- <result column="SALER_ID" jdbcType="DECIMAL" property="salerId" />
- <result column="SALE_TYPE" jdbcType="DECIMAL" property="saleType" />
- </resultMap>
- <sql id="columns">
- SALE_ORDER_ID, PLAN_ID, SALE_NUMBER, SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
- SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT, SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
- SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE, SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
- SALER_ID, SALE_TYPE
- </sql>
- <sql id="columns_alias">
- t.SALE_ORDER_ID, t.PLAN_ID, t.SALE_NUMBER, t.SHIPPER_ID, t.RECEIVE_ID, t.SALE_ACCOUNT_BALANCE,
- t.SALE_CURRENT_ORDER_AMOUNT, t.SALE_HISTORICAL_ORDER_AMOUNT, t.SALE_ORDER_STATUS,
- t.SALE_ORDER_RECEIVE_CUSTOMER, t.SALE_ORDER_ISSELF_MENTION, t.SALE_UNIT_PRICE, t.SALE_ORDER_TAX,
- t.SALE_REMARK, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
- t.INSERT_UPDATE_REMARK, t.DELETED, t.CLOSE_STATUS, t.SALER_ID, t.SALE_TYPE
- </sql>
- <sql id="select">
- SELECT <include refid="columns" /> FROM AMS_SALE_ORDER
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias" /> FROM AMS_SALE_ORDER t
- </sql>
- <sql id="where">
- <where>
- <if test="saleOrderId != null">
- and SALE_ORDER_ID = #{saleOrderId}
- </if>
- <if test="planId != null">
- and PLAN_ID = #{planId}
- </if>
- <if test="saleNumber != null and saleNumber != ''">
- and SALE_NUMBER = #{saleNumber}
- </if>
- <if test="shipperId != null">
- and SHIPPER_ID = #{shipperId}
- </if>
- <if test="receiveId != null">
- and RECEIVE_ID = #{receiveId}
- </if>
- <if test="saleAccountBalance != null">
- and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
- </if>
- <if test="saleCurrentOrderAmount != null">
- and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
- </if>
- <if test="saleHistoricalOrderAmount != null">
- and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
- </if>
- <if test="saleOrderStatus != null">
- and SALE_ORDER_STATUS = #{saleOrderStatus}
- </if>
- <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
- and SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
- </if>
- <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
- and SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
- </if>
- <if test="saleUnitPrice != null">
- and SALE_UNIT_PRICE = #{saleUnitPrice}
- </if>
- <if test="saleOrderTax != null and saleOrderTax != ''">
- and SALE_ORDER_TAX = #{saleOrderTax}
- </if>
- <if test="saleRemark != null and saleRemark != ''">
- and SALE_REMARK = #{saleRemark}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- <if test="deleted != null">
- and DELETED = #{deleted}
- </if>
- <if test="closeStatus != null">
- and CLOSE_STATUS = #{closeStatus}
- </if>
- <if test="salerId != null">
- and SALER_ID = #{salerId}
- </if>
- <if test="saleType != null">
- and SALE_TYPE = #{saleType}
- </if>
- </where>
- </sql>
- <sql id="whereLike">
- <where>
- <if test="saleOrderId != null">
- and SALE_ORDER_ID = #{saleOrderId}
- </if>
- <if test="planId != null">
- and PLAN_ID = #{planId}
- </if>
- <if test="saleNumber != null and saleNumber != ''">
- and SALE_NUMBER LIKE '%${saleNumber}%'
- </if>
- <if test="shipperId != null">
- and SHIPPER_ID = #{shipperId}
- </if>
- <if test="receiveId != null">
- and RECEIVE_ID = #{receiveId}
- </if>
- <if test="saleAccountBalance != null">
- and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
- </if>
- <if test="saleCurrentOrderAmount != null">
- and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
- </if>
- <if test="saleHistoricalOrderAmount != null">
- and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
- </if>
- <if test="saleOrderStatus != null">
- and SALE_ORDER_STATUS = #{saleOrderStatus}
- </if>
- <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
- and SALE_ORDER_RECEIVE_CUSTOMER LIKE '%${saleOrderReceiveCustomer}%'
- </if>
- <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
- and SALE_ORDER_ISSELF_MENTION LIKE '%${saleOrderIsselfMention}%'
- </if>
- <if test="saleUnitPrice != null">
- and SALE_UNIT_PRICE = #{saleUnitPrice}
- </if>
- <if test="saleOrderTax != null and saleOrderTax != ''">
- and SALE_ORDER_TAX LIKE '%${saleOrderTax}%'
- </if>
- <if test="saleRemark != null and saleRemark != ''">
- and SALE_REMARK LIKE '%${saleRemark}%'
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME LIKE '%${insertUsername}%'
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME LIKE '%${updateUsername}%'
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
- </if>
- <if test="deleted != null">
- and DELETED = #{deleted}
- </if>
- <if test="closeStatus != null">
- and CLOSE_STATUS = #{closeStatus}
- </if>
- <if test="salerId != null">
- and SALER_ID = #{salerId}
- </if>
- <if test="saleType != null">
- and SALE_TYPE = #{saleType}
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
- delete from AMS_SALE_ORDER
- where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from AMS_SALE_ORDER
- where 1!=1
- <if test="planId != null">
- or PLAN_ID = #{planId}
- </if>
- <if test="saleNumber != null and saleNumber != ''">
- or SALE_NUMBER = #{saleNumber}
- </if>
- <if test="shipperId != null">
- or SHIPPER_ID = #{shipperId}
- </if>
- <if test="receiveId != null">
- or RECEIVE_ID = #{receiveId}
- </if>
- <if test="saleAccountBalance != null">
- or SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
- </if>
- <if test="saleCurrentOrderAmount != null">
- or SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
- </if>
- <if test="saleHistoricalOrderAmount != null">
- or SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
- </if>
- <if test="saleOrderStatus != null">
- or SALE_ORDER_STATUS = #{saleOrderStatus}
- </if>
- <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
- or SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
- </if>
- <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
- or SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
- </if>
- <if test="saleUnitPrice != null">
- or SALE_UNIT_PRICE = #{saleUnitPrice}
- </if>
- <if test="saleOrderTax != null and saleOrderTax != ''">
- or SALE_ORDER_TAX = #{saleOrderTax}
- </if>
- <if test="saleRemark != null and saleRemark != ''">
- or SALE_REMARK = #{saleRemark}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- or INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- or UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- <if test="deleted != null">
- or DELETED = #{deleted}
- </if>
- <if test="closeStatus != null">
- or CLOSE_STATUS = #{closeStatus}
- </if>
- <if test="salerId != null">
- or SALER_ID = #{salerId}
- </if>
- <if test="saleType != null">
- or SALE_TYPE = #{saleType}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
- insert into AMS_SALE_ORDER (SALE_ORDER_ID, PLAN_ID, SALE_NUMBER,
- SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
- SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
- SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
- SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
- SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
- INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
- SALER_ID, SALE_TYPE)
- values (#{saleOrderId,jdbcType=DECIMAL}, #{planId,jdbcType=DECIMAL}, #{saleNumber,jdbcType=VARCHAR},
- #{shipperId,jdbcType=DECIMAL}, #{receiveId,jdbcType=DECIMAL}, #{saleAccountBalance,jdbcType=DECIMAL},
- #{saleCurrentOrderAmount,jdbcType=DECIMAL}, #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
- #{saleOrderStatus,jdbcType=DECIMAL}, #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
- #{saleOrderIsselfMention,jdbcType=VARCHAR}, #{saleUnitPrice,jdbcType=DECIMAL},
- #{saleOrderTax,jdbcType=VARCHAR}, #{saleRemark,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
- #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
- #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, #{closeStatus,jdbcType=DECIMAL},
- #{salerId,jdbcType=DECIMAL}, #{saleType,jdbcType=DECIMAL})
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
- insert into AMS_SALE_ORDER
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="saleOrderId != null">
- SALE_ORDER_ID,
- </if>
- <if test="planId != null">
- PLAN_ID,
- </if>
- <if test="saleNumber != null">
- SALE_NUMBER,
- </if>
- <if test="shipperId != null">
- SHIPPER_ID,
- </if>
- <if test="receiveId != null">
- RECEIVE_ID,
- </if>
- <if test="saleAccountBalance != null">
- SALE_ACCOUNT_BALANCE,
- </if>
- <if test="saleCurrentOrderAmount != null">
- SALE_CURRENT_ORDER_AMOUNT,
- </if>
- <if test="saleHistoricalOrderAmount != null">
- SALE_HISTORICAL_ORDER_AMOUNT,
- </if>
- <if test="saleOrderStatus != null">
- SALE_ORDER_STATUS,
- </if>
- <if test="saleOrderReceiveCustomer != null">
- SALE_ORDER_RECEIVE_CUSTOMER,
- </if>
- <if test="saleOrderIsselfMention != null">
- SALE_ORDER_ISSELF_MENTION,
- </if>
- <if test="saleUnitPrice != null">
- SALE_UNIT_PRICE,
- </if>
- <if test="saleOrderTax != null">
- SALE_ORDER_TAX,
- </if>
- <if test="saleRemark != null">
- SALE_REMARK,
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME,
- </if>
- <if test="insertTime != null">
- INSERT_TIME,
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME,
- </if>
- <if test="updateTime != null">
- UPDATE_TIME,
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK,
- </if>
- <if test="deleted != null">
- DELETED,
- </if>
- <if test="closeStatus != null">
- CLOSE_STATUS,
- </if>
- <if test="salerId != null">
- SALER_ID,
- </if>
- <if test="saleType != null">
- SALE_TYPE,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="saleOrderId != null">
- #{saleOrderId,jdbcType=DECIMAL},
- </if>
- <if test="planId != null">
- #{planId,jdbcType=DECIMAL},
- </if>
- <if test="saleNumber != null">
- #{saleNumber,jdbcType=VARCHAR},
- </if>
- <if test="shipperId != null">
- #{shipperId,jdbcType=DECIMAL},
- </if>
- <if test="receiveId != null">
- #{receiveId,jdbcType=DECIMAL},
- </if>
- <if test="saleAccountBalance != null">
- #{saleAccountBalance,jdbcType=DECIMAL},
- </if>
- <if test="saleCurrentOrderAmount != null">
- #{saleCurrentOrderAmount,jdbcType=DECIMAL},
- </if>
- <if test="saleHistoricalOrderAmount != null">
- #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderStatus != null">
- #{saleOrderStatus,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderReceiveCustomer != null">
- #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
- </if>
- <if test="saleOrderIsselfMention != null">
- #{saleOrderIsselfMention,jdbcType=VARCHAR},
- </if>
- <if test="saleUnitPrice != null">
- #{saleUnitPrice,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderTax != null">
- #{saleOrderTax,jdbcType=VARCHAR},
- </if>
- <if test="saleRemark != null">
- #{saleRemark,jdbcType=VARCHAR},
- </if>
- <if test="insertUsername != null">
- #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- <if test="deleted != null">
- #{deleted,jdbcType=DECIMAL},
- </if>
- <if test="closeStatus != null">
- #{closeStatus,jdbcType=DECIMAL},
- </if>
- <if test="salerId != null">
- #{salerId,jdbcType=DECIMAL},
- </if>
- <if test="saleType != null">
- #{saleType,jdbcType=DECIMAL},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
- update AMS_SALE_ORDER
- set PLAN_ID = #{planId,jdbcType=DECIMAL},
- SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
- SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
- RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
- SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
- SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
- SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
- SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
- SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
- SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
- SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
- SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
- SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
- DELETED = #{deleted,jdbcType=DECIMAL},
- CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
- SALER_ID = #{salerId,jdbcType=DECIMAL},
- SALE_TYPE = #{saleType,jdbcType=DECIMAL}
- where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
- update AMS_SALE_ORDER
- <set>
- <if test="planId != null">
- PLAN_ID = #{planId,jdbcType=DECIMAL},
- </if>
- <if test="saleNumber != null">
- SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
- </if>
- <if test="shipperId != null">
- SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
- </if>
- <if test="receiveId != null">
- RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
- </if>
- <if test="saleAccountBalance != null">
- SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
- </if>
- <if test="saleCurrentOrderAmount != null">
- SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
- </if>
- <if test="saleHistoricalOrderAmount != null">
- SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderStatus != null">
- SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderReceiveCustomer != null">
- SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
- </if>
- <if test="saleOrderIsselfMention != null">
- SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
- </if>
- <if test="saleUnitPrice != null">
- SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
- </if>
- <if test="saleOrderTax != null">
- SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
- </if>
- <if test="saleRemark != null">
- SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- <if test="deleted != null">
- DELETED = #{deleted,jdbcType=DECIMAL},
- </if>
- <if test="closeStatus != null">
- CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
- </if>
- <if test="salerId != null">
- SALER_ID = #{salerId,jdbcType=DECIMAL},
- </if>
- <if test="saleType != null">
- SALE_TYPE = #{saleType,jdbcType=DECIMAL},
- </if>
- </set>
- where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
- </update>
- <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
- <include refid="select" />
- where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
- </select>
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="where" />
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="whereLike" />
- </select>
- <insert id="batchInsert" parameterType="java.util.List">
- insert into AMS_SALE_ORDER
- (SALE_ORDER_ID,
- PLAN_ID, SALE_NUMBER, SHIPPER_ID,
- RECEIVE_ID, SALE_ACCOUNT_BALANCE,
- SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
- SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
- SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
- SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME,
- UPDATE_TIME, INSERT_UPDATE_REMARK,
- DELETED, CLOSE_STATUS, SALER_ID,
- SALE_TYPE)
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.saleOrderId,jdbcType=DECIMAL},
- #{item.planId,jdbcType=DECIMAL}, #{item.saleNumber,jdbcType=VARCHAR}, #{item.shipperId,jdbcType=DECIMAL},
- #{item.receiveId,jdbcType=DECIMAL}, #{item.saleAccountBalance,jdbcType=DECIMAL},
- #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}, #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL},
- #{item.saleOrderStatus,jdbcType=DECIMAL}, #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR},
- #{item.saleOrderIsselfMention,jdbcType=VARCHAR}, #{item.saleUnitPrice,jdbcType=DECIMAL},
- #{item.saleOrderTax,jdbcType=VARCHAR}, #{item.saleRemark,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
- #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
- #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
- #{item.deleted,jdbcType=DECIMAL}, #{item.closeStatus,jdbcType=DECIMAL}, #{item.salerId,jdbcType=DECIMAL},
- #{item.saleType,jdbcType=DECIMAL} from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update AMS_SALE_ORDER
- set
- SALE_ORDER_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
- </foreach>
- ,PLAN_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
- </foreach>
- ,SALE_NUMBER=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleNumber,jdbcType=VARCHAR}
- </foreach>
- ,SHIPPER_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
- </foreach>
- ,RECEIVE_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.receiveId,jdbcType=DECIMAL}
- </foreach>
- ,SALE_ACCOUNT_BALANCE=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleAccountBalance,jdbcType=DECIMAL}
- </foreach>
- ,SALE_CURRENT_ORDER_AMOUNT=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}
- </foreach>
- ,SALE_HISTORICAL_ORDER_AMOUNT=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL}
- </foreach>
- ,SALE_ORDER_STATUS=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderStatus,jdbcType=DECIMAL}
- </foreach>
- ,SALE_ORDER_RECEIVE_CUSTOMER=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR}
- </foreach>
- ,SALE_ORDER_ISSELF_MENTION=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderIsselfMention,jdbcType=VARCHAR}
- </foreach>
- ,SALE_UNIT_PRICE=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleUnitPrice,jdbcType=DECIMAL}
- </foreach>
- ,SALE_ORDER_TAX=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderTax,jdbcType=VARCHAR}
- </foreach>
- ,SALE_REMARK=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleRemark,jdbcType=VARCHAR}
- </foreach>
- ,INSERT_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
- </foreach>
- ,INSERT_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
- </foreach>
- ,UPDATE_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
- </foreach>
- ,UPDATE_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
- </foreach>
- ,INSERT_UPDATE_REMARK=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
- </foreach>
- ,DELETED=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
- </foreach>
- ,CLOSE_STATUS=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.closeStatus,jdbcType=DECIMAL}
- </foreach>
- ,SALER_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.salerId,jdbcType=DECIMAL}
- </foreach>
- ,SALE_TYPE=
- <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
- when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleType,jdbcType=DECIMAL}
- </foreach>
- where SALE_ORDER_ID in
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
- #{item.saleOrderId,jdbcType=DECIMAL}
- </foreach>
- </update>
- <delete id="batchDelete" parameterType="java.util.List">
- delete from AMS_SALE_ORDER
- where SALE_ORDER_ID in
- <foreach close=")" collection="list" item="id" open="(" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <sql id="orderBy">
- <if test="orderField != null and orderField != ''">
- order by "${orderField}"
- <if test="orderType != null and orderType != ''">
- ${orderType}
- </if>
- </if>
- <if test="orderField == null ">
- order by "insertTime" desc
- </if>
- </sql>
- <!--根据销售订单号排序-->
- <sql id="orderBy1">
- <if test="orderField != null and orderField != ''">
- order by "${orderField}"
- <if test="orderType != null and orderType != ''">
- ${orderType}
- </if>
- </if>
- <if test="orderField == null ">
- order by "saleNumber" desc
- </if>
- </sql>
- <select id="getSaleOrderInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- allmaterial_info.saleSum1 "materialTheoreticalWeight",
- allmaterial_info.saleSum2 "saleOrderMaterialNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- from AMS_SALE_ORDER a_s_order
- left join (select sale_material.SALE_ORDER_ID saleOrderId,
- sum(tt.sum1) saleSum1,
- sum(tt.sum2) saleSum2
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join
- (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
- sum(truckno_material.material_theoretical_weight) sum1,
- sum(truckno_material.sale_order_material_number) sum2
- from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
- truckno_material.SALE_ORDER_MATERIAL_ID) tt
- on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
- group by
- sale_material.SALE_ORDER_ID) allmaterial_info
- on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0)
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialTheoreticalWeight != null">
- and
- <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
- "materialTheoreticalWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderMaterialNumber != null">
- and
- <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getSaleOrderReported" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- allmaterial_info.saleSum1 "materialTheoreticalWeight",
- allmaterial_info.saleSum2 "saleOrderMaterialNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER a_s_order
- left join (select sale_material.SALE_ORDER_ID saleOrderId,
- sum(tt.sum1) saleSum1,
- sum(tt.sum2) saleSum2
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join
- (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
- sum(truckno_material.material_theoretical_weight) sum1,
- sum(truckno_material.sale_order_material_number) sum2
- from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
- truckno_material.SALE_ORDER_MATERIAL_ID) tt
- on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
- group by
- sale_material.SALE_ORDER_ID) allmaterial_info
- on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- where a_s_order.SALE_ORDER_STATUS=1)
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialTheoreticalWeight != null">
- and
- <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
- "materialTheoreticalWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderMaterialNumber != null">
- and
- <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getSaleOrderDetail" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select sale_material.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
- sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
- receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
- sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
- sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
- sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
- sale_material.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join AMS_SALE_ORDER a_s_order
- on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- left join RMS_RECEIVE_ADDRESS receive_address
- on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
- where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0 and sale_material.UPDATED=0)
- <where>
- <if test="saleOrderMaterialTruckNo != null">
- and
- <foreach collection="saleOrderMaterialTruckNo" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialTruckNo" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderMaterialNumber != null">
- and
- <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialTheoreticalWeight != null">
- and
- <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
- "materialTheoreticalWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleShippingAddress != null">
- and
- <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
- "saleShippingAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="saleDateOfReceipt != null">
- and
- <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
- "saleDateOfReceipt" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsignee != null">
- and
- <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
- "saleOrderConsignee" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsigneeTel != null">
- and
- <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
- "saleOrderConsigneeTel" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getSaleOrderUpdateLog" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select
- sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
- receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
- sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
- sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
- sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
- sale_material.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join AMS_SALE_ORDER a_s_order
- on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- left join RMS_RECEIVE_ADDRESS receive_address
- on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
- where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0)
- <where>
- <if test="saleShippingAddress != null">
- and
- <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
- "saleShippingAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="saleDateOfReceipt != null">
- and
- <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
- "saleDateOfReceipt" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsignee != null">
- and
- <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
- "saleOrderConsignee" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsigneeTel != null">
- and
- <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
- "saleOrderConsigneeTel" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <!--销售计划-->
- <select id="getSalePlanName" resultType="java.util.LinkedHashMap">
- select
- a_s_plan.PLAN_ID "id",
- a_s_plan.PLAN_ID "value",
- a_s_plan.PLAN_NAME "label"
- from AMS_SALE_PLAN a_s_plan
- </select>
- <!-- 收货客户-->
- <select id="getShipperName" resultType="java.util.LinkedHashMap">
- select
- SHIPPER_ID "id",
- SHIPPER_ID "value",
- SHIPPER_NAME "label"
- from RMS_SHIPPER
- </select>
- <!-- 收货客户-->
- <select id="getConsigneeCompanyName" resultType="java.util.LinkedHashMap">
- select
- CONSIGNEE_ID "id",
- CONSIGNEE_ID "value",
- CONSIGNEE_COMPANY_NAME "label"
- from RMS_CONSIGNEE
- where rownum < 20
- </select>
- <!-- <select id="selectMaxId" resultType="java.math.BigDecimal">-->
- <!-- select max(SALE_ORDER_ID) from AMS_SALE_ORDER-->
- <!-- </select>-->
- <select id="selectBySaleOrderId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
- select
- a_s_order.PLAN_ID "planId",
- a_s_order.SHIPPER_ID "shipperId",
- a_s_order.RECEIVE_ID "consigneeId",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_REMARK "saleRemark"
- from AMS_SALE_ORDER a_s_order
- where a_s_order.SALE_ORDER_ID = #{saleOrderId}
- </select>
- <update id="deleteBySaleOrderId" parameterType="java.math.BigDecimal">
- update AMS_SALE_ORDER_MATERIAL set DELETED = 1 where SALE_ORDER_ID = #{saleOrderId}
- </update>
- <select id="getAmsSaleOrderApproved" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- allmaterial_info.saleSum1 "materialTheoreticalWeight",
- allmaterial_info.saleSum2 "saleOrderMaterialNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER a_s_order
- left join (select sale_material.SALE_ORDER_ID saleOrderId,
- sum(tt.sum1) saleSum1,
- sum(tt.sum2) saleSum2
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join
- (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
- sum(truckno_material.material_theoretical_weight) sum1,
- sum(truckno_material.sale_order_material_number) sum2
- from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
- truckno_material.SALE_ORDER_MATERIAL_ID) tt
- on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
- group by
- sale_material.SALE_ORDER_ID) allmaterial_info
- on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- where a_s_order.SALE_ORDER_STATUS=4)
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialTheoreticalWeight != null">
- and
- <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
- "materialTheoreticalWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderMaterialNumber != null">
- and
- <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <!-- 展示所有销售公司已审核的销售订单 -->
- <select id="getSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
- select ADSO.DISPATCH_ID "dispatchId",
- ASOM.SALE_ORDER_ID "saleOrderId",
- ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
- ASO.SALE_NUMBER "saleNumber",
- ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
- CONCAT(CONCAT(CONCAT(ADDRESS_PROVINCE, ADDRESS_DISTRICT), ADDRESS_TOWN),
- RRP.ADDRESS_DELIVERY_ADDRESS) "addressDeliveryAddress",
- TO_CHAR(ASOM.SALE_DATE_OF_RECEIPT, 'yyyy-mm-dd') "saleDateOfReceipt",
- ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
- ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
- RS.SHIPPER_NAME "shipperName",
- RC.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- ADSO.DISPATCH_TIME "dispatchTime",
- ADSO.INSERT_TIME AS "insertTime"
- FROM AMS_SALE_ORDER ASO
- JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRP.PLACE_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
- LEFT JOIN RMS_SHIPPER RS
- ON RS.SHIPPER_ID = ASO.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RC
- ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
- WHERE ASO.SALE_ORDER_STATUS IN (2, 4)
- AND ADSO.DISPATCH_STATUS = #{status}
- AND ADSO.DISPATCH_TYPE = 0
- order by ADSO.INSERT_TIME DESC
- </select>
- <select id="selectCarrierIdByprovince" resultType="java.math.BigDecimal" parameterType="java.util.Map">
- SELECT RC.CARRIER_ID "carrierId"
- FROM RMS_BID_AREA RBA
- LEFT JOIN RMS_CARRIER RC
- ON RBA.BID_AREA_ID=RC.CARRIER_BID_AREA_ID
- WHERE RBA.BID_AREA_PROVINCE=#{province} AND RBA.BID_AREA_CITY=#{ditrict} AND RBA.BID_AREA_COUNTY=#{addressTown}
- </select>
- <select id="selectProvince" resultType="java.util.Map" parameterType="java.lang.Integer">
- SELECT RRA.ADDRESS_PROVINCE "province",
- RRA.ADDRESS_DISTRICT "ditrict",
- RRA.ADDRESS_TOWN "addressTown"
- FROM RMS_RECEIVE_ADDRESS RRA
- WHERE RRA.ADDRESS_ID=#{addressId}
- </select>
- <!-- 销售公司查询已审核的销售订单 -->
- <select id="getSaleOrderListBySaleCompany" parameterType="java.util.Map" resultType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- allmaterial_info.saleSum1 "materialTheoreticalWeight",
- allmaterial_info.saleSum2 "saleOrderMaterialNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER a_s_order
- left join (select sale_material.SALE_ORDER_ID saleOrderId,
- sum(tt.sum1) saleSum1,
- sum(tt.sum2) saleSum2
- from AMS_SALE_ORDER_MATERIAL sale_material
- left join
- (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
- sum(truckno_material.material_theoretical_weight) sum1,
- sum(truckno_material.sale_order_material_number) sum2
- from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
- truckno_material.SALE_ORDER_MATERIAL_ID) tt
- on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
- group by
- sale_material.SALE_ORDER_ID) allmaterial_info
- on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- where a_s_order.SALE_ORDER_STATUS=2)
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialTheoreticalWeight != null">
- and
- <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
- "materialTheoreticalWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderMaterialNumber != null">
- and
- <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
- "saleOrderMaterialNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <!-- 通过收货地址,匹配对应的承运商-->
- <select id="getCarrier" parameterType="java.lang.Integer" resultType="java.lang.Integer">
- select rc.carrier_id from rms_receive_address rra LEFT join rms_carrier rc on rra.ADDRESS_ID = rc.CARRIER_BID_AREA_ID
- WHERE rra.address_id = #{param}
- </select>
- <select id="selectInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
- select distinct ASO.SHIPPER_ID "shipperId",
- ASO.RECEIVE_ID "reciveId",
- ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- ASO.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReciveCustomer",
- ASO.SALE_REMARK "saleRemark"
- from AMS_SALE_ORDER ASO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
- left join RMS_MATERIAL RM
- on RM.MATERIAL_ID=ASTM.MATERIAL_ID
- where ASO.SALE_ORDER_ID=#{saleOrderId}
- </select>
- <!-- 根据销售订单id查找物资信息 -->
- <select id="selectMaterialInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.util.LinkedHashMap">
- select distinct ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "cxh",
- ASTM.SALE_ORDER_MATERIAL_NUMBER "orderPlanWeight",
- RM.MATERIAL_CODE "materialCode",
- RM.MATERIAL_NAME "materialName",
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",
- RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
- RM.MATERIAL_ID "materialId",
- ASTM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
- ASTM.TRUCKNO_MATERIAL_ID "trucknoMaterialId",
- ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
- ASOM.SALE_SHIPPING_ADDRESS_ID "saleShipperAddressId",
- CONCAT( CONCAT( CONCAT( RRA.ADDRESS_PROVINCE, RRA.ADDRESS_DISTRICT ), RRA.ADDRESS_TOWN ), RRA.ADDRESS_DELIVERY_ADDRESS ) "saleShipperAddressName",
- ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
- ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
- from AMS_SALE_ORDER ASO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
- left join RMS_MATERIAL RM
- on RM.MATERIAL_ID=ASTM.MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON ASOM.SALE_SHIPPING_ADDRESS_ID=RRA.ADDRESS_ID
- where ASO.SALE_ORDER_ID=#{saleOrderId}
- </select>
- <select id="selectSaleOrderMaterialIdBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
- select ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
- ASTM.TRUCKNO_MATERIAL_ID "TruckNoMaterialId"
- from AMS_SALE_ORDER ASO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
- where ASO.SALE_ORDER_ID=#{saleOrderId}
- </select>
- <select id="getSaleOrderInfoes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- ASM.MATERIAL_NUMBER "materialNumber",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
- RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- decode(ASM.IS_POUND_SALE, 0, '是' , '否') "isPoundSale",
- ASOM.TRUCK_REMARK "trucRemark",
- ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel"
- FROM AMS_SALE_ORDER a_s_order
- LEFT JOIN RMS_SHIPPER r_shipper
- ON a_s_order.SHIPPER_ID = r_shipper.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE r_consignee
- ON a_s_order.RECEIVE_ID = r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN RMS_SALER R_SALER
- ON R_SALER.SALER_ID = a_s_order.SALER_ID
- WHERE a_s_order.SALE_ORDER_STATUS = 0
- AND a_s_order.DELETED = 0
- AND ASM.DELETED IS NULL
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- <if test="consigneeSsoId != null" >
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- <if test="saler != null " >
- and R_SALER.INSERT_UPDATE_REMARK like #{saler}
- </if>
- <if test="consigneeName != null">
- and r_consignee.CONSIGNEE_COMPANY_NAME = #{consigneeName}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- ORDER BY a_s_order.SALE_ORDER_ID DESC
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="specificationModel != null">
- and
- <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
- "specificationModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy1">
- </include>
- </select>
- <select id="getSaleOrderReportedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
- ASM.MATERIAL_NUMBER "materialNumber",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- left join RMS_RECEIVE_PLACE RRP
- on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN RMS_SALER R_SALER
- ON R_SALER.SALER_ID = a_s_order.SALER_ID
- where a_s_order.SALE_ORDER_STATUS=1
- and a_s_order.DELETED = 0
- AND ASM.DELETED IS NULL
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- <if test="saler != null" >
- and R_SALER.INSERT_UPDATE_REMARK like #{saler}
- </if>
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy1"></include>
- </select>
- <!-- 销售公司查询已审核的焦炭销售订单 -->
- <select id="getCokeSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- a_s_order.SALE_TYPE ,
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- a_s_order.CLOSE_STATUS "closeStatus"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- left join AMS_SALE_MATERIAL ASM
- on ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- left join RMS_MATERIAL RM
- on RM.MATERIAL_ID = ASM.MATERIAL_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.CLOSE_STATUS is not null
- and a_s_order.DELETED = 0
- and a_s_order.SALE_TYPE is null
- ) SSSR
- <if test="con != null" >
- where SSSR."consigneeCompanyName" LIKE #{con}
- </if>
- <if test="con != null" >
- or SSSR."saleNumber" LIKE #{con}
- </if>
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- and
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- "statusStr" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getSaleOrderListBySaleCompanyes" parameterType="java.util.Map" resultType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
- ASM.MATERIAL_NUMBER "materialNumber",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
- ASM.SALE_WAREHOUSE "saleWareHouse",
- a_s_order.DELETED "deleted",
- a_s_order.SHIPPER_ID "shipperId",
- a_s_order.RECEIVE_ID "receiveId",
- a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention",
- a_s_order.SALER_ID "salerId"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- left join RMS_RECEIVE_PLACE RRP
- on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN RMS_SALER R_SALER
- ON R_SALER.SALER_ID = a_s_order.SALER_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.CLOSE_STATUS is null
- and ASM.DELETED IS NULL
- and ASM.SALE_MATERIAL_ID IS NOT NULL
- <if test="con != null">
- and r_consignee.CONSIGNEE_COMPANY_NAME||a_s_order.SALE_NUMBER||rm.material_name||RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL like #{con}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- <if test="shipperId != null">
- and a_s_order.SHIPPER_ID = #{shipperId}
- </if>
- <if test="saleType != null">
- and a_s_order.SALE_TYPE = #{saleType}
- </if>
- <if test="saleType == null">
- and a_s_order.SALE_TYPE is null
- </if>
- <if test="saler != null" >
- and R_SALER.INSERT_UPDATE_REMARK like #{saler}
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- ORDER BY a_s_order.UPDATE_TIME DESC
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- and "statusStr" like '%${item}%'
- </foreach>
- </if>
- <!-- <if test="startTime != null">-->
- <!-- and "insertTime" >= to_date('${startTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <!-- <if test="endTime != null">-->
- <!-- and "insertTime" <= to_date('${endTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getAmsSaleOrderApprovedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- AND a_s_order.SHIPPER_ID = 2
- <if test="con != null">
- and instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0
- </if>
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- and
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- "statusStr" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getSaleOrderAndMaterialById" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT *
- FROM (
- SELECT
- ASO.SALE_ORDER_ID AS "saleOrderId",
- ASM.SALE_MATERIAL_ID AS "saleMaterialId",
- RM.MATERIAL_ID AS "materialId",
- ASO.SALE_NUMBER AS "saleNumber",
- ASO.SALE_ORDER_ISSELF_MENTION AS "saleOrderIsselfMention",
- ASO.SALE_REMARK AS "saleRemark",
- RS.SHIPPER_NAME AS "shipperName",
- RC.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
- RM.MATERIAL_NAME AS "materialName",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- ASM.MATERIAL_WEIGHT AS "materialWeight",
- ASM.SALE_WAREHOUSE AS "saleWareHouse",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
- RM.MATERIAL_CODE AS "materialCode",
- nvl( sumWeight.weight, 0 ) + nvl( sumWeight2.weight, 0 ) + + nvl( sumWeight3.weight, 0 ) AS "totalWeight",
- nvl( sumWeight.weight, 0 ) AS "netWeight",
- nvl( sumWeight2.weight, 0 ) AS "weight",
- nvl( carCount.coun, 0 ) + nvl( carCount1.coun, 0 ) AS "carCount"
- FROM
- AMS_SALE_ORDER ASO
- LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RC ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN (
- SELECT
- sum( t_w_result.RESULT_NET_WEIGHT ) weight,
- a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
- FROM
- AMS_SALE_ORDER_MATERIAL a_s_o_material
- LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
- LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
- LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
- WHERE
- o_order.ORDER_TYPE = 2
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) sumWeight ON sumWeight.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN (
- SELECT
- sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
- a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- FROM
- AMS_SALE_ORDER_MATERIAL a_s_o_material
- LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
- LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
- LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
- WHERE
- t_w_result.RESULT_NET_WEIGHT IS NULL
- AND o_order.order_status IN ( 2, 5 )
- AND o_order.ORDER_TYPE = 2
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) sumWeight2 ON sumWeight2.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN (
- SELECT
- sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
- a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- FROM
- AMS_SALE_ORDER_MATERIAL a_s_o_material
- LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
- LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
- LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
- WHERE
- t_w_result.RESULT_NET_WEIGHT IS NULL
- AND o_order.order_status = 4
- AND o_order.ORDER_TYPE = 2
- AND a_s_o_material.SALE_DATE_OF_RECEIPT < SYSDATE
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) sumWeight3 ON sumWeight3.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN (
- SELECT
- count( o_order.order_id ) coun,
- a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- FROM
- AMS_SALE_ORDER_MATERIAL a_s_o_material
- LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
- LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
- LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
- WHERE
- o_order.order_status IN ( 2, 5 )
- AND o_order.ORDER_TYPE = 2
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) carCount ON carCount.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN (
- SELECT
- count( o_order.order_id ) coun,
- a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- FROM
- AMS_SALE_ORDER_MATERIAL a_s_o_material
- LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
- LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
- LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
- WHERE
- o_order.order_status = 4
- AND o_order.ORDER_TYPE = 2
- AND a_s_o_material.SALE_DATE_OF_RECEIPT < SYSDATE
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) carCount1 ON carCount1.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- where ASO.SALE_ORDER_ID = #{saleOrderId}
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="specificationModel != null">
- and
- <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
- "specificationModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialCode != null">
- and
- <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
- "materialCode" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getSaleOrderAndMaterialById2" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT *
- FROM (
- select ASO.SALE_ORDER_ID as "saleOrderId",
- ASM.SALE_MATERIAL_ID as "saleMaterialId",
- RM.MATERIAL_ID as "materialId",
- ASO.SALE_NUMBER as "saleNumber",
- ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
- RS.SHIPPER_NAME as "shipperName",
- RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
- RM.MATERIAL_NAME as "materialName",
- ASM.MATERIAL_NUMBER as "materialNumber",
- ASM.MATERIAL_WEIGHT as "materialWeight",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
- RM.MATERIAL_CODE as "materialCode"
- from AMS_SALE_ORDER ASO
- left join RMS_SHIPPER RS
- on ASO.SHIPPER_ID = RS.SHIPPER_ID
- left join RMS_CONSIGNEE RC
- on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
- left join AMS_SALE_MATERIAL ASM
- on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- left join RMS_MATERIAL RM
- on RM.MATERIAL_ID = ASM.MATERIAL_ID
- where ASO.SALE_ORDER_ID = #{saleOrderId}
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="specificationModel != null">
- and
- <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
- "specificationModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialCode != null">
- and
- <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
- "materialCode" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT * FROM (SELECT
- RM.MATERIAL_NAME AS "materialName",
- ASM.SALE_WAREHOUSE AS "saleWareHouse"
- FROM AMS_SALE_MATERIAL ASM
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- WHERE ASM.SALE_ORDER_ID = #{saleOrderId}
- <if test="con != null">
- AND instr(RM.MATERIAL_NAME, #{con}) > 0
- </if>
- )
- <where>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
- SELECT SUM(twr.RESULT_NET_WEIGHT)
- FROM AMS_SALE_ORDER_MATERIAL asom
- left join OMSTRUCK_ORDER oo on oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
- left join TMSTRUCK_TOTAL_RESULT ttr on ttr.ORDER_ID = oo.ORDER_ID
- left join TMSTRUCK_WEIGHT_RESULT twr on twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
- where asom.sale_order_id = #{saleOrderId}
- </select>
- <select id="getCarNum" parameterType="DECIMAL" resultType="DECIMAL">
- SELECT COUNT(ASOM.SALE_ORDER_MATERIAL_ID)
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
- </select>
- <select id="getTruckNoAndMaterial" parameterType="java.util.Map" resultType="java.util.Map" >
- SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RM.MATERIAL_NAME AS "materialName",
- ASM.MATERIAL_ID AS "materialId",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- ASM.MATERIAL_WEIGHT AS "materialWeight",
- ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
- RM.MATERIAL_CODE AS "materialCode",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
- RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
- ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
- RC.CAPACITY_NUMBER AS "capacityNumber",
- ADSO.CARRIER_ID AS "carrierId",
- RCA.CARRIER_NAME AS "carrierName",
- ASOM.TRUCK_REMARK AS "truckRemark",
- DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr"
- FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
- LEFT JOIN RMS_CAPACITY RC
- ON RC.CAPACITY_ID = OO.CAPACITY_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_CARRIER RCA
- ON RCA.CARRIER_ID = ADSO.CARRIER_ID
- WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
- <if test="carrierSsoId != null">
- AND RCA.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- AND OO.ORDER_ID IS NULL
- AND ADSO.DISPATCH_ID IS NOT NULL
- AND ASM.DELETED IS NULL
- AND ASM.SALE_MATERIAL_ID IS NOT NULL
- ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
- </select>
- <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
- SELECT RRP.ADDRESS_ID AS "adddressId"
- FROM RMS_RECEIVE_PLACE RRP
- WHERE RRP.PLACE_ID = #{placeId}
- </select>
- <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
- SELECT DISTINCT RC.CARRIER_ID AS "id",
- RC.CARRIER_ID AS "value",
- RC.CARRIER_NAME AS "label",
- ACTP.PRICE_ID AS "priceId",
- ACTP.PRICE_VALUE AS "priceValue"
- FROM RMS_RECEIVE_PLACE RRP
- LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
- ON ACTP.PLACE_ID = RRP.PLACE_ID
- LEFT JOIN RMS_CARRIER RC
- ON RC.CARRIER_ID = ACTP.CARRIER_ID
- WHERE RRP.PLACE_ID = #{placeId}
- AND ACTP.CARRIER_ID IS NOT NULL
- AND ACTP.DELETED = 0
- ORDER BY ACTP.PRICE_VALUE DESC
- </select>
- <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT ACTP.PRICE_ID AS "priceId",
- ACTP.PRICE_VALUE AS "priceValue"
- FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
- WHERE ACTP.CARRIER_ID = #{carrierId}
- AND ACTP.PLACE_ID = #{placeId}
- AND ACTP.DELETED = 0
- </select>
- <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT * FROM (
- select DISTINCT * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr",
- a_s_order.UPDATE_TIME "updateTime",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
- ASM.MATERIAL_NUMBER "materialNumber",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- ASOM.SALE_SHIPPING_ADDRESS_ID "saleShippingAddressId"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_CARRIER RC
- ON RC.CARRIER_ID = ADSO.CARRIER_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- where a_s_order.SALE_ORDER_STATUS in (1,2,4)
- and a_s_order.CLOSE_STATUS is null
- and a_s_order.DELETED = 0
- and ADSO.DISPATCH_TYPE = 2
- and OO.ORDER_ID IS NULL
- AND ASM.DELETED IS NULL
- AND ASM.SALE_MATERIAL_ID IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = a_s_order.INSERT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.INSERT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.INSERT_TIME
- </if>
- <if test="carrierSsoId != null" >
- and RC.CARRIER_SSO_ID = #{carrierSsoId}
- </if>
- ) "CARRIER"
- <where>
- <if test="con != null">
- "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
- </if>
- </where>
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- order by "updateTime" DESC
- </select>
- <select id="getshippingAddress" resultType="java.lang.String">
- select
- distinct
- RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN
- ||RRP.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress" FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
- WHERE ASOM.SALE_SHIPPING_ADDRESS_ID = #{saleShippingAddressId}
- and rownum =1
- </select>
- <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
- from AMS_SALE_ORDER_CARRIER a_s_o_carrier
- left join RMS_CARRIER r_carrier
- on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
- left join AMS_SALE_ORDER a_s_order
- on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.CLOSE_STATUS is null
- and a_s_order.DELETED = 0
- <if test="carrierSsoId != null">
- and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
- </if>
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy1"></include>
- </select>
- <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT *
- FROM (
- SELECT ASO.SALE_NUMBER AS "saleNumber",
- ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
- "addressDeliveryAddress",
- ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
- DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
- AS "approvalStatus",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- RSH.SHIPPER_NAME AS "shipperName",
- RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
- ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
- ASOM.INSERT_TIME AS "insertTime",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- ASO.SALE_ORDER_ID AS "saleOrderId",
- RM.MATERIAL_NAME AS "materialName",
- RM.MATERIAL_SPECIFICATION AS "materialSpecification",
- RM.MATERIAL_MODEL AS "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN RMS_SHIPPER RSH
- ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RCO
- ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- WHERE ASO.SALE_ORDER_STATUS IN (1,2,4)
- AND ASOM.ISSUE_STATUS IS NULL
- AND ADSO.CARRIER_ID IS NULL
- AND ASO.DELETED = 0
- AND ASM.DELETED IS NULL
- AND ASM.SALE_MATERIAL_ID IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = ASO.INSERT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASO.INSERT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
- </if>
- <if test="con != null" >
- AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
- </if>
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="truckNo != null">
- and
- <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
- "truckNo" like '%${item}%'
- </foreach>
- </if>
- <if test="addressDeliveryAddress != null">
- and
- <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
- "addressDeliveryAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="saleDateOfReceipt != null">
- and
- <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
- "saleDateOfReceipt" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsignee != null">
- and
- <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
- "saleOrderConsignee" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsigneeTel != null">
- and
- <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
- "saleOrderConsigneeTel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="isselfMention != null">
- and
- <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
- "isselfMention" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
- SELECT
- RM.MATERIAL_ID AS "materialId",
- RM.MATERIAL_NAME AS "materialName",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
- RM.MATERIAL_CODE AS "materialCode",
- ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
- <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT * FROM(
- SELECT DISTINCT *
- FROM (
- SELECT ASO.SALE_NUMBER AS "saleNumber",
- ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
- "addressDeliveryAddress",
- ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
- DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
- AS "approvalStatus",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- RSH.SHIPPER_NAME AS "shipperName",
- RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
- ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
- ASOM.INSERT_TIME AS "insertTime",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- ASO.SALE_ORDER_ID AS "saleOrderId",
- RCA.CARRIER_NAME AS "carrierName",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
- RM.MATERIAL_NAME AS "materialName",
- RM.MATERIAL_SPECIFICATION AS "materialSpecification",
- RM.MATERIAL_MODEL AS "materialModel",
- RM.MATERIAL_SPECIFICATION || MATERIAL_MODEL AS "specificationModel",
- ASM.MATERIAL_NUMBER AS "materialNumber"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN RMS_SHIPPER RSH
- ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RCO
- ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
- LEFT JOIN RMS_CARRIER RCA
- ON RCA.CARRIER_ID = ADSO.CARRIER_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- WHERE ASO.SALE_ORDER_STATUS IN (2,4)
- AND ASOM.ISSUE_STATUS IS NULL
- AND ADSO.DISPATCH_TYPE = 2
- AND OO.ORDER_ID IS NULL
- AND ASO.DELETED = 0
- AND ASM.DELETED IS NULL
- AND ASM.SALE_MATERIAL_ID IS NOT NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = ASO.INSERT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASO.INSERT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
- </if>
- ) "NOCAR"
- <where>
- <if test="con != null" >
- "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
- </if>
- </where>
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="carrierName != null">
- and
- <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
- "carrierName" like '%${item}%'
- </foreach>
- </if>
- <if test="truckNo != null">
- and
- <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
- "truckNo" like '%${item}%'
- </foreach>
- </if>
- <if test="addressDeliveryAddress != null">
- and
- <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
- "addressDeliveryAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="saleDateOfReceipt != null">
- and
- <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
- "saleDateOfReceipt" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsignee != null">
- and
- <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
- "saleOrderConsignee" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsigneeTel != null">
- and
- <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
- "saleOrderConsigneeTel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="isselfMention != null">
- and
- <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
- "isselfMention" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RM.MATERIAL_NAME AS "materialName",
- ASM.MATERIAL_ID AS "materialId",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- ASM.MATERIAL_WEIGHT AS "materialWeight",
- ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
- RM.MATERIAL_CODE AS "materialCode",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
- RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
- ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
- RC.CAPACITY_NUMBER AS "capacityNumber",
- ADSO.CARRIER_ID AS "carrierId",
- ASOM.TRUCK_REMARK AS "truckRemark"
- FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- and NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
- LEFT JOIN RMS_CAPACITY RC
- ON RC.CAPACITY_ID = OO.CAPACITY_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- and ASM.SALE_MATERIAL_ID IS NOT NULL
- ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
- </select>
- <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- SELECT * FROM (
- SELECT DISTINCT *
- FROM (
- SELECT ASO.SALE_NUMBER AS "saleNumber",
- ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
- "addressDeliveryAddress",
- ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
- DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
- AS "approvalStatus",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- RSH.SHIPPER_NAME AS "shipperName",
- RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
- ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
- ASOM.INSERT_TIME AS "insertTime",
- ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
- ASO.SALE_ORDER_ID AS "saleOrderId",
- RCA.CARRIER_NAME AS "carrierName",
- RM.MATERIAL_NAME AS "materialName",
- RM.MATERIAL_SPECIFICATION AS "materialSpecification",
- RM.MATERIAL_MODEL AS "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
- RCP.CAPACITY_NUMBER AS "capacityNumber",
- OO.DRIVER_TEL AS "drivelTel",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- OO.ORDER_ID AS "orderId"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- LEFT JOIN RMS_SHIPPER RSH
- ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RCO
- ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_CAPACITY RCP
- ON RCP.CAPACITY_ID = OO.CAPACITY_ID
- LEFT JOIN RMS_CARRIER RCA
- ON RCA.CARRIER_ID = ADSO.CARRIER_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- WHERE OO.ORDER_TYPE = 1
- AND ASO.SALE_ORDER_STATUS IN (2,4)
- AND ASOM.ISSUE_STATUS IS NULL
- AND ADSO.DISPATCH_TYPE = 2
- AND OO.ORDER_ID IS NOT NULL
- AND OO.ORDER_STATUS IN (4,5)
- AND ASO.DELETED != 2
- AND ASM.DELETED IS NULL
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = ASOM.INSERT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASOM.INSERT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASOM.INSERT_TIME
- </if>
- ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
- ) "HAVECAR"
- <where>
- <if test="con != null" >
- "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
- </if>
- </where>
- )
- <where>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- and
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- and
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- and
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="carrierName != null">
- and
- <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
- "carrierName" like '%${item}%'
- </foreach>
- </if>
- <if test="truckNo != null">
- and
- <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
- "truckNo" like '%${item}%'
- </foreach>
- </if>
- <if test="addressDeliveryAddress != null">
- and
- <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
- "addressDeliveryAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="saleDateOfReceipt != null">
- and
- <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
- "saleDateOfReceipt" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsignee != null">
- and
- <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
- "saleOrderConsignee" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderConsigneeTel != null">
- and
- <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
- "saleOrderConsigneeTel" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="isselfMention != null">
- and
- <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
- "isselfMention" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
- SELECT ACTP.PRICE_ID AS "priceId"
- FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_SHIPPING_ADDRESS_ID = ACTP.PLACE_ID
- WHERE ACTP.CARRIER_ID = #{carrierId}
- AND ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- AND ACTP.DELETED = 0
- ORDER BY ACTP.INSERT_TIME DESC
- FETCH NEXT 1 ROWS ONLY
- </select>
- <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
- SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
- FROM RMS_CONSIGNEE RC
- WHERE RC.CONSIGNEE_ID = #{receiveId}
- </select>
- <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
- SELECT RC.CARRIER_ID AS "carrierId"
- FROM RMS_CARRIER RC
- WHERE RC.CARRIER_NAME = #{consigneeName}
- </select>
- <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
- SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
- ASO.SALE_REMARK AS "saleRemark",
- ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
- RSH.SHIPPER_ID AS "shipperId",
- RSH.SHIPPER_NAME AS "shipperName",
- RCO.CONSIGNEE_ID AS "receiveId",
- RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
- RSA.SALER_ID AS "salerId",
- RSA.SALER_NAME AS "salerName"
- FROM AMS_SALE_ORDER ASO
- LEFT JOIN RMS_SHIPPER RSH
- ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
- LEFT JOIN RMS_CONSIGNEE RCO
- ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
- LEFT JOIN RMS_SALER RSA
- ON RSA.SALER_ID = ASO.SALER_ID
- WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
- </select>
- <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
- RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
- RRA.ADDRESS_ID AS "shipperAddressId",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
- ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
- ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
- ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
- ASM.MATERIAL_ID AS "materialId",
- RM.MATERIAL_NAME AS "materialName",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
- RM.MATERIAL_CODE AS "materialCode",
- ASM.MATERIAL_NUMBER AS "materialNumber",
- ASM.STEEL_METER AS "steelMeters",
- ASM.IS_POUND_SALE AS "isPoundSale",
- ASOM.TRUCK_REMARK AS "truckRemark"
- FROM AMS_SALE_ORDER ASO
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- WHERE asm.SALE_MATERIAL_ID is not null
- and ASO.SALE_ORDER_ID = #{saleOrderId}
- </select>
- <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.LinkedHashMap" >
- SELECT
- DISTINCT
- RRP.PLACE_ID "placeId",
- RRP.ADDRESS_DELIVERY_ADDRESS "place",
- RRA.ADDRESS_ID "shipperAddressId",
- RRA.ADDRESS_PROVINCE "addressProvince",
- RRA.ADDRESS_DISTRICT "addressDistrict",
- RRA.ADDRESS_TOWN "addressTown",
- ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS "addressPlace",
- max(ASOM.SALE_ORDER_MATERIAL_ID) as b
- FROM AMS_SALE_ORDER ASO
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
- WHERE ASO.RECEIVE_ID = #{receiveId}
- AND RRP.PLACE_ID IS NOT NULL
- GROUP BY RRP.PLACE_ID , RRP.ADDRESS_DELIVERY_ADDRESS , RRA.ADDRESS_ID ,
- RRA.ADDRESS_PROVINCE ,
- RRA.ADDRESS_DISTRICT ,
- RRA.ADDRESS_TOWN ,
- ASOM.SALE_ORDER_CONSIGNEE_TEL
- ORDER BY b DESC
- </select>
- <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT DISTINCT *
- FROM (
- SELECT RS.SALER_NAME "salerName",
- RS.SALER_ID "salerId"
- FROM AMS_SALE_ORDER ASO
- LEFT JOIN RMS_SALER RS
- ON RS.SALER_ID = ASO.SALER_ID
- WHERE ASO.RECEIVE_ID = #{receiveId}
- AND RS.SALER_ID IS NOT NULL
- AND ASO.SALE_TYPE = 1
- ORDER BY ASO.SALE_ORDER_ID DESC
- )
- WHERE rownum <![CDATA[
- <
- ]]> 2
- </select>
- <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
- SELECT DISTINCT *
- FROM (
- SELECT OO.DRIVER_TEL "driverTel"
- FROM RMS_CAPACITY RCA
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.CAPACITY_ID = RCA.CAPACITY_ID
- WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
- AND OO.ORDER_TYPE = 1
- AND OO.DRIVER_TEL IS NOT NULL
- ORDER BY OO.ORDER_ID DESC
- )
- WHERE ROWNUM <![CDATA[
- <
- ]]> 2
- </select>
- <!-- 查询内转焦炭订单 -->
- <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT * FROM (
- SELECT *from(
- select
- OO.ORDER_NUMBER "orderNumber",
- ASO.SALE_NUMBER "saleNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
- ACTP.PRICE_VALUE "priceValue",
- ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
- OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
- RS.SHIPPER_NAME "shipperName",
- OO.ORDER_ID "orderId",
- RC3.CARRIER_NAME "carrierName"
- FROM OMSTRUCK_ORDER OO
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
- ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN RMS_CARRIER RC3
- ON RC3.CARRIER_ID = ADSO.CARRIER_ID
- LEFT JOIN RMS_CONSIGNEE RC2
- ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
- LEFT JOIN RMS_CAPACITY RC
- ON OO.CAPACITY_ID=RC.CAPACITY_ID
- LEFT JOIN RMS_SHIPPER RS
- ON RS.SHIPPER_ID=ASO.SHIPPER_ID
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA
- ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
- LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
- ON OO.PRICE_ID=ACTP.PRICE_ID
- WHERE OO.ORDER_TYPE = 2
- AND ASO.SHIPPER_ID = 2
- AND ASO.CLOSE_STATUS = 0
- <where>
- <if test="orderStatus!=null">
- AND OO.ORDER_STATUS = #{orderStatus}
- </if>
- </where>
- ) RRC
- <if test="con != null">
- WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
- </if>
- )
- <where>
- <if test="orderNumber != null">
- <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
- "orderNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="carrierName != null">
- <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
- "carrierName" like '%${item}%'
- </foreach>
- </if>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="capacityNumber != null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy">
- </include>
- <if test="orderField == null ">
- order by "orderNumber" desc
- </if>
- </select>
-
- <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
- SELECT ADSO.DISPATCH_ID AS "dispatchId"
- FROM AMS_DISPATCH_SALE_ORDER ADSO
- WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
- <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT ASTM.MATERIAL_ID AS "saleMaterialId",
- ASM.EAS_PRIMARY_ID AS "closeEntryId"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
-
- <select id="getSaleList" resultType="java.util.Map" >
- SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
- ASM.SALE_MATERIAL_ID "saleMaterialId",
- ASM.MATERIAL_ID "materialId"
- FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- AND ASM.MATERIAL_ID = #{materialId}
- </select>
- <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- ASM.MATERIAL_WEIGHT "materialWeight",
- ASM.SALE_WAREHOUSE "saleWareHouse",
- nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
- nvl(sumWeight.weight ,0) as "netWeight",
- nvl(sumWeight2.weight ,0) as "weight",
- nvl(carCount.coun ,0) as "carCount",
- RCA.CARRIER_NAME as "carrierName"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
- ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_CARRIER RCA
- ON RCA.CARRIER_ID = ASOC.CARRIER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- left join (
- select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
- from AMS_SALE_ORDER_MATERIAL a_s_o_material
- left join Omstruck_Order o_order
- on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
- left join Tmstruck_Total_Result t_t_result
- on o_order.order_id=t_t_result.order_id
- left join Tmstruck_Weight_Result t_w_result
- on t_t_result.result_total_id=t_w_result.result_total_id
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) sumWeight
- on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- left join (
- select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- from AMS_SALE_ORDER_MATERIAL a_s_o_material
- left join Omstruck_Order o_order
- on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
- left join Tmstruck_Total_Result t_t_result
- on o_order.order_id=t_t_result.order_id
- left join Tmstruck_Weight_Result t_w_result
- on t_t_result.result_total_id=t_w_result.result_total_id
- left join OMSTRUCK_ORDER_MATERIAL o_o_material
- on o_order.order_id=o_o_material.ORDER_ID
- where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) sumWeight2
- on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- left join (
- select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
- from AMS_SALE_ORDER_MATERIAL a_s_o_material
- left join Omstruck_Order o_order
- on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
- left join Tmstruck_Total_Result t_t_result
- on o_order.order_id=t_t_result.order_id
- left join Tmstruck_Weight_Result t_w_result
- on t_t_result.result_total_id=t_w_result.result_total_id
- where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
- GROUP BY
- a_s_o_Material.SALE_ORDER_ID
- ) carCount
- on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- where (ASM.SALE_WAREHOUSE = '副产品库'
- or ASM.SALE_WAREHOUSE = '钒渣库')
- and a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.CLOSE_STATUS is null
- and a_s_order.DELETED = #{deleted}
- and a_s_order.SHIPPER_ID = 1
- and a_s_order.SALE_TYPE is null
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- ORDER BY a_s_order.UPDATE_TIME DESC
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- and "statusStr" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <!-- 关闭未进厂的运单 -->
- <update id="closeOrderNotIn" parameterType="DECIMAL" >
- UPDATE OMSTRUCK_ORDER OO
- SET OO.ORDER_STATUS = 7,
- OO.INSERT_UPDATE_REMARK = '关闭销售订单,运单同步关闭'
- WHERE OO.ORDER_ID IN (
- SELECT OO.ORDER_ID "orderId"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID = OO.ORDER_ID
- LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
- ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
- AND TER.RESULT_ENTRY_GATE_TIME IS NULL
- AND OO.ORDER_TYPE IN (1,2)
- AND OO.ORDER_ID IS NOT NULL
- AND OO.ORDER_STATUS IN (4,5)
- )
- </update>
- <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
- SELECT RCA.CAPACITY_NUMBER AS "r1c1",
- OO.ORDER_NUMBER AS "r1c2",
- RM.EAS_MATERIAL_ID AS "r1c3",
- RM.MATERIAL_NAME AS "r1c4",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
- FROM OMSTRUCK_ORDER OO
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
- ON OOM.ORDER_ID = OO.ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = OOM.MATERIAL_ID
- LEFT JOIN RMS_CAPACITY RCA
- ON OO.CAPACITY_ID = RCA.CAPACITY_ID
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- LEFT JOIN RMS_CONSIGNEE RC
- ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
- </select>
- <select id="getSteelOrderDeletedList" resultType="java.util.Map" parameterType="java.util.Map">
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
- ASM.MATERIAL_NUMBER "materialNumber",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- ASM.SALE_WAREHOUSE "saleWareHouse",
- a_s_order.DELETED "deleted"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN RMS_SALER R_SALER
- ON R_SALER.SALER_ID = a_s_order.SALER_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.DELETED = 1
- and a_s_order.SALE_TYPE = 1
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- <if test="saler != null" >
- and R_SALER.SALER_NAME = #{saler}
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- ORDER BY a_s_order.UPDATE_TIME DESC
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- and "statusStr" like '%${item}%'
- </foreach>
- </if>
- <!-- <if test="startTime != null">-->
- <!-- and "insertTime" >= to_date('${startTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <!-- <if test="endTime != null">-->
- <!-- and "insertTime" <= to_date('${endTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="getAllSteelSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map" >
- select * from(
- select a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS || a_s_order.DELETED,00,'未上传',10,'已上传',20,'销售已提交',40,'财务已审批',21,'反审核',41,'反审核',22,'已关闭',42,'已关闭') "statusStr",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION "materialSpecification",
- RM.MATERIAL_MODEL "materialModel",
- RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
- ASM.SALE_WAREHOUSE "saleWareHouse"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- where a_s_order.CLOSE_STATUS is null
- and a_s_order.DELETED = 0
- <if test="con != null">
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
- </if>
- <if test="shipperId != null">
- and a_s_order.SHIPPER_ID = #{shipperId}
- </if>
- <if test="saleType != null">
- and a_s_order.SALE_TYPE = #{saleType}
- </if>
- <if test="saleType == null">
- and a_s_order.SALE_TYPE is null
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- ORDER BY a_s_order.UPDATE_TIME DESC
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- and "statusStr" like '%${item}%'
- </foreach>
- </if>
- <!-- <if test="startTime != null">-->
- <!-- and "insertTime" >= to_date('${startTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <!-- <if test="endTime != null">-->
- <!-- and "insertTime" <= to_date('${endTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <!-- 修改厂内未装货车辆的运单车牌号 -->
- <update id="updateCapacityNumberInFactory" parameterType="java.util.Map" >
- UPDATE OMSTRUCK_ORDER OO
- SET OO.CAPACITY_ID = #{capacityId},
- OO.CAPACITYIDS=#{capacityids},
- OO.insert_update_remark = '修改车牌号'
- WHERE OO.ORDER_ID = #{orderId}
- </update>
- <update id="bindSaleArea">
- UPDATE RMS_CONSIGNEE RC
- SET RC.AREA_ID = #{saleAreaId}
- WHERE RC.CONSIGNEE_ID = #{receiveId}
- </update>
- <select id="getCarrierByAddress" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT DISTINCT ACTP.CARRIER_ID "carrierId"
- FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ACTP.PLACE_ID
- WHERE
- ACTP.CARRIER_ID IS NOT NULL
- AND RRP.ADDRESS_ID = #{addressId}
- and ACTP.DELETED = 0
- </select>
- <select id="getSaleCokeOrder" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT DISTINCT * FROM(
- SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
- a_s_order.SALE_NUMBER "saleNumber",
- r_shipper.SHIPPER_NAME "shipperName",
- r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
- r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
- r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
- a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
- a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
- a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
- a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
- a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
- a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
- a_s_order.SALE_ORDER_TAX "saleOrderTax",
- a_s_order.SALE_REMARK "saleRemark",
- a_s_order.INSERT_TIME "insertTime",
- DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
- RM.MATERIAL_NAME "materialName",
- ASM.MATERIAL_NUMBER "materialNumber",
- ASM.SALE_WAREHOUSE "saleWareHouse",
- a_s_order.DELETED "deleted",
- a_s_order.SHIPPER_ID "shipperId",
- a_s_order.RECEIVE_ID "receiveId",
- a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention"
- from AMS_SALE_ORDER a_s_order
- left join RMS_SHIPPER r_shipper
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
- left join RMS_CONSIGNEE r_consignee
- on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- where a_s_order.SALE_ORDER_STATUS in (2,4)
- and a_s_order.CLOSE_STATUS is null
- and a_s_order.DELETED = 0
- and ASM.DELETED IS NULL
- <if test="con != null">
- 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 )
- </if>
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= a_s_order.UPDATE_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
- </if>
- <if test="shipperId != null">
- and a_s_order.SHIPPER_ID = #{shipperId}
- </if>
- <if test="consigneeSsoId != null">
- and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
- </if>
- <if test="saleType == null">
- and a_s_order.SALE_TYPE is null
- </if>
- ORDER BY a_s_order.UPDATE_TIME DESC
- )
- <where>
- <if test="saleNumber != null">
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialSpecification != null">
- <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
- "materialSpecification" like '%${item}%'
- </foreach>
- </if>
- <if test="materialModel != null">
- <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
- "materialModel" like '%${item}%'
- </foreach>
- </if>
- <if test="statusStr != null">
- <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
- and "statusStr" like '%${item}%'
- </foreach>
- </if>
- <!-- <if test="startTime != null">-->
- <!-- and "insertTime" >= to_date('${startTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <!-- <if test="endTime != null">-->
- <!-- and "insertTime" <= to_date('${endTime}','yyyy-mm-dd')-->
- <!-- </if>-->
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeCompanyName != null">
- and
- <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
- "consigneeCompanyName" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyAmount != null">
- and
- <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="consigneeWarrantyWeight != null">
- and
- <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
- "consigneeWarrantyWeight" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderIsselfMention != null">
- and
- <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
- "saleOrderIsselfMention" like '%${item}%'
- </foreach>
- </if>
- <if test="saleAccountBalance != null">
- and
- <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
- "saleAccountBalance" like '%${item}%'
- </foreach>
- </if>
- <if test="saleCurrentOrderAmount != null">
- and
- <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
- "saleCurrentOrderAmount" like '%${item}%'
- </foreach>
- </if>
- <if test="saleHistoricalOrderAmout != null">
- and
- <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
- "saleHistoricalOrderAmout" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderReceiveCustomer != null">
- and
- <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
- "saleOrderReceiveCustomer" like '%${item}%'
- </foreach>
- </if>
- <if test="saleUnitPrice != null">
- and
- <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
- "saleUnitPrice" like '%${item}%'
- </foreach>
- </if>
- <if test="saleOrderTax != null">
- and
- <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
- "saleOrderTax" like '%${item}%'
- </foreach>
- </if>
- <if test="saleRemark != null">
- and
- <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
- "saleRemark" like '%${item}%'
- </foreach>
- </if>
- </where>
- </select>
- <select id="findStatus" parameterType="DECIMAL" resultType="java.lang.Integer" >
- SELECT ASO.SALE_ORDER_STATUS AS "saleStatus"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
- <select id="getPlaceId" parameterType="DECIMAL" resultType="DECIMAL" >
- SELECT ASOM.SALE_SHIPPING_ADDRESS_ID "placeId"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
- <select id="getAddressPriceList" parameterType="java.util.Map" resultType="java.util.Map" >
- SELECT ACTP.PRICE_ID AS "priceId"
- FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
- LEFT JOIN RMS_RECEIVE_PLACE RRP
- ON RRP.PLACE_ID = ACTP.PLACE_ID
- WHERE ACTP.CARRIER_ID = #{carrierId}
- AND RRP.ADDRESS_ID = #{addressId}
- AND ACTP.DELETED = 0
- ORDER BY ACTP.OLD_DATE DESC
- NULLS LAST
- </select>
- <select id="findSelfMention" parameterType="DECIMAL" resultType="java.lang.String" >
- SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "selfMention"
- FROM AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
- WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
- </select>
- <select id="findReceiveId" parameterType="java.lang.String" resultType="DECIMAL" >
- SELECT RC.CONSIGNEE_ID AS "receiveId"
- FROM RMS_CONSIGNEE RC
- WHERE RC.CONSIGNEE_COMPANY_NAME = #{receiveName}
- </select>
- <select id="findSalerId" parameterType="java.lang.String" resultType="DECIMAL" >
- SELECT RS.SALER_ID AS "salerId"
- FROM RMS_SALER RS
- WHERE RS.SALER_NAME = #{salerName}
- </select>
- <select id="findMaterialId" parameterType="java.util.Map" resultType="DECIMAL">
- SELECT RM.MATERIAL_ID AS "materialId"
- FROM RMS_MATERIAL RM
- WHERE RM.MATERIAL_NAME = #{name}
- AND RM.MATERIAL_SPECIFICATION = #{specification}
- <if test="model != null">
- AND RM.MATERIAL_MODEL = #{model}
- </if>
- </select>
- <select id="findAddressId" parameterType="java.util.Map" resultType="DECIMAL" >
- SELECT RRA.ADDRESS_ID AS "addressId"
- FROM RMS_RECEIVE_ADDRESS RRA
- WHERE RRA.ADDRESS_PROVINCE = #{province}
- AND RRA.ADDRESS_DISTRICT = #{district}
- AND RRA.ADDRESS_TOWN = #{town}
- </select>
- <select id="getSaleMaterialMessage" parameterType="DECIMAL" resultType="java.util.Map" >
- SELECT ASM.MATERIAL_ID "materialId",
- OO.ORDER_ID "orderId",
- TTR.RESULT_TOTAL_ID "resultTotalId",
- OO.ORDER_STATUS "orderStatus",
- WOR.RESULT_ID "outBoundId",
- ASM.MATERIAL_NUMBER "materialNumber"
- FROM AMS_SALE_MATERIAL ASM
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER OO
- ON ASTM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
- AND OO.ORDER_TYPE = 1
- LEFT JOIN WMSP_OUTBOUND_RESULT WOR
- ON WOR.BILL_LADING_ID = OO.ORDER_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID = OO.ORDER_ID
- WHERE ASM.SALE_MATERIAL_ID = #{saleMaterialId}
- </select>
- <select id="findOrderMaxNum" parameterType="DECIMAL" resultType="java.lang.Integer" >
- SELECT MAx(TLFR.SEGMENT_SQE)
- FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- WHERE TLFR.RESULT_TOTAL_ID = #{resultTotalId}
- </select>
- <select id="getKucunList" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT * FROM (
- SELECT ASO.SALE_NUMBER "saleNo", ASO.SALE_REMARK "saleRemark",
- RAS1.ARRIVAL_NAME "sendStation",
- RAS.ARRIVAL_NAME "toTheStation",
- RM.MATERIAL_NAME "materialName",
- RM.MATERIAL_SPECIFICATION||'('||RM.MATERIAL_MODEL||')' "materialSpa",
- ASM.MATERIAL_NUMBER "materialNum",
- ASM.MATERIAL_WEIGHT "materialWeight",
- RDOINDEP.ORG_NAME "transInDep",
- RDOOUTDEP.ORG_NAME "transOutDep",
- RISWINOF.INWARD_WAREHOUSE_NAME "transInWarehouse",
- RC.CONSIGNEE_COMPANY_NAME "receiveName",
- ASO.SALE_ORDER_ID "saleOrderId",
- RAS1.ARRIVAL_ID "sendStationId",
- RAS.ARRIVAL_ID "toTheStationId",
- ASM.IS_POUND_SALE "isPoundSale",
- ASM.SALE_MATERIAL_ID "saleMaterialId",
- TPAR.RESULT_ID "approveId"
- FROM AMS_SALE_ORDER ASO
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = ASM.MATERIAL_ID
- LEFT JOIN TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
- ON TPAR.RAIL_PLAN_ID = ASM.SALE_MATERIAL_ID
- LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
- ON RAS.ARRIVAL_ID = TPAR.TO_THE_STATION_ID
- LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS1
- ON RAS1.ARRIVAL_ID = TPAR.SEND_STATION_ID
- LEFT JOIN RMS_CONSIGNEE RC
- ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
- LEFT JOIN RMS_DEP_ORG RDOINDEP
- ON RDOINDEP.ORG_CODE = ASO.TRANSFER_IN_DEP
- LEFT JOIN RMS_DEP_ORG RDOOUTDEP
- ON RDOOUTDEP.ORG_CODE = ASO.TRANSFER_OUT_DEP
- LEFT JOIN RMS_INWARD_STEEL_WAREHOUSE RISWINOF
- ON RISWINOF.INWARD_WAREHOUSE_CODE = ASM.TRANSFER_IN_OF_WAREHOUSE
- WHERE ASO.SALE_TYPE = 4
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = ASO.INSERT_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASO.INSERT_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
- </if>
- <if test="remark != null">
- and ASO.SALE_REMARK||RM.MATERIAL_NAME LIKE #{remark}
- </if>
- <if test="totheStation != null">
- and RAS.ARRIVAL_NAME LIKE #{totheStation}
- </if>
- <if test="consigneeName != null">
- and RC.CONSIGNEE_COMPANY_NAME like #{consigneeName}
- </if>
- <if test="transferIndep != null">
- and RDOINDEP.ORG_NAME LIKE #{transferIndep}
- </if>
- )
- </select>
- <select id="selectSaleAreaId" resultType="java.math.BigDecimal" parameterType="decimal">
- SELECT RC.AREA_ID AS "areaId"
- FROM RMS_CONSIGNEE RC
- WHERE RC.CONSIGNEE_ID = #{receiveId}
- </select>
- <select id="selectSaleAreaIdByName" resultType="java.math.BigDecimal" parameterType="string">
- SELECT RSA.AREA_ID FROM RMS_SALE_AREA RSA
- WHERE RSA.AREA_NAME = #{saleAreaName}
- </select>
- <select id="getMoreCarrier" resultType="java.math.BigDecimal" parameterType="string">
- SELECT count(RMCP.CARRIER_PLACE_ID) FROM RMS_MORE_CARRIER_PLACE RMCP
- WHERE #{place} LIKE '%' || RMCP.CARRIER_PLACE_VALUE || '%'
- </select>
- <select id="getOrderIdByCapacity" resultType="java.util.Map">
- select OO.order_ID "orderId",
- RC.CAPACITY_NUMBER "capacityNumber",
- TTR.RESULT_TOTAL_ID "resultTotalId",
- TER.RESULT_ENTRY_GATE_TIME "isEn",
- TLFR.RESULT_OUT_GATE_TIME "isLeave",
- TAR.RESULT_ID "isArrival",
- TRR.RESULT_ID "isReceipt"
- from OMSTRUCK_ORDER OO
- LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID =RC.CAPACITY_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID=OO.ORDER_ID
- LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER ON TER.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR ON TLFR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_ARRIVAL_RESULT TAR ON TAR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_RECEIPT_RESULT TRR ON TRR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- where RC.CAPACITY_NUMBER=#{capacityNumber} and OO.order_status=5
- fetch next 1 rows only
- </select>
- <select id="getOrderMes" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT TTR.RESULT_TOTAL_ID "resultTotalId",
- OO.ORDER_STATUS "orderStatus"
- FROM OMSTRUCK_ORDER OO
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID = OO.ORDER_ID
- WHERE OO.ORDER_ID = #{orderId}
- </select>
- <select id="getId" resultType="java.math.BigDecimal">
- select ASOM.SALE_ORDER_MATERIAL_ID "saleodermatetialid"
- from AMS_SALE_ORDER_MATERIAL ASOM
- LEFT JOIN AMS_SALE_ORDER ASO
- ON ASO.SALE_ORDER_ID= ASOM.SALE_ORDER_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- where ASO.sale_number=#{saleOrderNo}
- and ASM.SALE_MATERIAL_ID =#{saleMaterialId}
- </select>
- <update id="updateForTel">
- update AMS_SALE_ORDER_MATERIAL ASOM
- set ASOM.SALE_ORDER_CONSIGNEE_TEL=#{consigneeTel}
- WHERE ASOM.SALE_ORDER_MATERIAL_ID=#{saleodermatetialid}
- </update>
- <update id="updateSaleOrderStatus">
- update AMS_SALE_ORDER ASO
- set aso.DELETED = 2
- WHERE ASO.SALE_NUMBER = #{saleNumber}
- </update>
- <select id="getDispachSwitch" resultType="java.lang.Integer">
- SELECT IS_OK "isOk" FROM AMS_DISPATCH_SWITCH
- fetch NEXT 1 rows only
- </select>
- <select id="getSteelOrderMap" resultType="java.util.Map" parameterType="java.math.BigDecimal">
- SELECT OO.ORDER_ID FROM OMSTRUCK_ORDER OO
- WHERE OO.ORDER_PLAN_ID = #{saleOrderMaterialId}
- AND OO.ORDER_TYPE = 1
- </select>
- <update id="updateAMSDeleted">
- update AMS_SALE_MATERIAL ASM
- set ASM.DELETED = 0
- where ASM.SALE_MATERIAL_ID=#{closeWlEntryId}
- </update>
- <update id="updateOldSaleOrderUpload" parameterType="java.math.BigDecimal">
- update AMS_SALE_ORDER ASO
- SET ASO.INSERT_UPDATE_REMARK = '物流上传金蝶成功'
- WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
- </update>
- <delete id="delectQueueS">
- delete from QMS_QUEUE_LIST qql
- where qql.LIST_ID=#{capacityIdM}
- </delete>
- <select id="queueSingle" resultType="java.math.BigDecimal">
- select qql.LIST_ID
- from OMSTRUCK_ORDER oo
- LEFT JOIN QMS_QUEUE_LIST qql
- on qql.capacity_id=oo.capacity_id
- where oo.order_id=#{orderId}
- </select>
- <select id="isGPS" resultType="java.lang.Integer">
- SELECT count(*) FROM RMS_CAPACITY WHERE CAPACITY_NUMBER=#{capacityNumber} and CAPACITY_GPS='是'
- </select>
- <select id="getEasPrimaryIds" resultType="string" parameterType="map">
- SELECT distinct EAS_PRIMARY_ID FROM OMSTRUCK_ORDER OO
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
- ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
- LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
- ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
- LEFT JOIN AMS_SALE_MATERIAL ASM
- ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID = TTR.ORDER_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
- ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- AND ASM.MATERIAL_ID = TWR.MATERIAL_ID
- where NVL(ASM.DELETED,0) = 0
- AND TWR.RESULT_NET_WEIGHT IS NOT NULL
- AND ASM.EAS_PRIMARY_ID IS NOT NULL
- AND OO.ORDER_TYPE = 1
- <if test="easPrimaryList != null and easPrimaryList.size > 0">
- and <foreach collection="easPrimaryList" item="item" open="(" separator="or" close=")">
- ASM.EAS_PRIMARY_ID LIKE '%${item}%'
- </foreach>
- </if>
- <if test="easPrimaryList == null">
- and ASM.SALE_MAKE_DATE IS NULL
- AND ASOM.SALE_DATE_OF_RECEIPT < sysdate
- AND ASOM.SALE_DATE_OF_RECEIPT > sysdate -20
- ORDER BY OO.ORDER_ID
- FETCH NEXT 5000 ROWS ONLY
- </if>
- </select>
- <select id="getNextCarrier" resultType="java.util.Map" parameterType="java.math.BigDecimal">
- select adso.CARRIER_ID "carrierId" from AMS_SALE_ORDER_MATERIAL asom
- left join RMS_RECEIVE_PLACE rrp
- on rrp.PLACE_ID = asom.SALE_SHIPPING_ADDRESS_ID
- left join AMS_DISPATCH_SALE_ORDER adso
- on adso.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
- left join rms_carrier rc
- on rc.CARRIER_ID = adso.CARRIER_ID
- where rrp.ADDRESS_ID = #{addressId}
- and rc.CARRIER_TYPE = '销售钢材承运商'
- order by asom.SALE_ORDER_MATERIAL_ID desc
- fetch first 1 row only
- </select>
- <select id="getPriceIdByPlaceId" resultType="java.math.BigDecimal" parameterType="java.math.BigDecimal">
- SELECT ACTP.PRICE_ID FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
- WHERE ACTP.TYPE = 1
- and ACTP.DELETED = 0
- AND ACTP.PLACE_ID = #{placeId}
- fetch first 1 row only
- </select>
- </mapper>
|