AmsSaleOrderMapper.xml 210 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.steerinfo.dil.mapper.AmsSaleOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsSaleOrder">
  5. <id column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId" />
  6. <result column="PLAN_ID" jdbcType="DECIMAL" property="planId" />
  7. <result column="SALE_NUMBER" jdbcType="VARCHAR" property="saleNumber" />
  8. <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId" />
  9. <result column="RECEIVE_ID" jdbcType="DECIMAL" property="receiveId" />
  10. <result column="SALE_ACCOUNT_BALANCE" jdbcType="DECIMAL" property="saleAccountBalance" />
  11. <result column="SALE_CURRENT_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleCurrentOrderAmount" />
  12. <result column="SALE_HISTORICAL_ORDER_AMOUNT" jdbcType="DECIMAL" property="saleHistoricalOrderAmount" />
  13. <result column="SALE_ORDER_STATUS" jdbcType="DECIMAL" property="saleOrderStatus" />
  14. <result column="SALE_ORDER_RECEIVE_CUSTOMER" jdbcType="VARCHAR" property="saleOrderReceiveCustomer" />
  15. <result column="SALE_ORDER_ISSELF_MENTION" jdbcType="VARCHAR" property="saleOrderIsselfMention" />
  16. <result column="SALE_UNIT_PRICE" jdbcType="DECIMAL" property="saleUnitPrice" />
  17. <result column="SALE_ORDER_TAX" jdbcType="VARCHAR" property="saleOrderTax" />
  18. <result column="SALE_REMARK" jdbcType="VARCHAR" property="saleRemark" />
  19. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  20. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  21. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  22. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  23. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  24. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  25. <result column="CLOSE_STATUS" jdbcType="DECIMAL" property="closeStatus" />
  26. <result column="SALER_ID" jdbcType="DECIMAL" property="salerId" />
  27. <result column="SALE_TYPE" jdbcType="DECIMAL" property="saleType" />
  28. <result column="TRANSFER_OUT_INVENTORY_ORG" jdbcType="VARCHAR" property="transferOutInventoryOrg" />
  29. <result column="TRANSFER_IN_INVENTORY_ORG" jdbcType="VARCHAR" property="transferInInventoryOrg" />
  30. <result column="TRANSFER_OUT_DEP" jdbcType="VARCHAR" property="transferOutDep" />
  31. <result column="TRANSFER_IN_DEP" jdbcType="VARCHAR" property="transferInDep" />
  32. <result column="BUSINESS_DATE" jdbcType="TIMESTAMP" property="businessDate" />
  33. <result column="WHETHER_THE_CAR" jdbcType="VARCHAR" property="whetherTheCar" />
  34. <result column="BUSINESS_TYPE" jdbcType="VARCHAR" property="businessType" />
  35. </resultMap>
  36. <sql id="columns">
  37. SALE_ORDER_ID, PLAN_ID, SALE_NUMBER, SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  38. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT, SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  39. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE, SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  40. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
  41. SALER_ID, SALE_TYPE, TRANSFER_OUT_INVENTORY_ORG, TRANSFER_IN_INVENTORY_ORG, TRANSFER_OUT_DEP,
  42. TRANSFER_IN_DEP, BUSINESS_DATE, WHETHER_THE_CAR, BUSINESS_TYPE
  43. </sql>
  44. <sql id="columns_alias">
  45. t.SALE_ORDER_ID, t.PLAN_ID, t.SALE_NUMBER, t.SHIPPER_ID, t.RECEIVE_ID, t.SALE_ACCOUNT_BALANCE,
  46. t.SALE_CURRENT_ORDER_AMOUNT, t.SALE_HISTORICAL_ORDER_AMOUNT, t.SALE_ORDER_STATUS,
  47. t.SALE_ORDER_RECEIVE_CUSTOMER, t.SALE_ORDER_ISSELF_MENTION, t.SALE_UNIT_PRICE, t.SALE_ORDER_TAX,
  48. t.SALE_REMARK, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  49. t.INSERT_UPDATE_REMARK, t.DELETED, t.CLOSE_STATUS, t.SALER_ID, t.SALE_TYPE, t.TRANSFER_OUT_INVENTORY_ORG,
  50. t.TRANSFER_IN_INVENTORY_ORG, t.TRANSFER_OUT_DEP, t.TRANSFER_IN_DEP, t.BUSINESS_DATE,
  51. t.WHETHER_THE_CAR, t.BUSINESS_TYPE
  52. </sql>
  53. <sql id="select">
  54. SELECT <include refid="columns" /> FROM AMS_SALE_ORDER
  55. </sql>
  56. <sql id="select_alias">
  57. SELECT <include refid="columns_alias" /> FROM AMS_SALE_ORDER t
  58. </sql>
  59. <sql id="where">
  60. <where>
  61. <if test="saleOrderId != null">
  62. and SALE_ORDER_ID = #{saleOrderId}
  63. </if>
  64. <if test="planId != null">
  65. and PLAN_ID = #{planId}
  66. </if>
  67. <if test="saleNumber != null and saleNumber != ''">
  68. and SALE_NUMBER = #{saleNumber}
  69. </if>
  70. <if test="shipperId != null">
  71. and SHIPPER_ID = #{shipperId}
  72. </if>
  73. <if test="receiveId != null">
  74. and RECEIVE_ID = #{receiveId}
  75. </if>
  76. <if test="saleAccountBalance != null">
  77. and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  78. </if>
  79. <if test="saleCurrentOrderAmount != null">
  80. and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  81. </if>
  82. <if test="saleHistoricalOrderAmount != null">
  83. and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  84. </if>
  85. <if test="saleOrderStatus != null">
  86. and SALE_ORDER_STATUS = #{saleOrderStatus}
  87. </if>
  88. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  89. and SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
  90. </if>
  91. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  92. and SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
  93. </if>
  94. <if test="saleUnitPrice != null">
  95. and SALE_UNIT_PRICE = #{saleUnitPrice}
  96. </if>
  97. <if test="saleOrderTax != null and saleOrderTax != ''">
  98. and SALE_ORDER_TAX = #{saleOrderTax}
  99. </if>
  100. <if test="saleRemark != null and saleRemark != ''">
  101. and SALE_REMARK = #{saleRemark}
  102. </if>
  103. <if test="insertUsername != null and insertUsername != ''">
  104. and INSERT_USERNAME = #{insertUsername}
  105. </if>
  106. <if test="insertTime != null">
  107. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  108. </if>
  109. <if test="updateUsername != null and updateUsername != ''">
  110. and UPDATE_USERNAME = #{updateUsername}
  111. </if>
  112. <if test="updateTime != null">
  113. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  114. </if>
  115. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  116. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  117. </if>
  118. <if test="deleted != null">
  119. and DELETED = #{deleted}
  120. </if>
  121. <if test="closeStatus != null">
  122. and CLOSE_STATUS = #{closeStatus}
  123. </if>
  124. <if test="salerId != null">
  125. and SALER_ID = #{salerId}
  126. </if>
  127. <if test="saleType != null">
  128. and SALE_TYPE = #{saleType}
  129. </if>
  130. <if test="transferOutInventoryOrg != null and transferOutInventoryOrg != ''">
  131. and TRANSFER_OUT_INVENTORY_ORG = #{transferOutInventoryOrg}
  132. </if>
  133. <if test="transferInInventoryOrg != null and transferInInventoryOrg != ''">
  134. and TRANSFER_IN_INVENTORY_ORG = #{transferInInventoryOrg}
  135. </if>
  136. <if test="transferOutDep != null and transferOutDep != ''">
  137. and TRANSFER_OUT_DEP = #{transferOutDep}
  138. </if>
  139. <if test="transferInDep != null and transferInDep != ''">
  140. and TRANSFER_IN_DEP = #{transferInDep}
  141. </if>
  142. <if test="businessDate != null">
  143. and TO_CHAR(BUSINESS_DATE,'yyyy-MM-dd') = #{businessDate}
  144. </if>
  145. <if test="whetherTheCar != null and whetherTheCar != ''">
  146. and WHETHER_THE_CAR = #{whetherTheCar}
  147. </if>
  148. <if test="businessType != null and businessType != ''">
  149. and BUSINESS_TYPE = #{businessType}
  150. </if>
  151. </where>
  152. </sql>
  153. <sql id="whereLike">
  154. <where>
  155. <if test="saleOrderId != null">
  156. and SALE_ORDER_ID = #{saleOrderId}
  157. </if>
  158. <if test="planId != null">
  159. and PLAN_ID = #{planId}
  160. </if>
  161. <if test="saleNumber != null and saleNumber != ''">
  162. and SALE_NUMBER LIKE '%${saleNumber}%'
  163. </if>
  164. <if test="shipperId != null">
  165. and SHIPPER_ID = #{shipperId}
  166. </if>
  167. <if test="receiveId != null">
  168. and RECEIVE_ID = #{receiveId}
  169. </if>
  170. <if test="saleAccountBalance != null">
  171. and SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  172. </if>
  173. <if test="saleCurrentOrderAmount != null">
  174. and SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  175. </if>
  176. <if test="saleHistoricalOrderAmount != null">
  177. and SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  178. </if>
  179. <if test="saleOrderStatus != null">
  180. and SALE_ORDER_STATUS = #{saleOrderStatus}
  181. </if>
  182. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  183. and SALE_ORDER_RECEIVE_CUSTOMER LIKE '%${saleOrderReceiveCustomer}%'
  184. </if>
  185. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  186. and SALE_ORDER_ISSELF_MENTION LIKE '%${saleOrderIsselfMention}%'
  187. </if>
  188. <if test="saleUnitPrice != null">
  189. and SALE_UNIT_PRICE = #{saleUnitPrice}
  190. </if>
  191. <if test="saleOrderTax != null and saleOrderTax != ''">
  192. and SALE_ORDER_TAX LIKE '%${saleOrderTax}%'
  193. </if>
  194. <if test="saleRemark != null and saleRemark != ''">
  195. and SALE_REMARK LIKE '%${saleRemark}%'
  196. </if>
  197. <if test="insertUsername != null and insertUsername != ''">
  198. and INSERT_USERNAME LIKE '%${insertUsername}%'
  199. </if>
  200. <if test="insertTime != null">
  201. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  202. </if>
  203. <if test="updateUsername != null and updateUsername != ''">
  204. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  205. </if>
  206. <if test="updateTime != null">
  207. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  208. </if>
  209. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  210. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  211. </if>
  212. <if test="deleted != null">
  213. and DELETED = #{deleted}
  214. </if>
  215. <if test="closeStatus != null">
  216. and CLOSE_STATUS = #{closeStatus}
  217. </if>
  218. <if test="salerId != null">
  219. and SALER_ID = #{salerId}
  220. </if>
  221. <if test="saleType != null">
  222. and SALE_TYPE = #{saleType}
  223. </if>
  224. <if test="transferOutInventoryOrg != null and transferOutInventoryOrg != ''">
  225. and TRANSFER_OUT_INVENTORY_ORG LIKE '%${transferOutInventoryOrg}%'
  226. </if>
  227. <if test="transferInInventoryOrg != null and transferInInventoryOrg != ''">
  228. and TRANSFER_IN_INVENTORY_ORG LIKE '%${transferInInventoryOrg}%'
  229. </if>
  230. <if test="transferOutDep != null and transferOutDep != ''">
  231. and TRANSFER_OUT_DEP LIKE '%${transferOutDep}%'
  232. </if>
  233. <if test="transferInDep != null and transferInDep != ''">
  234. and TRANSFER_IN_DEP LIKE '%${transferInDep}%'
  235. </if>
  236. <if test="businessDate != null">
  237. and TO_CHAR(BUSINESS_DATE,'yyyy-MM-dd') = #{businessDate}
  238. </if>
  239. <if test="whetherTheCar != null and whetherTheCar != ''">
  240. and WHETHER_THE_CAR LIKE '%${whetherTheCar}%'
  241. </if>
  242. <if test="businessType != null and businessType != ''">
  243. and BUSINESS_TYPE LIKE '%${businessType}%'
  244. </if>
  245. </where>
  246. </sql>
  247. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  248. delete from AMS_SALE_ORDER
  249. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  250. </delete>
  251. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  252. delete from AMS_SALE_ORDER
  253. where 1!=1
  254. <if test="planId != null">
  255. or PLAN_ID = #{planId}
  256. </if>
  257. <if test="saleNumber != null and saleNumber != ''">
  258. or SALE_NUMBER = #{saleNumber}
  259. </if>
  260. <if test="shipperId != null">
  261. or SHIPPER_ID = #{shipperId}
  262. </if>
  263. <if test="receiveId != null">
  264. or RECEIVE_ID = #{receiveId}
  265. </if>
  266. <if test="saleAccountBalance != null">
  267. or SALE_ACCOUNT_BALANCE = #{saleAccountBalance}
  268. </if>
  269. <if test="saleCurrentOrderAmount != null">
  270. or SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount}
  271. </if>
  272. <if test="saleHistoricalOrderAmount != null">
  273. or SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount}
  274. </if>
  275. <if test="saleOrderStatus != null">
  276. or SALE_ORDER_STATUS = #{saleOrderStatus}
  277. </if>
  278. <if test="saleOrderReceiveCustomer != null and saleOrderReceiveCustomer != ''">
  279. or SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer}
  280. </if>
  281. <if test="saleOrderIsselfMention != null and saleOrderIsselfMention != ''">
  282. or SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention}
  283. </if>
  284. <if test="saleUnitPrice != null">
  285. or SALE_UNIT_PRICE = #{saleUnitPrice}
  286. </if>
  287. <if test="saleOrderTax != null and saleOrderTax != ''">
  288. or SALE_ORDER_TAX = #{saleOrderTax}
  289. </if>
  290. <if test="saleRemark != null and saleRemark != ''">
  291. or SALE_REMARK = #{saleRemark}
  292. </if>
  293. <if test="insertUsername != null and insertUsername != ''">
  294. or INSERT_USERNAME = #{insertUsername}
  295. </if>
  296. <if test="insertTime != null">
  297. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  298. </if>
  299. <if test="updateUsername != null and updateUsername != ''">
  300. or UPDATE_USERNAME = #{updateUsername}
  301. </if>
  302. <if test="updateTime != null">
  303. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  304. </if>
  305. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  306. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  307. </if>
  308. <if test="deleted != null">
  309. or DELETED = #{deleted}
  310. </if>
  311. <if test="closeStatus != null">
  312. or CLOSE_STATUS = #{closeStatus}
  313. </if>
  314. <if test="salerId != null">
  315. or SALER_ID = #{salerId}
  316. </if>
  317. <if test="saleType != null">
  318. or SALE_TYPE = #{saleType}
  319. </if>
  320. <if test="transferOutInventoryOrg != null and transferOutInventoryOrg != ''">
  321. or TRANSFER_OUT_INVENTORY_ORG = #{transferOutInventoryOrg}
  322. </if>
  323. <if test="transferInInventoryOrg != null and transferInInventoryOrg != ''">
  324. or TRANSFER_IN_INVENTORY_ORG = #{transferInInventoryOrg}
  325. </if>
  326. <if test="transferOutDep != null and transferOutDep != ''">
  327. or TRANSFER_OUT_DEP = #{transferOutDep}
  328. </if>
  329. <if test="transferInDep != null and transferInDep != ''">
  330. or TRANSFER_IN_DEP = #{transferInDep}
  331. </if>
  332. <if test="businessDate != null">
  333. or TO_CHAR(BUSINESS_DATE,'yyyy-MM-dd') = '#{businessDate}'
  334. </if>
  335. <if test="whetherTheCar != null and whetherTheCar != ''">
  336. or WHETHER_THE_CAR = #{whetherTheCar}
  337. </if>
  338. <if test="businessType != null and businessType != ''">
  339. or BUSINESS_TYPE = #{businessType}
  340. </if>
  341. </delete>
  342. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  343. insert into AMS_SALE_ORDER (SALE_ORDER_ID, PLAN_ID, SALE_NUMBER,
  344. SHIPPER_ID, RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  345. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
  346. SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  347. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
  348. SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  349. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  350. INSERT_UPDATE_REMARK, DELETED, CLOSE_STATUS,
  351. SALER_ID, SALE_TYPE, TRANSFER_OUT_INVENTORY_ORG,
  352. TRANSFER_IN_INVENTORY_ORG, TRANSFER_OUT_DEP,
  353. TRANSFER_IN_DEP, BUSINESS_DATE, WHETHER_THE_CAR,
  354. BUSINESS_TYPE)
  355. values (#{saleOrderId,jdbcType=DECIMAL}, #{planId,jdbcType=DECIMAL}, #{saleNumber,jdbcType=VARCHAR},
  356. #{shipperId,jdbcType=DECIMAL}, #{receiveId,jdbcType=DECIMAL}, #{saleAccountBalance,jdbcType=DECIMAL},
  357. #{saleCurrentOrderAmount,jdbcType=DECIMAL}, #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  358. #{saleOrderStatus,jdbcType=DECIMAL}, #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  359. #{saleOrderIsselfMention,jdbcType=VARCHAR}, #{saleUnitPrice,jdbcType=DECIMAL},
  360. #{saleOrderTax,jdbcType=VARCHAR}, #{saleRemark,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
  361. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  362. #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, #{closeStatus,jdbcType=DECIMAL},
  363. #{salerId,jdbcType=DECIMAL}, #{saleType,jdbcType=DECIMAL}, #{transferOutInventoryOrg,jdbcType=VARCHAR},
  364. #{transferInInventoryOrg,jdbcType=VARCHAR}, #{transferOutDep,jdbcType=VARCHAR},
  365. #{transferInDep,jdbcType=VARCHAR}, #{businessDate,jdbcType=TIMESTAMP}, #{whetherTheCar,jdbcType=VARCHAR},
  366. #{businessType,jdbcType=VARCHAR})
  367. </insert>
  368. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  369. insert into AMS_SALE_ORDER
  370. <trim prefix="(" suffix=")" suffixOverrides=",">
  371. <if test="saleOrderId != null">
  372. SALE_ORDER_ID,
  373. </if>
  374. <if test="planId != null">
  375. PLAN_ID,
  376. </if>
  377. <if test="saleNumber != null">
  378. SALE_NUMBER,
  379. </if>
  380. <if test="shipperId != null">
  381. SHIPPER_ID,
  382. </if>
  383. <if test="receiveId != null">
  384. RECEIVE_ID,
  385. </if>
  386. <if test="saleAccountBalance != null">
  387. SALE_ACCOUNT_BALANCE,
  388. </if>
  389. <if test="saleCurrentOrderAmount != null">
  390. SALE_CURRENT_ORDER_AMOUNT,
  391. </if>
  392. <if test="saleHistoricalOrderAmount != null">
  393. SALE_HISTORICAL_ORDER_AMOUNT,
  394. </if>
  395. <if test="saleOrderStatus != null">
  396. SALE_ORDER_STATUS,
  397. </if>
  398. <if test="saleOrderReceiveCustomer != null">
  399. SALE_ORDER_RECEIVE_CUSTOMER,
  400. </if>
  401. <if test="saleOrderIsselfMention != null">
  402. SALE_ORDER_ISSELF_MENTION,
  403. </if>
  404. <if test="saleUnitPrice != null">
  405. SALE_UNIT_PRICE,
  406. </if>
  407. <if test="saleOrderTax != null">
  408. SALE_ORDER_TAX,
  409. </if>
  410. <if test="saleRemark != null">
  411. SALE_REMARK,
  412. </if>
  413. <if test="insertUsername != null">
  414. INSERT_USERNAME,
  415. </if>
  416. <if test="insertTime != null">
  417. INSERT_TIME,
  418. </if>
  419. <if test="updateUsername != null">
  420. UPDATE_USERNAME,
  421. </if>
  422. <if test="updateTime != null">
  423. UPDATE_TIME,
  424. </if>
  425. <if test="insertUpdateRemark != null">
  426. INSERT_UPDATE_REMARK,
  427. </if>
  428. <if test="deleted != null">
  429. DELETED,
  430. </if>
  431. <if test="closeStatus != null">
  432. CLOSE_STATUS,
  433. </if>
  434. <if test="salerId != null">
  435. SALER_ID,
  436. </if>
  437. <if test="saleType != null">
  438. SALE_TYPE,
  439. </if>
  440. <if test="transferOutInventoryOrg != null">
  441. TRANSFER_OUT_INVENTORY_ORG,
  442. </if>
  443. <if test="transferInInventoryOrg != null">
  444. TRANSFER_IN_INVENTORY_ORG,
  445. </if>
  446. <if test="transferOutDep != null">
  447. TRANSFER_OUT_DEP,
  448. </if>
  449. <if test="transferInDep != null">
  450. TRANSFER_IN_DEP,
  451. </if>
  452. <if test="businessDate != null">
  453. BUSINESS_DATE,
  454. </if>
  455. <if test="whetherTheCar != null">
  456. WHETHER_THE_CAR,
  457. </if>
  458. <if test="businessType != null">
  459. BUSINESS_TYPE,
  460. </if>
  461. </trim>
  462. <trim prefix="values (" suffix=")" suffixOverrides=",">
  463. <if test="saleOrderId != null">
  464. #{saleOrderId,jdbcType=DECIMAL},
  465. </if>
  466. <if test="planId != null">
  467. #{planId,jdbcType=DECIMAL},
  468. </if>
  469. <if test="saleNumber != null">
  470. #{saleNumber,jdbcType=VARCHAR},
  471. </if>
  472. <if test="shipperId != null">
  473. #{shipperId,jdbcType=DECIMAL},
  474. </if>
  475. <if test="receiveId != null">
  476. #{receiveId,jdbcType=DECIMAL},
  477. </if>
  478. <if test="saleAccountBalance != null">
  479. #{saleAccountBalance,jdbcType=DECIMAL},
  480. </if>
  481. <if test="saleCurrentOrderAmount != null">
  482. #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  483. </if>
  484. <if test="saleHistoricalOrderAmount != null">
  485. #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  486. </if>
  487. <if test="saleOrderStatus != null">
  488. #{saleOrderStatus,jdbcType=DECIMAL},
  489. </if>
  490. <if test="saleOrderReceiveCustomer != null">
  491. #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  492. </if>
  493. <if test="saleOrderIsselfMention != null">
  494. #{saleOrderIsselfMention,jdbcType=VARCHAR},
  495. </if>
  496. <if test="saleUnitPrice != null">
  497. #{saleUnitPrice,jdbcType=DECIMAL},
  498. </if>
  499. <if test="saleOrderTax != null">
  500. #{saleOrderTax,jdbcType=VARCHAR},
  501. </if>
  502. <if test="saleRemark != null">
  503. #{saleRemark,jdbcType=VARCHAR},
  504. </if>
  505. <if test="insertUsername != null">
  506. #{insertUsername,jdbcType=VARCHAR},
  507. </if>
  508. <if test="insertTime != null">
  509. #{insertTime,jdbcType=TIMESTAMP},
  510. </if>
  511. <if test="updateUsername != null">
  512. #{updateUsername,jdbcType=VARCHAR},
  513. </if>
  514. <if test="updateTime != null">
  515. #{updateTime,jdbcType=TIMESTAMP},
  516. </if>
  517. <if test="insertUpdateRemark != null">
  518. #{insertUpdateRemark,jdbcType=VARCHAR},
  519. </if>
  520. <if test="deleted != null">
  521. #{deleted,jdbcType=DECIMAL},
  522. </if>
  523. <if test="closeStatus != null">
  524. #{closeStatus,jdbcType=DECIMAL},
  525. </if>
  526. <if test="salerId != null">
  527. #{salerId,jdbcType=DECIMAL},
  528. </if>
  529. <if test="saleType != null">
  530. #{saleType,jdbcType=DECIMAL},
  531. </if>
  532. <if test="transferOutInventoryOrg != null">
  533. #{transferOutInventoryOrg,jdbcType=VARCHAR},
  534. </if>
  535. <if test="transferInInventoryOrg != null">
  536. #{transferInInventoryOrg,jdbcType=VARCHAR},
  537. </if>
  538. <if test="transferOutDep != null">
  539. #{transferOutDep,jdbcType=VARCHAR},
  540. </if>
  541. <if test="transferInDep != null">
  542. #{transferInDep,jdbcType=VARCHAR},
  543. </if>
  544. <if test="businessDate != null">
  545. #{businessDate,jdbcType=TIMESTAMP},
  546. </if>
  547. <if test="whetherTheCar != null">
  548. #{whetherTheCar,jdbcType=VARCHAR},
  549. </if>
  550. <if test="businessType != null">
  551. #{businessType,jdbcType=VARCHAR},
  552. </if>
  553. </trim>
  554. </insert>
  555. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  556. update AMS_SALE_ORDER
  557. set PLAN_ID = #{planId,jdbcType=DECIMAL},
  558. SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
  559. SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  560. RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
  561. SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
  562. SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  563. SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  564. SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
  565. SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  566. SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
  567. SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
  568. SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
  569. SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
  570. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  571. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  572. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  573. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  574. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  575. DELETED = #{deleted,jdbcType=DECIMAL},
  576. CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
  577. SALER_ID = #{salerId,jdbcType=DECIMAL},
  578. SALE_TYPE = #{saleType,jdbcType=DECIMAL},
  579. TRANSFER_OUT_INVENTORY_ORG = #{transferOutInventoryOrg,jdbcType=VARCHAR},
  580. TRANSFER_IN_INVENTORY_ORG = #{transferInInventoryOrg,jdbcType=VARCHAR},
  581. TRANSFER_OUT_DEP = #{transferOutDep,jdbcType=VARCHAR},
  582. TRANSFER_IN_DEP = #{transferInDep,jdbcType=VARCHAR},
  583. BUSINESS_DATE = #{businessDate,jdbcType=TIMESTAMP},
  584. WHETHER_THE_CAR = #{whetherTheCar,jdbcType=VARCHAR},
  585. BUSINESS_TYPE = #{businessType,jdbcType=VARCHAR}
  586. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  587. </update>
  588. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsSaleOrder">
  589. update AMS_SALE_ORDER
  590. <set>
  591. <if test="planId != null">
  592. PLAN_ID = #{planId,jdbcType=DECIMAL},
  593. </if>
  594. <if test="saleNumber != null">
  595. SALE_NUMBER = #{saleNumber,jdbcType=VARCHAR},
  596. </if>
  597. <if test="shipperId != null">
  598. SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  599. </if>
  600. <if test="receiveId != null">
  601. RECEIVE_ID = #{receiveId,jdbcType=DECIMAL},
  602. </if>
  603. <if test="saleAccountBalance != null">
  604. SALE_ACCOUNT_BALANCE = #{saleAccountBalance,jdbcType=DECIMAL},
  605. </if>
  606. <if test="saleCurrentOrderAmount != null">
  607. SALE_CURRENT_ORDER_AMOUNT = #{saleCurrentOrderAmount,jdbcType=DECIMAL},
  608. </if>
  609. <if test="saleHistoricalOrderAmount != null">
  610. SALE_HISTORICAL_ORDER_AMOUNT = #{saleHistoricalOrderAmount,jdbcType=DECIMAL},
  611. </if>
  612. <if test="saleOrderStatus != null">
  613. SALE_ORDER_STATUS = #{saleOrderStatus,jdbcType=DECIMAL},
  614. </if>
  615. <if test="saleOrderReceiveCustomer != null">
  616. SALE_ORDER_RECEIVE_CUSTOMER = #{saleOrderReceiveCustomer,jdbcType=VARCHAR},
  617. </if>
  618. <if test="saleOrderIsselfMention != null">
  619. SALE_ORDER_ISSELF_MENTION = #{saleOrderIsselfMention,jdbcType=VARCHAR},
  620. </if>
  621. <if test="saleUnitPrice != null">
  622. SALE_UNIT_PRICE = #{saleUnitPrice,jdbcType=DECIMAL},
  623. </if>
  624. <if test="saleOrderTax != null">
  625. SALE_ORDER_TAX = #{saleOrderTax,jdbcType=VARCHAR},
  626. </if>
  627. <if test="saleRemark != null">
  628. SALE_REMARK = #{saleRemark,jdbcType=VARCHAR},
  629. </if>
  630. <if test="insertUsername != null">
  631. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  632. </if>
  633. <if test="insertTime != null">
  634. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  635. </if>
  636. <if test="updateUsername != null">
  637. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  638. </if>
  639. <if test="updateTime != null">
  640. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  641. </if>
  642. <if test="insertUpdateRemark != null">
  643. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  644. </if>
  645. <if test="deleted != null">
  646. DELETED = #{deleted,jdbcType=DECIMAL},
  647. </if>
  648. <if test="closeStatus != null">
  649. CLOSE_STATUS = #{closeStatus,jdbcType=DECIMAL},
  650. </if>
  651. <if test="salerId != null">
  652. SALER_ID = #{salerId,jdbcType=DECIMAL},
  653. </if>
  654. <if test="saleType != null">
  655. SALE_TYPE = #{saleType,jdbcType=DECIMAL},
  656. </if>
  657. <if test="transferOutInventoryOrg != null">
  658. TRANSFER_OUT_INVENTORY_ORG = #{transferOutInventoryOrg,jdbcType=VARCHAR},
  659. </if>
  660. <if test="transferInInventoryOrg != null">
  661. TRANSFER_IN_INVENTORY_ORG = #{transferInInventoryOrg,jdbcType=VARCHAR},
  662. </if>
  663. <if test="transferOutDep != null">
  664. TRANSFER_OUT_DEP = #{transferOutDep,jdbcType=VARCHAR},
  665. </if>
  666. <if test="transferInDep != null">
  667. TRANSFER_IN_DEP = #{transferInDep,jdbcType=VARCHAR},
  668. </if>
  669. <if test="businessDate != null">
  670. BUSINESS_DATE = #{businessDate,jdbcType=TIMESTAMP},
  671. </if>
  672. <if test="whetherTheCar != null">
  673. WHETHER_THE_CAR = #{whetherTheCar,jdbcType=VARCHAR},
  674. </if>
  675. <if test="businessType != null">
  676. BUSINESS_TYPE = #{businessType,jdbcType=VARCHAR},
  677. </if>
  678. </set>
  679. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  680. </update>
  681. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  682. <include refid="select" />
  683. where SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL}
  684. </select>
  685. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  686. <include refid="select" />
  687. <include refid="where" />
  688. </select>
  689. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  690. <include refid="select" />
  691. <include refid="whereLike" />
  692. </select>
  693. <insert id="batchInsert" parameterType="java.util.List">
  694. insert into AMS_SALE_ORDER
  695. (SALE_ORDER_ID,
  696. PLAN_ID, SALE_NUMBER, SHIPPER_ID,
  697. RECEIVE_ID, SALE_ACCOUNT_BALANCE,
  698. SALE_CURRENT_ORDER_AMOUNT, SALE_HISTORICAL_ORDER_AMOUNT,
  699. SALE_ORDER_STATUS, SALE_ORDER_RECEIVE_CUSTOMER,
  700. SALE_ORDER_ISSELF_MENTION, SALE_UNIT_PRICE,
  701. SALE_ORDER_TAX, SALE_REMARK, INSERT_USERNAME,
  702. INSERT_TIME, UPDATE_USERNAME,
  703. UPDATE_TIME, INSERT_UPDATE_REMARK,
  704. DELETED, CLOSE_STATUS, SALER_ID,
  705. SALE_TYPE, TRANSFER_OUT_INVENTORY_ORG,
  706. TRANSFER_IN_INVENTORY_ORG, TRANSFER_OUT_DEP,
  707. TRANSFER_IN_DEP, BUSINESS_DATE,
  708. WHETHER_THE_CAR, BUSINESS_TYPE)
  709. ( <foreach collection="list" item="item" separator="union all">
  710. select
  711. #{item.saleOrderId,jdbcType=DECIMAL},
  712. #{item.planId,jdbcType=DECIMAL}, #{item.saleNumber,jdbcType=VARCHAR}, #{item.shipperId,jdbcType=DECIMAL},
  713. #{item.receiveId,jdbcType=DECIMAL}, #{item.saleAccountBalance,jdbcType=DECIMAL},
  714. #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}, #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL},
  715. #{item.saleOrderStatus,jdbcType=DECIMAL}, #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR},
  716. #{item.saleOrderIsselfMention,jdbcType=VARCHAR}, #{item.saleUnitPrice,jdbcType=DECIMAL},
  717. #{item.saleOrderTax,jdbcType=VARCHAR}, #{item.saleRemark,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  718. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  719. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  720. #{item.deleted,jdbcType=DECIMAL}, #{item.closeStatus,jdbcType=DECIMAL}, #{item.salerId,jdbcType=DECIMAL},
  721. #{item.saleType,jdbcType=DECIMAL}, #{item.transferOutInventoryOrg,jdbcType=VARCHAR},
  722. #{item.transferInInventoryOrg,jdbcType=VARCHAR}, #{item.transferOutDep,jdbcType=VARCHAR},
  723. #{item.transferInDep,jdbcType=VARCHAR}, #{item.businessDate,jdbcType=TIMESTAMP},
  724. #{item.whetherTheCar,jdbcType=VARCHAR}, #{item.businessType,jdbcType=VARCHAR} from dual
  725. </foreach> )
  726. </insert>
  727. <update id="batchUpdate" parameterType="java.util.List">
  728. update AMS_SALE_ORDER
  729. set
  730. SALE_ORDER_ID=
  731. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  732. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
  733. </foreach>
  734. ,PLAN_ID=
  735. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  736. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
  737. </foreach>
  738. ,SALE_NUMBER=
  739. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  740. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleNumber,jdbcType=VARCHAR}
  741. </foreach>
  742. ,SHIPPER_ID=
  743. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  744. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
  745. </foreach>
  746. ,RECEIVE_ID=
  747. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  748. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.receiveId,jdbcType=DECIMAL}
  749. </foreach>
  750. ,SALE_ACCOUNT_BALANCE=
  751. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  752. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleAccountBalance,jdbcType=DECIMAL}
  753. </foreach>
  754. ,SALE_CURRENT_ORDER_AMOUNT=
  755. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  756. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleCurrentOrderAmount,jdbcType=DECIMAL}
  757. </foreach>
  758. ,SALE_HISTORICAL_ORDER_AMOUNT=
  759. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  760. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleHistoricalOrderAmount,jdbcType=DECIMAL}
  761. </foreach>
  762. ,SALE_ORDER_STATUS=
  763. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  764. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderStatus,jdbcType=DECIMAL}
  765. </foreach>
  766. ,SALE_ORDER_RECEIVE_CUSTOMER=
  767. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  768. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderReceiveCustomer,jdbcType=VARCHAR}
  769. </foreach>
  770. ,SALE_ORDER_ISSELF_MENTION=
  771. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  772. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderIsselfMention,jdbcType=VARCHAR}
  773. </foreach>
  774. ,SALE_UNIT_PRICE=
  775. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  776. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleUnitPrice,jdbcType=DECIMAL}
  777. </foreach>
  778. ,SALE_ORDER_TAX=
  779. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  780. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleOrderTax,jdbcType=VARCHAR}
  781. </foreach>
  782. ,SALE_REMARK=
  783. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  784. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleRemark,jdbcType=VARCHAR}
  785. </foreach>
  786. ,INSERT_USERNAME=
  787. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  788. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  789. </foreach>
  790. ,INSERT_TIME=
  791. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  792. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  793. </foreach>
  794. ,UPDATE_USERNAME=
  795. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  796. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  797. </foreach>
  798. ,UPDATE_TIME=
  799. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  800. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  801. </foreach>
  802. ,INSERT_UPDATE_REMARK=
  803. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  804. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  805. </foreach>
  806. ,DELETED=
  807. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  808. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  809. </foreach>
  810. ,CLOSE_STATUS=
  811. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  812. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.closeStatus,jdbcType=DECIMAL}
  813. </foreach>
  814. ,SALER_ID=
  815. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  816. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.salerId,jdbcType=DECIMAL}
  817. </foreach>
  818. ,SALE_TYPE=
  819. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  820. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.saleType,jdbcType=DECIMAL}
  821. </foreach>
  822. ,TRANSFER_OUT_INVENTORY_ORG=
  823. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  824. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.transferOutInventoryOrg,jdbcType=VARCHAR}
  825. </foreach>
  826. ,TRANSFER_IN_INVENTORY_ORG=
  827. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  828. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.transferInInventoryOrg,jdbcType=VARCHAR}
  829. </foreach>
  830. ,TRANSFER_OUT_DEP=
  831. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  832. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.transferOutDep,jdbcType=VARCHAR}
  833. </foreach>
  834. ,TRANSFER_IN_DEP=
  835. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  836. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.transferInDep,jdbcType=VARCHAR}
  837. </foreach>
  838. ,BUSINESS_DATE=
  839. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  840. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.businessDate,jdbcType=TIMESTAMP}
  841. </foreach>
  842. ,WHETHER_THE_CAR=
  843. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  844. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.whetherTheCar,jdbcType=VARCHAR}
  845. </foreach>
  846. ,BUSINESS_TYPE=
  847. <foreach close="end" collection="list" index="index" item="item" open="case SALE_ORDER_ID" separator=" ">
  848. when #{item.saleOrderId,jdbcType=DECIMAL} then #{item.businessType,jdbcType=VARCHAR}
  849. </foreach>
  850. where SALE_ORDER_ID in
  851. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  852. #{item.saleOrderId,jdbcType=DECIMAL}
  853. </foreach>
  854. </update>
  855. <delete id="batchDelete" parameterType="java.util.List">
  856. delete from AMS_SALE_ORDER
  857. where SALE_ORDER_ID in
  858. <foreach close=")" collection="list" item="id" open="(" separator=",">
  859. #{id}
  860. </foreach>
  861. </delete>
  862. <!-- 友情提示!!!-->
  863. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  864. <!-- 友情提示!!!-->
  865. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  866. <sql id="orderBy">
  867. <if test="orderField != null and orderField != ''">
  868. order by "${orderField}"
  869. <if test="orderType != null and orderType != ''">
  870. ${orderType}
  871. </if>
  872. </if>
  873. <if test="orderField == null ">
  874. order by "insertTime" desc
  875. </if>
  876. </sql>
  877. <!--根据销售订单号排序-->
  878. <sql id="orderBy1">
  879. <if test="orderField != null and orderField != ''">
  880. order by "${orderField}"
  881. <if test="orderType != null and orderType != ''">
  882. ${orderType}
  883. </if>
  884. </if>
  885. <if test="orderField == null ">
  886. order by "saleNumber" desc
  887. </if>
  888. </sql>
  889. <select id="getSaleOrderInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  890. select * from(
  891. select a_s_order.SALE_ORDER_ID "saleOrderId",
  892. a_s_order.SALE_NUMBER "saleNumber",
  893. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  894. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  895. r_shipper.SHIPPER_NAME "shipperName",
  896. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  897. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  898. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  899. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  900. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  901. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  902. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  903. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  904. a_s_order.SALE_REMARK "saleRemark",
  905. a_s_order.INSERT_TIME "insertTime",
  906. from AMS_SALE_ORDER a_s_order
  907. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  908. sum(tt.sum1) saleSum1,
  909. sum(tt.sum2) saleSum2
  910. from AMS_SALE_ORDER_MATERIAL sale_material
  911. left join
  912. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  913. sum(truckno_material.material_theoretical_weight) sum1,
  914. sum(truckno_material.sale_order_material_number) sum2
  915. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  916. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  917. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  918. group by
  919. sale_material.SALE_ORDER_ID) allmaterial_info
  920. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  921. left join RMS_SHIPPER r_shipper
  922. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  923. left join RMS_CONSIGNEE r_consignee
  924. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  925. where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0)
  926. <where>
  927. <if test="saleNumber != null">
  928. and
  929. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  930. "saleNumber" like '%${item}%'
  931. </foreach>
  932. </if>
  933. <if test="materialTheoreticalWeight != null">
  934. and
  935. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  936. "materialTheoreticalWeight" like '%${item}%'
  937. </foreach>
  938. </if>
  939. <if test="saleOrderMaterialNumber != null">
  940. and
  941. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  942. "saleOrderMaterialNumber" like '%${item}%'
  943. </foreach>
  944. </if>
  945. <if test="shipperName != null">
  946. and
  947. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  948. "shipperName" like '%${item}%'
  949. </foreach>
  950. </if>
  951. <if test="consigneeCompanyName != null">
  952. and
  953. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  954. "consigneeCompanyName" like '%${item}%'
  955. </foreach>
  956. </if>
  957. <if test="saleOrderIsselfMention != null">
  958. and
  959. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  960. "saleOrderIsselfMention" like '%${item}%'
  961. </foreach>
  962. </if>
  963. <if test="saleAccountBalance != null">
  964. and
  965. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  966. "saleAccountBalance" like '%${item}%'
  967. </foreach>
  968. </if>
  969. <if test="saleCurrentOrderAmount != null">
  970. and
  971. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  972. "saleCurrentOrderAmount" like '%${item}%'
  973. </foreach>
  974. </if>
  975. <if test="saleHistoricalOrderAmout != null">
  976. and
  977. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  978. "saleHistoricalOrderAmout" like '%${item}%'
  979. </foreach>
  980. </if>
  981. <if test="saleOrderReceiveCustomer != null">
  982. and
  983. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  984. "saleOrderReceiveCustomer" like '%${item}%'
  985. </foreach>
  986. </if>
  987. <if test="saleUnitPrice != null">
  988. and
  989. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  990. "saleUnitPrice" like '%${item}%'
  991. </foreach>
  992. </if>
  993. <if test="saleOrderTax != null">
  994. and
  995. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  996. "saleOrderTax" like '%${item}%'
  997. </foreach>
  998. </if>
  999. <if test="saleRemark != null">
  1000. and
  1001. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1002. "saleRemark" like '%${item}%'
  1003. </foreach>
  1004. </if>
  1005. </where>
  1006. <include refid="orderBy"></include>
  1007. </select>
  1008. <select id="getSaleOrderReported" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1009. select * from(
  1010. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1011. a_s_order.SALE_NUMBER "saleNumber",
  1012. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  1013. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  1014. r_shipper.SHIPPER_NAME "shipperName",
  1015. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1016. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1017. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1018. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1019. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1020. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1021. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1022. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1023. a_s_order.SALE_REMARK "saleRemark",
  1024. a_s_order.INSERT_TIME "insertTime"
  1025. from AMS_SALE_ORDER a_s_order
  1026. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  1027. sum(tt.sum1) saleSum1,
  1028. sum(tt.sum2) saleSum2
  1029. from AMS_SALE_ORDER_MATERIAL sale_material
  1030. left join
  1031. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  1032. sum(truckno_material.material_theoretical_weight) sum1,
  1033. sum(truckno_material.sale_order_material_number) sum2
  1034. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  1035. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  1036. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  1037. group by
  1038. sale_material.SALE_ORDER_ID) allmaterial_info
  1039. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  1040. left join RMS_SHIPPER r_shipper
  1041. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1042. left join RMS_CONSIGNEE r_consignee
  1043. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1044. where a_s_order.SALE_ORDER_STATUS=1)
  1045. <where>
  1046. <if test="saleNumber != null">
  1047. and
  1048. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1049. "saleNumber" like '%${item}%'
  1050. </foreach>
  1051. </if>
  1052. <if test="materialTheoreticalWeight != null">
  1053. and
  1054. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1055. "materialTheoreticalWeight" like '%${item}%'
  1056. </foreach>
  1057. </if>
  1058. <if test="saleOrderMaterialNumber != null">
  1059. and
  1060. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1061. "saleOrderMaterialNumber" like '%${item}%'
  1062. </foreach>
  1063. </if>
  1064. <if test="shipperName != null">
  1065. and
  1066. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1067. "shipperName" like '%${item}%'
  1068. </foreach>
  1069. </if>
  1070. <if test="consigneeCompanyName != null">
  1071. and
  1072. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1073. "consigneeCompanyName" like '%${item}%'
  1074. </foreach>
  1075. </if>
  1076. <if test="saleOrderIsselfMention != null">
  1077. and
  1078. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1079. "saleOrderIsselfMention" like '%${item}%'
  1080. </foreach>
  1081. </if>
  1082. <if test="saleAccountBalance != null">
  1083. and
  1084. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1085. "saleAccountBalance" like '%${item}%'
  1086. </foreach>
  1087. </if>
  1088. <if test="saleCurrentOrderAmount != null">
  1089. and
  1090. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1091. "saleCurrentOrderAmount" like '%${item}%'
  1092. </foreach>
  1093. </if>
  1094. <if test="saleHistoricalOrderAmout != null">
  1095. and
  1096. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1097. "saleHistoricalOrderAmout" like '%${item}%'
  1098. </foreach>
  1099. </if>
  1100. <if test="saleOrderReceiveCustomer != null">
  1101. and
  1102. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1103. "saleOrderReceiveCustomer" like '%${item}%'
  1104. </foreach>
  1105. </if>
  1106. <if test="saleUnitPrice != null">
  1107. and
  1108. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1109. "saleUnitPrice" like '%${item}%'
  1110. </foreach>
  1111. </if>
  1112. <if test="saleOrderTax != null">
  1113. and
  1114. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1115. "saleOrderTax" like '%${item}%'
  1116. </foreach>
  1117. </if>
  1118. <if test="saleRemark != null">
  1119. and
  1120. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1121. "saleRemark" like '%${item}%'
  1122. </foreach>
  1123. </if>
  1124. </where>
  1125. <include refid="orderBy"></include>
  1126. </select>
  1127. <select id="getSaleOrderDetail" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1128. select * from(
  1129. select sale_material.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1130. sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  1131. receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
  1132. sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1133. sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1134. sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1135. sale_material.INSERT_TIME "insertTime"
  1136. from AMS_SALE_ORDER_MATERIAL sale_material
  1137. left join AMS_SALE_ORDER a_s_order
  1138. on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  1139. left join RMS_RECEIVE_ADDRESS receive_address
  1140. on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
  1141. where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0 and sale_material.UPDATED=0)
  1142. <where>
  1143. <if test="saleOrderMaterialTruckNo != null">
  1144. and
  1145. <foreach collection="saleOrderMaterialTruckNo" item="item" open="(" separator="or" close=")">
  1146. "saleOrderMaterialTruckNo" like '%${item}%'
  1147. </foreach>
  1148. </if>
  1149. <if test="materialName != null">
  1150. and
  1151. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1152. "materialName" like '%${item}%'
  1153. </foreach>
  1154. </if>
  1155. <if test="materialSpecification != null">
  1156. and
  1157. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1158. "materialSpecification" like '%${item}%'
  1159. </foreach>
  1160. </if>
  1161. <if test="saleOrderMaterialNumber != null">
  1162. and
  1163. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1164. "saleOrderMaterialNumber" like '%${item}%'
  1165. </foreach>
  1166. </if>
  1167. <if test="materialTheoreticalWeight != null">
  1168. and
  1169. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1170. "materialTheoreticalWeight" like '%${item}%'
  1171. </foreach>
  1172. </if>
  1173. <if test="saleShippingAddress != null">
  1174. and
  1175. <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
  1176. "saleShippingAddress" like '%${item}%'
  1177. </foreach>
  1178. </if>
  1179. <if test="saleDateOfReceipt != null">
  1180. and
  1181. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  1182. "saleDateOfReceipt" like '%${item}%'
  1183. </foreach>
  1184. </if>
  1185. <if test="saleOrderConsignee != null">
  1186. and
  1187. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  1188. "saleOrderConsignee" like '%${item}%'
  1189. </foreach>
  1190. </if>
  1191. <if test="saleOrderConsigneeTel != null">
  1192. and
  1193. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  1194. "saleOrderConsigneeTel" like '%${item}%'
  1195. </foreach>
  1196. </if>
  1197. </where>
  1198. <include refid="orderBy"></include>
  1199. </select>
  1200. <select id="getSaleOrderUpdateLog" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1201. select * from(
  1202. select
  1203. sale_material.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  1204. receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
  1205. sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1206. sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1207. sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1208. sale_material.INSERT_TIME "insertTime"
  1209. from AMS_SALE_ORDER_MATERIAL sale_material
  1210. left join AMS_SALE_ORDER a_s_order
  1211. on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  1212. left join RMS_RECEIVE_ADDRESS receive_address
  1213. on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
  1214. where sale_material.SALE_ORDER_ID=#{saleOrderId} and sale_material.DELETED=0)
  1215. <where>
  1216. <if test="saleShippingAddress != null">
  1217. and
  1218. <foreach collection="saleShippingAddress" item="item" open="(" separator="or" close=")">
  1219. "saleShippingAddress" like '%${item}%'
  1220. </foreach>
  1221. </if>
  1222. <if test="saleDateOfReceipt != null">
  1223. and
  1224. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  1225. "saleDateOfReceipt" like '%${item}%'
  1226. </foreach>
  1227. </if>
  1228. <if test="saleOrderConsignee != null">
  1229. and
  1230. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  1231. "saleOrderConsignee" like '%${item}%'
  1232. </foreach>
  1233. </if>
  1234. <if test="saleOrderConsigneeTel != null">
  1235. and
  1236. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  1237. "saleOrderConsigneeTel" like '%${item}%'
  1238. </foreach>
  1239. </if>
  1240. </where>
  1241. <include refid="orderBy"></include>
  1242. </select>
  1243. <!--销售计划-->
  1244. <select id="getSalePlanName" resultType="java.util.LinkedHashMap">
  1245. select
  1246. a_s_plan.PLAN_ID "id",
  1247. a_s_plan.PLAN_ID "value",
  1248. a_s_plan.PLAN_NAME "label"
  1249. from AMS_SALE_PLAN a_s_plan
  1250. </select>
  1251. <!-- 收货客户-->
  1252. <select id="getShipperName" resultType="java.util.LinkedHashMap">
  1253. select
  1254. SHIPPER_ID "id",
  1255. SHIPPER_ID "value",
  1256. SHIPPER_NAME "label"
  1257. from RMS_SHIPPER
  1258. </select>
  1259. <!-- 收货客户-->
  1260. <select id="getConsigneeCompanyName" resultType="java.util.LinkedHashMap">
  1261. select
  1262. CONSIGNEE_ID "id",
  1263. CONSIGNEE_ID "value",
  1264. CONSIGNEE_COMPANY_NAME "label"
  1265. from RMS_CONSIGNEE
  1266. where rownum &lt; 20
  1267. </select>
  1268. <!-- <select id="selectMaxId" resultType="java.math.BigDecimal">-->
  1269. <!-- select max(SALE_ORDER_ID) from AMS_SALE_ORDER-->
  1270. <!-- </select>-->
  1271. <select id="selectBySaleOrderId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  1272. select
  1273. a_s_order.PLAN_ID "planId",
  1274. a_s_order.SHIPPER_ID "shipperId",
  1275. a_s_order.RECEIVE_ID "consigneeId",
  1276. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1277. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1278. a_s_order.SALE_REMARK "saleRemark"
  1279. from AMS_SALE_ORDER a_s_order
  1280. where a_s_order.SALE_ORDER_ID = #{saleOrderId}
  1281. </select>
  1282. <update id="deleteBySaleOrderId" parameterType="java.math.BigDecimal">
  1283. update AMS_SALE_ORDER_MATERIAL set DELETED = 1 where SALE_ORDER_ID = #{saleOrderId}
  1284. </update>
  1285. <select id="getAmsSaleOrderApproved" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1286. select * from(
  1287. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1288. a_s_order.SALE_NUMBER "saleNumber",
  1289. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  1290. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  1291. r_shipper.SHIPPER_NAME "shipperName",
  1292. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1293. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1294. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1295. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1296. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1297. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1298. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1299. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1300. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1301. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1302. a_s_order.SALE_REMARK "saleRemark",
  1303. a_s_order.INSERT_TIME "insertTime"
  1304. from AMS_SALE_ORDER a_s_order
  1305. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  1306. sum(tt.sum1) saleSum1,
  1307. sum(tt.sum2) saleSum2
  1308. from AMS_SALE_ORDER_MATERIAL sale_material
  1309. left join
  1310. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  1311. sum(truckno_material.material_theoretical_weight) sum1,
  1312. sum(truckno_material.sale_order_material_number) sum2
  1313. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  1314. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  1315. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  1316. group by
  1317. sale_material.SALE_ORDER_ID) allmaterial_info
  1318. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  1319. left join RMS_SHIPPER r_shipper
  1320. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1321. left join RMS_CONSIGNEE r_consignee
  1322. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1323. where a_s_order.SALE_ORDER_STATUS=4)
  1324. <where>
  1325. <if test="saleNumber != null">
  1326. and
  1327. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1328. "saleNumber" like '%${item}%'
  1329. </foreach>
  1330. </if>
  1331. <if test="materialTheoreticalWeight != null">
  1332. and
  1333. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1334. "materialTheoreticalWeight" like '%${item}%'
  1335. </foreach>
  1336. </if>
  1337. <if test="saleOrderMaterialNumber != null">
  1338. and
  1339. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1340. "saleOrderMaterialNumber" like '%${item}%'
  1341. </foreach>
  1342. </if>
  1343. <if test="shipperName != null">
  1344. and
  1345. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1346. "shipperName" like '%${item}%'
  1347. </foreach>
  1348. </if>
  1349. <if test="consigneeCompanyName != null">
  1350. and
  1351. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1352. "consigneeCompanyName" like '%${item}%'
  1353. </foreach>
  1354. </if>
  1355. <if test="consigneeWarrantyAmount != null">
  1356. and
  1357. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1358. "consigneeWarrantyAmount" like '%${item}%'
  1359. </foreach>
  1360. </if>
  1361. <if test="consigneeWarrantyWeight != null">
  1362. and
  1363. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1364. "consigneeWarrantyWeight" like '%${item}%'
  1365. </foreach>
  1366. </if>
  1367. <if test="saleOrderIsselfMention != null">
  1368. and
  1369. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1370. "saleOrderIsselfMention" like '%${item}%'
  1371. </foreach>
  1372. </if>
  1373. <if test="saleAccountBalance != null">
  1374. and
  1375. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1376. "saleAccountBalance" like '%${item}%'
  1377. </foreach>
  1378. </if>
  1379. <if test="saleCurrentOrderAmount != null">
  1380. and
  1381. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1382. "saleCurrentOrderAmount" like '%${item}%'
  1383. </foreach>
  1384. </if>
  1385. <if test="saleHistoricalOrderAmout != null">
  1386. and
  1387. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1388. "saleHistoricalOrderAmout" like '%${item}%'
  1389. </foreach>
  1390. </if>
  1391. <if test="saleOrderReceiveCustomer != null">
  1392. and
  1393. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1394. "saleOrderReceiveCustomer" like '%${item}%'
  1395. </foreach>
  1396. </if>
  1397. <if test="saleUnitPrice != null">
  1398. and
  1399. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1400. "saleUnitPrice" like '%${item}%'
  1401. </foreach>
  1402. </if>
  1403. <if test="saleOrderTax != null">
  1404. and
  1405. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1406. "saleOrderTax" like '%${item}%'
  1407. </foreach>
  1408. </if>
  1409. <if test="saleRemark != null">
  1410. and
  1411. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1412. "saleRemark" like '%${item}%'
  1413. </foreach>
  1414. </if>
  1415. </where>
  1416. <include refid="orderBy"></include>
  1417. </select>
  1418. <!-- 展示所有销售公司已审核的销售订单 -->
  1419. <select id="getSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1420. select ADSO.DISPATCH_ID "dispatchId",
  1421. ASOM.SALE_ORDER_ID "saleOrderId",
  1422. ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1423. ASO.SALE_NUMBER "saleNumber",
  1424. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "saleOrderMaterialTruckNo",
  1425. CONCAT(CONCAT(CONCAT(ADDRESS_PROVINCE, ADDRESS_DISTRICT), ADDRESS_TOWN),
  1426. RRP.ADDRESS_DELIVERY_ADDRESS) "addressDeliveryAddress",
  1427. TO_CHAR(ASOM.SALE_DATE_OF_RECEIPT, 'yyyy-mm-dd') "saleDateOfReceipt",
  1428. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1429. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  1430. RS.SHIPPER_NAME "shipperName",
  1431. RC.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1432. ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1433. ADSO.DISPATCH_TIME "dispatchTime",
  1434. ADSO.INSERT_TIME AS "insertTime"
  1435. FROM AMS_SALE_ORDER ASO
  1436. JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1437. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  1438. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  1439. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1440. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1441. ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRP.PLACE_ID
  1442. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1443. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1444. LEFT JOIN RMS_SHIPPER RS
  1445. ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  1446. LEFT JOIN RMS_CONSIGNEE RC
  1447. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  1448. WHERE ASO.SALE_ORDER_STATUS IN (2, 4)
  1449. AND ADSO.DISPATCH_STATUS = #{status}
  1450. AND ADSO.DISPATCH_TYPE = 0
  1451. order by ADSO.INSERT_TIME DESC
  1452. </select>
  1453. <select id="selectCarrierIdByprovince" resultType="java.math.BigDecimal" parameterType="java.util.Map">
  1454. SELECT RC.CARRIER_ID "carrierId"
  1455. FROM RMS_BID_AREA RBA
  1456. LEFT JOIN RMS_CARRIER RC
  1457. ON RBA.BID_AREA_ID=RC.CARRIER_BID_AREA_ID
  1458. WHERE RBA.BID_AREA_PROVINCE=#{province} AND RBA.BID_AREA_CITY=#{ditrict} AND RBA.BID_AREA_COUNTY=#{addressTown}
  1459. </select>
  1460. <select id="selectProvince" resultType="java.util.Map" parameterType="java.lang.Integer">
  1461. SELECT RRA.ADDRESS_PROVINCE "province",
  1462. RRA.ADDRESS_DISTRICT "ditrict",
  1463. RRA.ADDRESS_TOWN "addressTown"
  1464. FROM RMS_RECEIVE_ADDRESS RRA
  1465. WHERE RRA.ADDRESS_ID=#{addressId}
  1466. </select>
  1467. <!-- 销售公司查询已审核的销售订单 -->
  1468. <select id="getSaleOrderListBySaleCompany" parameterType="java.util.Map" resultType="java.util.Map">
  1469. select * from(
  1470. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1471. a_s_order.SALE_NUMBER "saleNumber",
  1472. allmaterial_info.saleSum1 "materialTheoreticalWeight",
  1473. allmaterial_info.saleSum2 "saleOrderMaterialNumber",
  1474. r_shipper.SHIPPER_NAME "shipperName",
  1475. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1476. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1477. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1478. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1479. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1480. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1481. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1482. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1483. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1484. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1485. a_s_order.SALE_REMARK "saleRemark",
  1486. a_s_order.INSERT_TIME "insertTime"
  1487. from AMS_SALE_ORDER a_s_order
  1488. left join (select sale_material.SALE_ORDER_ID saleOrderId,
  1489. sum(tt.sum1) saleSum1,
  1490. sum(tt.sum2) saleSum2
  1491. from AMS_SALE_ORDER_MATERIAL sale_material
  1492. left join
  1493. (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
  1494. sum(truckno_material.material_theoretical_weight) sum1,
  1495. sum(truckno_material.sale_order_material_number) sum2
  1496. from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
  1497. truckno_material.SALE_ORDER_MATERIAL_ID) tt
  1498. on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
  1499. group by
  1500. sale_material.SALE_ORDER_ID) allmaterial_info
  1501. on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
  1502. left join RMS_SHIPPER r_shipper
  1503. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1504. left join RMS_CONSIGNEE r_consignee
  1505. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1506. where a_s_order.SALE_ORDER_STATUS=2)
  1507. <where>
  1508. <if test="saleNumber != null">
  1509. and
  1510. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1511. "saleNumber" like '%${item}%'
  1512. </foreach>
  1513. </if>
  1514. <if test="materialTheoreticalWeight != null">
  1515. and
  1516. <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
  1517. "materialTheoreticalWeight" like '%${item}%'
  1518. </foreach>
  1519. </if>
  1520. <if test="saleOrderMaterialNumber != null">
  1521. and
  1522. <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
  1523. "saleOrderMaterialNumber" like '%${item}%'
  1524. </foreach>
  1525. </if>
  1526. <if test="shipperName != null">
  1527. and
  1528. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1529. "shipperName" like '%${item}%'
  1530. </foreach>
  1531. </if>
  1532. <if test="consigneeCompanyName != null">
  1533. and
  1534. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1535. "consigneeCompanyName" like '%${item}%'
  1536. </foreach>
  1537. </if>
  1538. <if test="consigneeWarrantyAmount != null">
  1539. and
  1540. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1541. "consigneeWarrantyAmount" like '%${item}%'
  1542. </foreach>
  1543. </if>
  1544. <if test="consigneeWarrantyWeight != null">
  1545. and
  1546. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1547. "consigneeWarrantyWeight" like '%${item}%'
  1548. </foreach>
  1549. </if>
  1550. <if test="saleOrderIsselfMention != null">
  1551. and
  1552. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1553. "saleOrderIsselfMention" like '%${item}%'
  1554. </foreach>
  1555. </if>
  1556. <if test="saleAccountBalance != null">
  1557. and
  1558. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1559. "saleAccountBalance" like '%${item}%'
  1560. </foreach>
  1561. </if>
  1562. <if test="saleCurrentOrderAmount != null">
  1563. and
  1564. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1565. "saleCurrentOrderAmount" like '%${item}%'
  1566. </foreach>
  1567. </if>
  1568. <if test="saleHistoricalOrderAmout != null">
  1569. and
  1570. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1571. "saleHistoricalOrderAmout" like '%${item}%'
  1572. </foreach>
  1573. </if>
  1574. <if test="saleOrderReceiveCustomer != null">
  1575. and
  1576. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1577. "saleOrderReceiveCustomer" like '%${item}%'
  1578. </foreach>
  1579. </if>
  1580. <if test="saleUnitPrice != null">
  1581. and
  1582. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1583. "saleUnitPrice" like '%${item}%'
  1584. </foreach>
  1585. </if>
  1586. <if test="saleOrderTax != null">
  1587. and
  1588. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1589. "saleOrderTax" like '%${item}%'
  1590. </foreach>
  1591. </if>
  1592. <if test="saleRemark != null">
  1593. and
  1594. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1595. "saleRemark" like '%${item}%'
  1596. </foreach>
  1597. </if>
  1598. </where>
  1599. <include refid="orderBy"></include>
  1600. </select>
  1601. <!-- 通过收货地址,匹配对应的承运商-->
  1602. <select id="getCarrier" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  1603. select rc.carrier_id from rms_receive_address rra LEFT join rms_carrier rc on rra.ADDRESS_ID = rc.CARRIER_BID_AREA_ID
  1604. WHERE rra.address_id = #{param}
  1605. </select>
  1606. <select id="selectInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  1607. select distinct ASO.SHIPPER_ID "shipperId",
  1608. ASO.RECEIVE_ID "reciveId",
  1609. ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1610. ASO.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReciveCustomer",
  1611. ASO.SALE_REMARK "saleRemark"
  1612. from AMS_SALE_ORDER ASO
  1613. left join AMS_SALE_ORDER_MATERIAL ASOM
  1614. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1615. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1616. on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
  1617. left join RMS_MATERIAL RM
  1618. on RM.MATERIAL_ID=ASTM.MATERIAL_ID
  1619. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1620. </select>
  1621. <!-- 根据销售订单id查找物资信息 -->
  1622. <select id="selectMaterialInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.util.LinkedHashMap">
  1623. select distinct ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "cxh",
  1624. ASTM.SALE_ORDER_MATERIAL_NUMBER "orderPlanWeight",
  1625. RM.MATERIAL_CODE "materialCode",
  1626. RM.MATERIAL_NAME "materialName",
  1627. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",
  1628. RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
  1629. RM.MATERIAL_ID "materialId",
  1630. ASTM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1631. ASTM.TRUCKNO_MATERIAL_ID "trucknoMaterialId",
  1632. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  1633. ASOM.SALE_SHIPPING_ADDRESS_ID "saleShipperAddressId",
  1634. CONCAT( CONCAT( CONCAT( RRA.ADDRESS_PROVINCE, RRA.ADDRESS_DISTRICT ), RRA.ADDRESS_TOWN ), RRA.ADDRESS_DELIVERY_ADDRESS ) "saleShipperAddressName",
  1635. ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
  1636. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
  1637. from AMS_SALE_ORDER ASO
  1638. left join AMS_SALE_ORDER_MATERIAL ASOM
  1639. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1640. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1641. on ASTM.SALE_ORDER_MATERIAL_ID=ASOM.SALE_ORDER_MATERIAL_ID
  1642. left join RMS_MATERIAL RM
  1643. on RM.MATERIAL_ID=ASTM.MATERIAL_ID
  1644. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1645. ON ASOM.SALE_SHIPPING_ADDRESS_ID=RRA.ADDRESS_ID
  1646. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1647. </select>
  1648. <select id="selectSaleOrderMaterialIdBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  1649. select ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
  1650. ASTM.TRUCKNO_MATERIAL_ID "TruckNoMaterialId"
  1651. from AMS_SALE_ORDER ASO
  1652. left join AMS_SALE_ORDER_MATERIAL ASOM
  1653. on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  1654. left join AMS_SALE_TRUCKNO_MATERIAL ASTM
  1655. on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
  1656. where ASO.SALE_ORDER_ID=#{saleOrderId}
  1657. </select>
  1658. <select id="getSaleOrderInfoes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1659. select * from(
  1660. SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
  1661. a_s_order.SALE_NUMBER "saleNumber",
  1662. r_shipper.SHIPPER_NAME "shipperName",
  1663. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1664. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1665. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1666. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1667. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1668. a_s_order.SALE_REMARK "saleRemark",
  1669. a_s_order.INSERT_TIME "insertTime",
  1670. RM.MATERIAL_NAME "materialName",
  1671. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1672. RM.MATERIAL_MODEL "materialModel",
  1673. ASM.MATERIAL_NUMBER "materialNumber",
  1674. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1675. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1676. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  1677. RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
  1678. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  1679. decode(ASM.IS_POUND_SALE, 0, '是' , '否') "isPoundSale",
  1680. ASOM.TRUCK_REMARK "trucRemark",
  1681. ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel"
  1682. FROM AMS_SALE_ORDER a_s_order
  1683. LEFT JOIN RMS_SHIPPER r_shipper
  1684. ON a_s_order.SHIPPER_ID = r_shipper.SHIPPER_ID
  1685. LEFT JOIN RMS_CONSIGNEE r_consignee
  1686. ON a_s_order.RECEIVE_ID = r_consignee.CONSIGNEE_ID
  1687. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  1688. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1689. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1690. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1691. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1692. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  1693. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1694. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1695. LEFT JOIN AMS_SALE_MATERIAL ASM
  1696. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1697. LEFT JOIN RMS_MATERIAL RM
  1698. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1699. LEFT JOIN RMS_SALER R_SALER
  1700. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1701. WHERE a_s_order.SALE_ORDER_STATUS = 0
  1702. AND a_s_order.DELETED = 0
  1703. AND ASM.DELETED IS NULL
  1704. <if test="con != null">
  1705. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1706. </if>
  1707. <if test="consigneeSsoId != null" >
  1708. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1709. </if>
  1710. <if test="saler != null " >
  1711. and R_SALER.INSERT_UPDATE_REMARK like #{saler}
  1712. </if>
  1713. <if test="consigneeName != null">
  1714. and r_consignee.CONSIGNEE_COMPANY_NAME = #{consigneeName}
  1715. </if>
  1716. <if test="oneDate != null">
  1717. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1718. </if>
  1719. <if test="startDate != null">
  1720. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1721. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1722. </if>
  1723. ORDER BY a_s_order.SALE_ORDER_ID DESC
  1724. )
  1725. <where>
  1726. <if test="saleNumber != null">
  1727. and
  1728. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1729. "saleNumber" like '%${item}%'
  1730. </foreach>
  1731. </if>
  1732. <if test="materialName != null">
  1733. and
  1734. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1735. "materialName" like '%${item}%'
  1736. </foreach>
  1737. </if>
  1738. <if test="specificationModel != null">
  1739. and
  1740. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  1741. "specificationModel" like '%${item}%'
  1742. </foreach>
  1743. </if>
  1744. <if test="materialModel != null">
  1745. and
  1746. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1747. "materialModel" like '%${item}%'
  1748. </foreach>
  1749. </if>
  1750. <if test="shipperName != null">
  1751. and
  1752. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1753. "shipperName" like '%${item}%'
  1754. </foreach>
  1755. </if>
  1756. <if test="consigneeCompanyName != null">
  1757. and
  1758. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1759. "consigneeCompanyName" like '%${item}%'
  1760. </foreach>
  1761. </if>
  1762. <if test="saleOrderIsselfMention != null">
  1763. and
  1764. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1765. "saleOrderIsselfMention" like '%${item}%'
  1766. </foreach>
  1767. </if>
  1768. <if test="saleOrderReceiveCustomer != null">
  1769. and
  1770. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1771. "saleOrderReceiveCustomer" like '%${item}%'
  1772. </foreach>
  1773. </if>
  1774. <if test="saleRemark != null">
  1775. and
  1776. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1777. "saleRemark" like '%${item}%'
  1778. </foreach>
  1779. </if>
  1780. </where>
  1781. <include refid="orderBy1">
  1782. </include>
  1783. </select>
  1784. <select id="getSaleOrderReportedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1785. select * from(
  1786. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1787. a_s_order.SALE_NUMBER "saleNumber",
  1788. r_shipper.SHIPPER_NAME "shipperName",
  1789. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1790. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1791. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1792. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1793. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1794. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1795. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1796. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1797. a_s_order.SALE_REMARK "saleRemark",
  1798. a_s_order.INSERT_TIME "insertTime",
  1799. RM.MATERIAL_NAME "materialName",
  1800. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1801. RM.MATERIAL_MODEL "materialModel",
  1802. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1803. ASM.MATERIAL_NUMBER "materialNumber",
  1804. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1805. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace"
  1806. from AMS_SALE_ORDER a_s_order
  1807. left join RMS_SHIPPER r_shipper
  1808. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1809. left join RMS_CONSIGNEE r_consignee
  1810. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1811. left join AMS_SALE_ORDER_MATERIAL ASOM
  1812. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1813. left join RMS_RECEIVE_PLACE RRP
  1814. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1815. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1816. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1817. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1818. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1819. LEFT JOIN AMS_SALE_MATERIAL ASM
  1820. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1821. LEFT JOIN RMS_MATERIAL RM
  1822. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1823. LEFT JOIN RMS_SALER R_SALER
  1824. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1825. where a_s_order.SALE_ORDER_STATUS=1
  1826. and a_s_order.DELETED = 0
  1827. AND ASM.DELETED IS NULL
  1828. <if test="con != null">
  1829. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1830. </if>
  1831. <if test="oneDate != null">
  1832. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1833. </if>
  1834. <if test="startDate != null">
  1835. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1836. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1837. </if>
  1838. <if test="consigneeSsoId != null">
  1839. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1840. </if>
  1841. <if test="saler != null" >
  1842. and R_SALER.INSERT_UPDATE_REMARK like #{saler}
  1843. </if>
  1844. )
  1845. <where>
  1846. <if test="saleNumber != null">
  1847. and
  1848. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1849. "saleNumber" like '%${item}%'
  1850. </foreach>
  1851. </if>
  1852. <if test="materialName != null">
  1853. and
  1854. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1855. "materialName" like '%${item}%'
  1856. </foreach>
  1857. </if>
  1858. <if test="materialModel != null">
  1859. and
  1860. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1861. "materialModel" like '%${item}%'
  1862. </foreach>
  1863. </if>
  1864. <if test="materialSpecification != null">
  1865. and
  1866. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1867. "materialSpecification" like '%${item}%'
  1868. </foreach>
  1869. </if>
  1870. <if test="shipperName != null">
  1871. and
  1872. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1873. "shipperName" like '%${item}%'
  1874. </foreach>
  1875. </if>
  1876. <if test="consigneeCompanyName != null">
  1877. and
  1878. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1879. "consigneeCompanyName" like '%${item}%'
  1880. </foreach>
  1881. </if>
  1882. <if test="saleOrderIsselfMention != null">
  1883. and
  1884. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1885. "saleOrderIsselfMention" like '%${item}%'
  1886. </foreach>
  1887. </if>
  1888. <if test="saleAccountBalance != null">
  1889. and
  1890. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1891. "saleAccountBalance" like '%${item}%'
  1892. </foreach>
  1893. </if>
  1894. <if test="saleCurrentOrderAmount != null">
  1895. and
  1896. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1897. "saleCurrentOrderAmount" like '%${item}%'
  1898. </foreach>
  1899. </if>
  1900. <if test="saleHistoricalOrderAmout != null">
  1901. and
  1902. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1903. "saleHistoricalOrderAmout" like '%${item}%'
  1904. </foreach>
  1905. </if>
  1906. <if test="saleOrderReceiveCustomer != null">
  1907. and
  1908. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1909. "saleOrderReceiveCustomer" like '%${item}%'
  1910. </foreach>
  1911. </if>
  1912. <if test="saleRemark != null">
  1913. and
  1914. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1915. "saleRemark" like '%${item}%'
  1916. </foreach>
  1917. </if>
  1918. </where>
  1919. <include refid="orderBy1"></include>
  1920. </select>
  1921. <!-- 销售公司查询已审核的焦炭销售订单 -->
  1922. <select id="getCokeSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1923. select * from(
  1924. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1925. a_s_order.SALE_NUMBER "saleNumber",
  1926. r_shipper.SHIPPER_NAME "shipperName",
  1927. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1928. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1929. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1930. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1931. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1932. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1933. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1934. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1935. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1936. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1937. a_s_order.SALE_REMARK "saleRemark",
  1938. a_s_order.INSERT_TIME "insertTime",
  1939. a_s_order.SALE_TYPE ,
  1940. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  1941. RM.MATERIAL_NAME "materialName",
  1942. a_s_order.CLOSE_STATUS "closeStatus"
  1943. from AMS_SALE_ORDER a_s_order
  1944. left join RMS_SHIPPER r_shipper
  1945. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1946. left join RMS_CONSIGNEE r_consignee
  1947. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1948. left join AMS_SALE_MATERIAL ASM
  1949. on ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1950. left join RMS_MATERIAL RM
  1951. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  1952. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1953. and a_s_order.CLOSE_STATUS is not null
  1954. and a_s_order.DELETED = 0
  1955. and a_s_order.SALE_TYPE is null
  1956. ) SSSR
  1957. <if test="con != null" >
  1958. where SSSR."consigneeCompanyName" LIKE #{con}
  1959. </if>
  1960. <if test="con != null" >
  1961. or SSSR."saleNumber" LIKE #{con}
  1962. </if>
  1963. <where>
  1964. <if test="saleNumber != null">
  1965. and
  1966. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1967. "saleNumber" like '%${item}%'
  1968. </foreach>
  1969. </if>
  1970. <if test="materialName != null">
  1971. and
  1972. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1973. "materialName" like '%${item}%'
  1974. </foreach>
  1975. </if>
  1976. <if test="statusStr != null">
  1977. and
  1978. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1979. "statusStr" like '%${item}%'
  1980. </foreach>
  1981. </if>
  1982. <if test="shipperName != null">
  1983. and
  1984. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1985. "shipperName" like '%${item}%'
  1986. </foreach>
  1987. </if>
  1988. <if test="consigneeCompanyName != null">
  1989. and
  1990. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1991. "consigneeCompanyName" like '%${item}%'
  1992. </foreach>
  1993. </if>
  1994. <if test="consigneeWarrantyAmount != null">
  1995. and
  1996. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1997. "consigneeWarrantyAmount" like '%${item}%'
  1998. </foreach>
  1999. </if>
  2000. <if test="consigneeWarrantyWeight != null">
  2001. and
  2002. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2003. "consigneeWarrantyWeight" like '%${item}%'
  2004. </foreach>
  2005. </if>
  2006. <if test="saleOrderIsselfMention != null">
  2007. and
  2008. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2009. "saleOrderIsselfMention" like '%${item}%'
  2010. </foreach>
  2011. </if>
  2012. <if test="saleAccountBalance != null">
  2013. and
  2014. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2015. "saleAccountBalance" like '%${item}%'
  2016. </foreach>
  2017. </if>
  2018. <if test="saleCurrentOrderAmount != null">
  2019. and
  2020. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2021. "saleCurrentOrderAmount" like '%${item}%'
  2022. </foreach>
  2023. </if>
  2024. <if test="saleHistoricalOrderAmout != null">
  2025. and
  2026. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2027. "saleHistoricalOrderAmout" like '%${item}%'
  2028. </foreach>
  2029. </if>
  2030. <if test="saleOrderReceiveCustomer != null">
  2031. and
  2032. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2033. "saleOrderReceiveCustomer" like '%${item}%'
  2034. </foreach>
  2035. </if>
  2036. <if test="saleUnitPrice != null">
  2037. and
  2038. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2039. "saleUnitPrice" like '%${item}%'
  2040. </foreach>
  2041. </if>
  2042. <if test="saleOrderTax != null">
  2043. and
  2044. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2045. "saleOrderTax" like '%${item}%'
  2046. </foreach>
  2047. </if>
  2048. <if test="saleRemark != null">
  2049. and
  2050. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2051. "saleRemark" like '%${item}%'
  2052. </foreach>
  2053. </if>
  2054. </where>
  2055. <include refid="orderBy"></include>
  2056. </select>
  2057. <select id="getSaleOrderListBySaleCompanyes" parameterType="java.util.Map" resultType="java.util.Map">
  2058. select * from(
  2059. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2060. a_s_order.SALE_NUMBER "saleNumber",
  2061. r_shipper.SHIPPER_NAME "shipperName",
  2062. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2063. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2064. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2065. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2066. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2067. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2068. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2069. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2070. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2071. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2072. a_s_order.SALE_REMARK "saleRemark",
  2073. a_s_order.INSERT_TIME "insertTime",
  2074. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2075. RM.MATERIAL_NAME "materialName",
  2076. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2077. RM.MATERIAL_MODEL "materialModel",
  2078. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  2079. ASM.MATERIAL_NUMBER "materialNumber",
  2080. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  2081. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
  2082. ASM.SALE_WAREHOUSE "saleWareHouse",
  2083. a_s_order.DELETED "deleted",
  2084. a_s_order.SHIPPER_ID "shipperId",
  2085. a_s_order.RECEIVE_ID "receiveId",
  2086. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention",
  2087. a_s_order.SALER_ID "salerId"
  2088. from AMS_SALE_ORDER a_s_order
  2089. left join RMS_SHIPPER r_shipper
  2090. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2091. left join RMS_CONSIGNEE r_consignee
  2092. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2093. left join AMS_SALE_ORDER_MATERIAL ASOM
  2094. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2095. left join RMS_RECEIVE_PLACE RRP
  2096. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2097. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2098. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  2099. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2100. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2101. LEFT JOIN AMS_SALE_MATERIAL ASM
  2102. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2103. LEFT JOIN RMS_MATERIAL RM
  2104. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2105. LEFT JOIN RMS_SALER R_SALER
  2106. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  2107. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2108. and a_s_order.CLOSE_STATUS is null
  2109. and ASM.DELETED IS NULL
  2110. and ASM.SALE_MATERIAL_ID IS NOT NULL
  2111. <if test="con != null">
  2112. and r_consignee.CONSIGNEE_COMPANY_NAME||a_s_order.SALE_NUMBER||rm.material_name||RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL like #{con}
  2113. </if>
  2114. <if test="oneDate != null">
  2115. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  2116. </if>
  2117. <if test="startDate != null">
  2118. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  2119. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  2120. </if>
  2121. <if test="shipperId != null">
  2122. and a_s_order.SHIPPER_ID = #{shipperId}
  2123. </if>
  2124. <if test="saleType != null">
  2125. and a_s_order.SALE_TYPE = #{saleType}
  2126. </if>
  2127. <if test="saleType == null">
  2128. and a_s_order.SALE_TYPE is null
  2129. </if>
  2130. <if test="saler != null" >
  2131. and R_SALER.INSERT_UPDATE_REMARK like #{saler}
  2132. </if>
  2133. <if test="consigneeSsoId != null">
  2134. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  2135. </if>
  2136. ORDER BY a_s_order.UPDATE_TIME DESC
  2137. )
  2138. <where>
  2139. <if test="saleNumber != null">
  2140. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2141. "saleNumber" like '%${item}%'
  2142. </foreach>
  2143. </if>
  2144. <if test="materialName != null">
  2145. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2146. "materialName" like '%${item}%'
  2147. </foreach>
  2148. </if>
  2149. <if test="materialSpecification != null">
  2150. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2151. "materialSpecification" like '%${item}%'
  2152. </foreach>
  2153. </if>
  2154. <if test="materialModel != null">
  2155. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2156. "materialModel" like '%${item}%'
  2157. </foreach>
  2158. </if>
  2159. <if test="statusStr != null">
  2160. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  2161. and "statusStr" like '%${item}%'
  2162. </foreach>
  2163. </if>
  2164. <!-- <if test="startTime != null">-->
  2165. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  2166. <!-- </if>-->
  2167. <!-- <if test="endTime != null">-->
  2168. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  2169. <!-- </if>-->
  2170. <if test="shipperName != null">
  2171. and
  2172. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2173. "shipperName" like '%${item}%'
  2174. </foreach>
  2175. </if>
  2176. <if test="consigneeCompanyName != null">
  2177. and
  2178. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2179. "consigneeCompanyName" like '%${item}%'
  2180. </foreach>
  2181. </if>
  2182. <if test="consigneeWarrantyAmount != null">
  2183. and
  2184. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2185. "consigneeWarrantyAmount" like '%${item}%'
  2186. </foreach>
  2187. </if>
  2188. <if test="consigneeWarrantyWeight != null">
  2189. and
  2190. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2191. "consigneeWarrantyWeight" like '%${item}%'
  2192. </foreach>
  2193. </if>
  2194. <if test="saleOrderIsselfMention != null">
  2195. and
  2196. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2197. "saleOrderIsselfMention" like '%${item}%'
  2198. </foreach>
  2199. </if>
  2200. <if test="saleAccountBalance != null">
  2201. and
  2202. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2203. "saleAccountBalance" like '%${item}%'
  2204. </foreach>
  2205. </if>
  2206. <if test="saleCurrentOrderAmount != null">
  2207. and
  2208. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2209. "saleCurrentOrderAmount" like '%${item}%'
  2210. </foreach>
  2211. </if>
  2212. <if test="saleHistoricalOrderAmout != null">
  2213. and
  2214. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2215. "saleHistoricalOrderAmout" like '%${item}%'
  2216. </foreach>
  2217. </if>
  2218. <if test="saleOrderReceiveCustomer != null">
  2219. and
  2220. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2221. "saleOrderReceiveCustomer" like '%${item}%'
  2222. </foreach>
  2223. </if>
  2224. <if test="saleUnitPrice != null">
  2225. and
  2226. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2227. "saleUnitPrice" like '%${item}%'
  2228. </foreach>
  2229. </if>
  2230. <if test="saleOrderTax != null">
  2231. and
  2232. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2233. "saleOrderTax" like '%${item}%'
  2234. </foreach>
  2235. </if>
  2236. <if test="saleRemark != null">
  2237. and
  2238. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2239. "saleRemark" like '%${item}%'
  2240. </foreach>
  2241. </if>
  2242. </where>
  2243. </select>
  2244. <select id="getAmsSaleOrderApprovedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  2245. select * from(
  2246. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2247. a_s_order.SALE_NUMBER "saleNumber",
  2248. r_shipper.SHIPPER_NAME "shipperName",
  2249. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2250. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2251. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2252. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2253. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2254. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2255. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2256. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2257. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2258. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2259. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2260. a_s_order.SALE_REMARK "saleRemark",
  2261. a_s_order.INSERT_TIME "insertTime"
  2262. from AMS_SALE_ORDER a_s_order
  2263. left join RMS_SHIPPER r_shipper
  2264. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2265. left join RMS_CONSIGNEE r_consignee
  2266. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2267. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2268. AND a_s_order.SHIPPER_ID = 2
  2269. <if test="con != null">
  2270. and instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0
  2271. </if>
  2272. )
  2273. <where>
  2274. <if test="saleNumber != null">
  2275. and
  2276. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2277. "saleNumber" like '%${item}%'
  2278. </foreach>
  2279. </if>
  2280. <if test="statusStr != null">
  2281. and
  2282. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  2283. "statusStr" like '%${item}%'
  2284. </foreach>
  2285. </if>
  2286. <if test="shipperName != null">
  2287. and
  2288. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2289. "shipperName" like '%${item}%'
  2290. </foreach>
  2291. </if>
  2292. <if test="consigneeCompanyName != null">
  2293. and
  2294. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2295. "consigneeCompanyName" like '%${item}%'
  2296. </foreach>
  2297. </if>
  2298. <if test="consigneeWarrantyAmount != null">
  2299. and
  2300. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2301. "consigneeWarrantyAmount" like '%${item}%'
  2302. </foreach>
  2303. </if>
  2304. <if test="consigneeWarrantyWeight != null">
  2305. and
  2306. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2307. "consigneeWarrantyWeight" like '%${item}%'
  2308. </foreach>
  2309. </if>
  2310. <if test="saleOrderIsselfMention != null">
  2311. and
  2312. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2313. "saleOrderIsselfMention" like '%${item}%'
  2314. </foreach>
  2315. </if>
  2316. <if test="saleAccountBalance != null">
  2317. and
  2318. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2319. "saleAccountBalance" like '%${item}%'
  2320. </foreach>
  2321. </if>
  2322. <if test="saleCurrentOrderAmount != null">
  2323. and
  2324. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2325. "saleCurrentOrderAmount" like '%${item}%'
  2326. </foreach>
  2327. </if>
  2328. <if test="saleHistoricalOrderAmout != null">
  2329. and
  2330. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2331. "saleHistoricalOrderAmout" like '%${item}%'
  2332. </foreach>
  2333. </if>
  2334. <if test="saleOrderReceiveCustomer != null">
  2335. and
  2336. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2337. "saleOrderReceiveCustomer" like '%${item}%'
  2338. </foreach>
  2339. </if>
  2340. <if test="saleUnitPrice != null">
  2341. and
  2342. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2343. "saleUnitPrice" like '%${item}%'
  2344. </foreach>
  2345. </if>
  2346. <if test="saleOrderTax != null">
  2347. and
  2348. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2349. "saleOrderTax" like '%${item}%'
  2350. </foreach>
  2351. </if>
  2352. <if test="saleRemark != null">
  2353. and
  2354. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2355. "saleRemark" like '%${item}%'
  2356. </foreach>
  2357. </if>
  2358. </where>
  2359. <include refid="orderBy"></include>
  2360. </select>
  2361. <select id="getSaleOrderAndMaterialById" resultType="java.util.Map" parameterType="java.util.Map">
  2362. SELECT *
  2363. FROM (
  2364. SELECT
  2365. ASO.SALE_ORDER_ID AS "saleOrderId",
  2366. ASM.SALE_MATERIAL_ID AS "saleMaterialId",
  2367. RM.MATERIAL_ID AS "materialId",
  2368. ASO.SALE_NUMBER AS "saleNumber",
  2369. ASO.SALE_ORDER_ISSELF_MENTION AS "saleOrderIsselfMention",
  2370. ASO.SALE_REMARK AS "saleRemark",
  2371. RS.SHIPPER_NAME AS "shipperName",
  2372. RC.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2373. RM.MATERIAL_NAME AS "materialName",
  2374. ASM.MATERIAL_NUMBER AS "materialNumber",
  2375. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2376. ASM.SALE_WAREHOUSE AS "saleWareHouse",
  2377. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2378. RM.MATERIAL_CODE AS "materialCode",
  2379. nvl( sumWeight.weight, 0 ) + nvl( sumWeight2.weight, 0 ) + + nvl( sumWeight3.weight, 0 ) AS "totalWeight",
  2380. nvl( sumWeight.weight, 0 ) AS "netWeight",
  2381. nvl( sumWeight2.weight, 0 ) AS "weight",
  2382. nvl( carCount.coun, 0 ) + nvl( carCount1.coun, 0 ) AS "carCount"
  2383. FROM
  2384. AMS_SALE_ORDER ASO
  2385. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  2386. LEFT JOIN RMS_CONSIGNEE RC ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2387. LEFT JOIN AMS_SALE_MATERIAL ASM ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2388. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2389. LEFT JOIN (
  2390. SELECT
  2391. sum( t_w_result.RESULT_NET_WEIGHT ) weight,
  2392. a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  2393. FROM
  2394. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2395. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2396. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2397. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2398. WHERE
  2399. o_order.ORDER_TYPE = 2
  2400. GROUP BY
  2401. a_s_o_Material.SALE_ORDER_ID
  2402. ) sumWeight ON sumWeight.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2403. LEFT JOIN (
  2404. SELECT
  2405. sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
  2406. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2407. FROM
  2408. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2409. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2410. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2411. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2412. LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
  2413. WHERE
  2414. t_w_result.RESULT_NET_WEIGHT IS NULL
  2415. AND o_order.order_status IN ( 2, 5 )
  2416. AND o_order.ORDER_TYPE = 2
  2417. GROUP BY
  2418. a_s_o_Material.SALE_ORDER_ID
  2419. ) sumWeight2 ON sumWeight2.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2420. LEFT JOIN (
  2421. SELECT
  2422. sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
  2423. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2424. FROM
  2425. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2426. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2427. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2428. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2429. LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
  2430. WHERE
  2431. t_w_result.RESULT_NET_WEIGHT IS NULL
  2432. AND o_order.order_status = 4
  2433. AND o_order.ORDER_TYPE = 2
  2434. AND a_s_o_material.SALE_DATE_OF_RECEIPT &lt; SYSDATE
  2435. GROUP BY
  2436. a_s_o_Material.SALE_ORDER_ID
  2437. ) sumWeight3 ON sumWeight3.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2438. LEFT JOIN (
  2439. SELECT
  2440. count( o_order.order_id ) coun,
  2441. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2442. FROM
  2443. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2444. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2445. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2446. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2447. WHERE
  2448. o_order.order_status IN ( 2, 5 )
  2449. AND o_order.ORDER_TYPE = 2
  2450. GROUP BY
  2451. a_s_o_Material.SALE_ORDER_ID
  2452. ) carCount ON carCount.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2453. LEFT JOIN (
  2454. SELECT
  2455. count( o_order.order_id ) coun,
  2456. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2457. FROM
  2458. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2459. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2460. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2461. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2462. WHERE
  2463. o_order.order_status = 4
  2464. AND o_order.ORDER_TYPE = 2
  2465. AND a_s_o_material.SALE_DATE_OF_RECEIPT &lt; SYSDATE
  2466. GROUP BY
  2467. a_s_o_Material.SALE_ORDER_ID
  2468. ) carCount1 ON carCount1.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2469. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2470. )
  2471. <where>
  2472. <if test="saleNumber != null">
  2473. and
  2474. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2475. "saleNumber" like '%${item}%'
  2476. </foreach>
  2477. </if>
  2478. <if test="shipperName != null">
  2479. and
  2480. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2481. "shipperName" like '%${item}%'
  2482. </foreach>
  2483. </if>
  2484. <if test="consigneeCompanyName != null">
  2485. and
  2486. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2487. "consigneeCompanyName" like '%${item}%'
  2488. </foreach>
  2489. </if>
  2490. <if test="materialName != null">
  2491. and
  2492. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2493. "materialName" like '%${item}%'
  2494. </foreach>
  2495. </if>
  2496. <if test="specificationModel != null">
  2497. and
  2498. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2499. "specificationModel" like '%${item}%'
  2500. </foreach>
  2501. </if>
  2502. <if test="materialCode != null">
  2503. and
  2504. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2505. "materialCode" like '%${item}%'
  2506. </foreach>
  2507. </if>
  2508. </where>
  2509. </select>
  2510. <select id="getSaleOrderAndMaterialById2" resultType="java.util.Map" parameterType="java.util.Map">
  2511. SELECT *
  2512. FROM (
  2513. select ASO.SALE_ORDER_ID as "saleOrderId",
  2514. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2515. RM.MATERIAL_ID as "materialId",
  2516. ASO.SALE_NUMBER as "saleNumber",
  2517. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2518. RS.SHIPPER_NAME as "shipperName",
  2519. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2520. RM.MATERIAL_NAME as "materialName",
  2521. ASM.MATERIAL_NUMBER as "materialNumber",
  2522. ASM.MATERIAL_WEIGHT as "materialWeight",
  2523. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2524. RM.MATERIAL_CODE as "materialCode"
  2525. from AMS_SALE_ORDER ASO
  2526. left join RMS_SHIPPER RS
  2527. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2528. left join RMS_CONSIGNEE RC
  2529. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2530. left join AMS_SALE_MATERIAL ASM
  2531. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2532. left join RMS_MATERIAL RM
  2533. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2534. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2535. )
  2536. <where>
  2537. <if test="saleNumber != null">
  2538. and
  2539. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2540. "saleNumber" like '%${item}%'
  2541. </foreach>
  2542. </if>
  2543. <if test="shipperName != null">
  2544. and
  2545. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2546. "shipperName" like '%${item}%'
  2547. </foreach>
  2548. </if>
  2549. <if test="consigneeCompanyName != null">
  2550. and
  2551. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2552. "consigneeCompanyName" like '%${item}%'
  2553. </foreach>
  2554. </if>
  2555. <if test="materialName != null">
  2556. and
  2557. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2558. "materialName" like '%${item}%'
  2559. </foreach>
  2560. </if>
  2561. <if test="specificationModel != null">
  2562. and
  2563. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2564. "specificationModel" like '%${item}%'
  2565. </foreach>
  2566. </if>
  2567. <if test="materialCode != null">
  2568. and
  2569. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2570. "materialCode" like '%${item}%'
  2571. </foreach>
  2572. </if>
  2573. </where>
  2574. </select>
  2575. <select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
  2576. SELECT * FROM (SELECT
  2577. RM.MATERIAL_NAME AS "materialName",
  2578. ASM.SALE_WAREHOUSE AS "saleWareHouse"
  2579. FROM AMS_SALE_MATERIAL ASM
  2580. LEFT JOIN RMS_MATERIAL RM
  2581. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2582. WHERE ASM.SALE_ORDER_ID = #{saleOrderId}
  2583. <if test="con != null">
  2584. AND instr(RM.MATERIAL_NAME, #{con}) > 0
  2585. </if>
  2586. )
  2587. <where>
  2588. <if test="materialName != null">
  2589. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2590. "materialName" like '%${item}%'
  2591. </foreach>
  2592. </if>
  2593. </where>
  2594. </select>
  2595. <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
  2596. SELECT SUM(twr.RESULT_NET_WEIGHT)
  2597. FROM AMS_SALE_ORDER_MATERIAL asom
  2598. left join OMSTRUCK_ORDER oo on oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  2599. left join TMSTRUCK_TOTAL_RESULT ttr on ttr.ORDER_ID = oo.ORDER_ID
  2600. left join TMSTRUCK_WEIGHT_RESULT twr on twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  2601. where asom.sale_order_id = #{saleOrderId}
  2602. </select>
  2603. <select id="getCarNum" parameterType="DECIMAL" resultType="DECIMAL">
  2604. SELECT COUNT(ASOM.SALE_ORDER_MATERIAL_ID)
  2605. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2606. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2607. </select>
  2608. <select id="getTruckNoAndMaterial" parameterType="java.util.Map" resultType="java.util.Map" >
  2609. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2610. RM.MATERIAL_NAME AS "materialName",
  2611. ASM.MATERIAL_ID AS "materialId",
  2612. ASM.MATERIAL_NUMBER AS "materialNumber",
  2613. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2614. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2615. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  2616. RM.MATERIAL_CODE AS "materialCode",
  2617. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  2618. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2619. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2620. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2621. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2622. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2623. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  2624. RC.CAPACITY_NUMBER AS "capacityNumber",
  2625. ADSO.CARRIER_ID AS "carrierId",
  2626. RCA.CARRIER_NAME AS "carrierName",
  2627. ASOM.TRUCK_REMARK AS "truckRemark",
  2628. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr"
  2629. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  2630. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2631. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2632. LEFT JOIN AMS_SALE_ORDER ASO
  2633. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2634. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2635. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2636. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2637. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2638. LEFT JOIN AMS_SALE_MATERIAL ASM
  2639. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  2640. LEFT JOIN RMS_MATERIAL RM
  2641. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2642. LEFT JOIN OMSTRUCK_ORDER OO
  2643. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2644. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  2645. LEFT JOIN RMS_CAPACITY RC
  2646. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2647. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2648. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2649. LEFT JOIN RMS_CARRIER RCA
  2650. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2651. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2652. <if test="carrierSsoId != null">
  2653. AND RCA.CARRIER_SSO_ID = #{carrierSsoId}
  2654. </if>
  2655. AND OO.ORDER_ID IS NULL
  2656. AND ADSO.DISPATCH_ID IS NOT NULL
  2657. AND ASM.DELETED IS NULL
  2658. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2659. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2660. </select>
  2661. <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
  2662. SELECT RRP.ADDRESS_ID AS "adddressId"
  2663. FROM RMS_RECEIVE_PLACE RRP
  2664. WHERE RRP.PLACE_ID = #{placeId}
  2665. </select>
  2666. <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
  2667. SELECT DISTINCT RC.CARRIER_ID AS "id",
  2668. RC.CARRIER_ID AS "value",
  2669. RC.CARRIER_NAME AS "label",
  2670. ACTP.PRICE_ID AS "priceId",
  2671. ACTP.PRICE_VALUE AS "priceValue"
  2672. FROM RMS_RECEIVE_PLACE RRP
  2673. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2674. ON ACTP.PLACE_ID = RRP.PLACE_ID
  2675. LEFT JOIN RMS_CARRIER RC
  2676. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  2677. WHERE RRP.PLACE_ID = #{placeId}
  2678. AND ACTP.CARRIER_ID IS NOT NULL
  2679. AND ACTP.DELETED = 0
  2680. ORDER BY ACTP.PRICE_VALUE DESC
  2681. </select>
  2682. <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
  2683. SELECT ACTP.PRICE_ID AS "priceId",
  2684. ACTP.PRICE_VALUE AS "priceValue"
  2685. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2686. WHERE ACTP.CARRIER_ID = #{carrierId}
  2687. AND ACTP.PLACE_ID = #{placeId}
  2688. AND ACTP.DELETED = 0
  2689. </select>
  2690. <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
  2691. SELECT * FROM (
  2692. select DISTINCT * from(
  2693. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2694. a_s_order.SALE_NUMBER "saleNumber",
  2695. r_shipper.SHIPPER_NAME "shipperName",
  2696. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2697. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2698. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2699. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2700. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2701. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2702. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2703. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2704. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2705. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2706. a_s_order.SALE_REMARK "saleRemark",
  2707. a_s_order.INSERT_TIME "insertTime",
  2708. DECODE(a_s_order.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr",
  2709. a_s_order.UPDATE_TIME "updateTime",
  2710. RM.MATERIAL_NAME "materialName",
  2711. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2712. RM.MATERIAL_MODEL "materialModel",
  2713. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  2714. ASM.MATERIAL_NUMBER "materialNumber",
  2715. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  2716. ASOM.SALE_SHIPPING_ADDRESS_ID "saleShippingAddressId"
  2717. from AMS_SALE_ORDER a_s_order
  2718. left join RMS_SHIPPER r_shipper
  2719. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2720. left join RMS_CONSIGNEE r_consignee
  2721. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2722. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2723. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2724. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2725. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2726. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2727. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2728. LEFT JOIN RMS_CARRIER RC
  2729. ON RC.CARRIER_ID = ADSO.CARRIER_ID
  2730. LEFT JOIN OMSTRUCK_ORDER OO
  2731. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2732. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  2733. LEFT JOIN AMS_SALE_MATERIAL ASM
  2734. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2735. LEFT JOIN RMS_MATERIAL RM
  2736. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2737. where a_s_order.SALE_ORDER_STATUS in (1,2,4)
  2738. and a_s_order.CLOSE_STATUS is null
  2739. and a_s_order.DELETED = 0
  2740. and ADSO.DISPATCH_TYPE = 2
  2741. and OO.ORDER_ID IS NULL
  2742. AND ASM.DELETED IS NULL
  2743. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2744. <if test="oneDate != null">
  2745. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = a_s_order.INSERT_TIME
  2746. </if>
  2747. <if test="startDate != null">
  2748. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.INSERT_TIME
  2749. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.INSERT_TIME
  2750. </if>
  2751. <if test="carrierSsoId != null" >
  2752. and RC.CARRIER_SSO_ID = #{carrierSsoId}
  2753. </if>
  2754. ) "CARRIER"
  2755. <where>
  2756. <if test="con != null">
  2757. "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
  2758. </if>
  2759. </where>
  2760. )
  2761. <where>
  2762. <if test="saleNumber != null">
  2763. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2764. "saleNumber" like '%${item}%'
  2765. </foreach>
  2766. </if>
  2767. <if test="materialName != null">
  2768. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2769. "materialName" like '%${item}%'
  2770. </foreach>
  2771. </if>
  2772. <if test="materialSpecification != null">
  2773. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2774. "materialSpecification" like '%${item}%'
  2775. </foreach>
  2776. </if>
  2777. <if test="materialModel != null">
  2778. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2779. "materialModel" like '%${item}%'
  2780. </foreach>
  2781. </if>
  2782. <if test="shipperName != null">
  2783. and
  2784. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2785. "shipperName" like '%${item}%'
  2786. </foreach>
  2787. </if>
  2788. <if test="consigneeCompanyName != null">
  2789. and
  2790. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2791. "consigneeCompanyName" like '%${item}%'
  2792. </foreach>
  2793. </if>
  2794. <if test="consigneeWarrantyAmount != null">
  2795. and
  2796. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2797. "consigneeWarrantyAmount" like '%${item}%'
  2798. </foreach>
  2799. </if>
  2800. <if test="consigneeWarrantyWeight != null">
  2801. and
  2802. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2803. "consigneeWarrantyWeight" like '%${item}%'
  2804. </foreach>
  2805. </if>
  2806. <if test="saleOrderIsselfMention != null">
  2807. and
  2808. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2809. "saleOrderIsselfMention" like '%${item}%'
  2810. </foreach>
  2811. </if>
  2812. <if test="saleAccountBalance != null">
  2813. and
  2814. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2815. "saleAccountBalance" like '%${item}%'
  2816. </foreach>
  2817. </if>
  2818. <if test="saleCurrentOrderAmount != null">
  2819. and
  2820. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2821. "saleCurrentOrderAmount" like '%${item}%'
  2822. </foreach>
  2823. </if>
  2824. <if test="saleHistoricalOrderAmout != null">
  2825. and
  2826. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2827. "saleHistoricalOrderAmout" like '%${item}%'
  2828. </foreach>
  2829. </if>
  2830. <if test="saleOrderReceiveCustomer != null">
  2831. and
  2832. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2833. "saleOrderReceiveCustomer" like '%${item}%'
  2834. </foreach>
  2835. </if>
  2836. <if test="saleUnitPrice != null">
  2837. and
  2838. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2839. "saleUnitPrice" like '%${item}%'
  2840. </foreach>
  2841. </if>
  2842. <if test="saleOrderTax != null">
  2843. and
  2844. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2845. "saleOrderTax" like '%${item}%'
  2846. </foreach>
  2847. </if>
  2848. <if test="saleRemark != null">
  2849. and
  2850. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2851. "saleRemark" like '%${item}%'
  2852. </foreach>
  2853. </if>
  2854. </where>
  2855. order by "updateTime" DESC
  2856. </select>
  2857. <select id="getshippingAddress" resultType="java.lang.String">
  2858. select
  2859. distinct
  2860. RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN
  2861. ||RRP.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress" FROM AMS_SALE_ORDER_MATERIAL ASOM
  2862. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2863. ON RRP.PLACE_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  2864. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2865. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  2866. WHERE ASOM.SALE_SHIPPING_ADDRESS_ID = #{saleShippingAddressId}
  2867. and rownum =1
  2868. </select>
  2869. <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
  2870. select * from(
  2871. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2872. a_s_order.SALE_NUMBER "saleNumber",
  2873. r_shipper.SHIPPER_NAME "shipperName",
  2874. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2875. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2876. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2877. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2878. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2879. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2880. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2881. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2882. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2883. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2884. a_s_order.SALE_REMARK "saleRemark",
  2885. a_s_order.INSERT_TIME "insertTime",
  2886. a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
  2887. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2888. RM.MATERIAL_NAME "materialName",
  2889. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2890. RM.MATERIAL_MODEL "materialModel",
  2891. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2892. from AMS_SALE_ORDER_CARRIER a_s_o_carrier
  2893. left join RMS_CARRIER r_carrier
  2894. on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
  2895. left join AMS_SALE_ORDER a_s_order
  2896. on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  2897. left join RMS_SHIPPER r_shipper
  2898. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2899. left join RMS_CONSIGNEE r_consignee
  2900. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2901. LEFT JOIN AMS_SALE_MATERIAL ASM
  2902. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2903. LEFT JOIN RMS_MATERIAL RM
  2904. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2905. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2906. and a_s_order.CLOSE_STATUS is null
  2907. and a_s_order.DELETED = 0
  2908. <if test="carrierSsoId != null">
  2909. and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
  2910. </if>
  2911. <if test="con != null">
  2912. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2913. </if>
  2914. )
  2915. <where>
  2916. <if test="saleNumber != null">
  2917. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2918. "saleNumber" like '%${item}%'
  2919. </foreach>
  2920. </if>
  2921. <if test="materialName != null">
  2922. and
  2923. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2924. "materialName" like '%${item}%'
  2925. </foreach>
  2926. </if>
  2927. <if test="materialSpecification != null">
  2928. and
  2929. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2930. "materialSpecification" like '%${item}%'
  2931. </foreach>
  2932. </if>
  2933. <if test="materialModel != null">
  2934. and
  2935. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2936. "materialModel" like '%${item}%'
  2937. </foreach>
  2938. </if>
  2939. <if test="shipperName != null">
  2940. and
  2941. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2942. "shipperName" like '%${item}%'
  2943. </foreach>
  2944. </if>
  2945. <if test="consigneeCompanyName != null">
  2946. and
  2947. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2948. "consigneeCompanyName" like '%${item}%'
  2949. </foreach>
  2950. </if>
  2951. <if test="consigneeWarrantyAmount != null">
  2952. and
  2953. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2954. "consigneeWarrantyAmount" like '%${item}%'
  2955. </foreach>
  2956. </if>
  2957. <if test="consigneeWarrantyWeight != null">
  2958. and
  2959. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2960. "consigneeWarrantyWeight" like '%${item}%'
  2961. </foreach>
  2962. </if>
  2963. <if test="saleOrderIsselfMention != null">
  2964. and
  2965. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2966. "saleOrderIsselfMention" like '%${item}%'
  2967. </foreach>
  2968. </if>
  2969. <if test="saleAccountBalance != null">
  2970. and
  2971. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2972. "saleAccountBalance" like '%${item}%'
  2973. </foreach>
  2974. </if>
  2975. <if test="saleCurrentOrderAmount != null">
  2976. and
  2977. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2978. "saleCurrentOrderAmount" like '%${item}%'
  2979. </foreach>
  2980. </if>
  2981. <if test="saleHistoricalOrderAmout != null">
  2982. and
  2983. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2984. "saleHistoricalOrderAmout" like '%${item}%'
  2985. </foreach>
  2986. </if>
  2987. <if test="saleOrderReceiveCustomer != null">
  2988. and
  2989. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2990. "saleOrderReceiveCustomer" like '%${item}%'
  2991. </foreach>
  2992. </if>
  2993. <if test="saleUnitPrice != null">
  2994. and
  2995. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2996. "saleUnitPrice" like '%${item}%'
  2997. </foreach>
  2998. </if>
  2999. <if test="saleOrderTax != null">
  3000. and
  3001. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3002. "saleOrderTax" like '%${item}%'
  3003. </foreach>
  3004. </if>
  3005. <if test="saleRemark != null">
  3006. and
  3007. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3008. "saleRemark" like '%${item}%'
  3009. </foreach>
  3010. </if>
  3011. </where>
  3012. <include refid="orderBy1"></include>
  3013. </select>
  3014. <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  3015. SELECT *
  3016. FROM (
  3017. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3018. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3019. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3020. "addressDeliveryAddress",
  3021. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3022. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  3023. AS "approvalStatus",
  3024. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3025. RSH.SHIPPER_NAME AS "shipperName",
  3026. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3027. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3028. ASOM.INSERT_TIME AS "insertTime",
  3029. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3030. ASO.SALE_ORDER_ID AS "saleOrderId",
  3031. RM.MATERIAL_NAME AS "materialName",
  3032. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3033. RM.MATERIAL_MODEL AS "materialModel",
  3034. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3035. ASM.MATERIAL_NUMBER AS "materialNumber",
  3036. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
  3037. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3038. LEFT JOIN AMS_SALE_ORDER ASO
  3039. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3040. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3041. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3042. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3043. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3044. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3045. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3046. LEFT JOIN RMS_SHIPPER RSH
  3047. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3048. LEFT JOIN RMS_CONSIGNEE RCO
  3049. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3050. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3051. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3052. LEFT JOIN AMS_SALE_MATERIAL ASM
  3053. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3054. LEFT JOIN RMS_MATERIAL RM
  3055. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3056. WHERE ASO.SALE_ORDER_STATUS IN (1,2,4)
  3057. AND ASOM.ISSUE_STATUS IS NULL
  3058. AND ADSO.CARRIER_ID IS NULL
  3059. AND ASO.DELETED = 0
  3060. AND ASM.DELETED IS NULL
  3061. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  3062. <if test="oneDate != null">
  3063. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  3064. </if>
  3065. <if test="startDate != null">
  3066. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  3067. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  3068. </if>
  3069. <if test="con != null" >
  3070. AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
  3071. </if>
  3072. )
  3073. <where>
  3074. <if test="saleNumber != null">
  3075. and
  3076. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3077. "saleNumber" like '%${item}%'
  3078. </foreach>
  3079. </if>
  3080. <if test="materialName != null">
  3081. and
  3082. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3083. "materialName" like '%${item}%'
  3084. </foreach>
  3085. </if>
  3086. <if test="materialModel != null">
  3087. and
  3088. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3089. "materialModel" like '%${item}%'
  3090. </foreach>
  3091. </if>
  3092. <if test="materialSpecification != null">
  3093. and
  3094. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3095. "materialSpecification" like '%${item}%'
  3096. </foreach>
  3097. </if>
  3098. <if test="truckNo != null">
  3099. and
  3100. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3101. "truckNo" like '%${item}%'
  3102. </foreach>
  3103. </if>
  3104. <if test="addressDeliveryAddress != null">
  3105. and
  3106. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3107. "addressDeliveryAddress" like '%${item}%'
  3108. </foreach>
  3109. </if>
  3110. <if test="saleDateOfReceipt != null">
  3111. and
  3112. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3113. "saleDateOfReceipt" like '%${item}%'
  3114. </foreach>
  3115. </if>
  3116. <if test="saleOrderConsignee != null">
  3117. and
  3118. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3119. "saleOrderConsignee" like '%${item}%'
  3120. </foreach>
  3121. </if>
  3122. <if test="saleOrderConsigneeTel != null">
  3123. and
  3124. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3125. "saleOrderConsigneeTel" like '%${item}%'
  3126. </foreach>
  3127. </if>
  3128. <if test="shipperName != null">
  3129. and
  3130. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3131. "shipperName" like '%${item}%'
  3132. </foreach>
  3133. </if>
  3134. <if test="consigneeCompanyName != null">
  3135. and
  3136. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3137. "consigneeCompanyName" like '%${item}%'
  3138. </foreach>
  3139. </if>
  3140. <if test="isselfMention != null">
  3141. and
  3142. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3143. "isselfMention" like '%${item}%'
  3144. </foreach>
  3145. </if>
  3146. </where>
  3147. <include refid="orderBy"></include>
  3148. </select>
  3149. <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
  3150. SELECT
  3151. RM.MATERIAL_ID AS "materialId",
  3152. RM.MATERIAL_NAME AS "materialName",
  3153. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3154. RM.MATERIAL_CODE AS "materialCode",
  3155. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
  3156. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3157. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3158. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3159. LEFT JOIN AMS_SALE_MATERIAL ASM
  3160. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3161. LEFT JOIN RMS_MATERIAL RM
  3162. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3163. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3164. </select>
  3165. <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  3166. SELECT * FROM(
  3167. SELECT DISTINCT *
  3168. FROM (
  3169. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3170. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3171. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3172. "addressDeliveryAddress",
  3173. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3174. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  3175. AS "approvalStatus",
  3176. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3177. RSH.SHIPPER_NAME AS "shipperName",
  3178. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3179. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3180. ASOM.INSERT_TIME AS "insertTime",
  3181. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3182. ASO.SALE_ORDER_ID AS "saleOrderId",
  3183. RCA.CARRIER_NAME AS "carrierName",
  3184. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3185. RM.MATERIAL_NAME AS "materialName",
  3186. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3187. RM.MATERIAL_MODEL AS "materialModel",
  3188. RM.MATERIAL_SPECIFICATION || MATERIAL_MODEL AS "specificationModel",
  3189. ASM.MATERIAL_NUMBER AS "materialNumber"
  3190. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3191. LEFT JOIN AMS_SALE_ORDER ASO
  3192. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3193. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3194. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3195. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3196. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3197. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3198. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3199. LEFT JOIN RMS_SHIPPER RSH
  3200. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3201. LEFT JOIN RMS_CONSIGNEE RCO
  3202. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3203. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3204. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3205. LEFT JOIN OMSTRUCK_ORDER OO
  3206. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3207. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  3208. LEFT JOIN RMS_CARRIER RCA
  3209. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3210. LEFT JOIN AMS_SALE_MATERIAL ASM
  3211. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3212. LEFT JOIN RMS_MATERIAL RM
  3213. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3214. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  3215. AND ASOM.ISSUE_STATUS IS NULL
  3216. AND ADSO.DISPATCH_TYPE = 2
  3217. AND OO.ORDER_ID IS NULL
  3218. AND ASO.DELETED = 0
  3219. AND ASM.DELETED IS NULL
  3220. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  3221. <if test="oneDate != null">
  3222. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  3223. </if>
  3224. <if test="startDate != null">
  3225. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  3226. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  3227. </if>
  3228. ) "NOCAR"
  3229. <where>
  3230. <if test="con != null" >
  3231. "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
  3232. </if>
  3233. </where>
  3234. )
  3235. <where>
  3236. <if test="saleNumber != null">
  3237. and
  3238. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3239. "saleNumber" like '%${item}%'
  3240. </foreach>
  3241. </if>
  3242. <if test="materialName != null">
  3243. and
  3244. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3245. "materialName" like '%${item}%'
  3246. </foreach>
  3247. </if>
  3248. <if test="materialModel != null">
  3249. and
  3250. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3251. "materialModel" like '%${item}%'
  3252. </foreach>
  3253. </if>
  3254. <if test="materialSpecification != null">
  3255. and
  3256. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3257. "materialSpecification" like '%${item}%'
  3258. </foreach>
  3259. </if>
  3260. <if test="carrierName != null">
  3261. and
  3262. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3263. "carrierName" like '%${item}%'
  3264. </foreach>
  3265. </if>
  3266. <if test="truckNo != null">
  3267. and
  3268. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3269. "truckNo" like '%${item}%'
  3270. </foreach>
  3271. </if>
  3272. <if test="addressDeliveryAddress != null">
  3273. and
  3274. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3275. "addressDeliveryAddress" like '%${item}%'
  3276. </foreach>
  3277. </if>
  3278. <if test="saleDateOfReceipt != null">
  3279. and
  3280. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3281. "saleDateOfReceipt" like '%${item}%'
  3282. </foreach>
  3283. </if>
  3284. <if test="saleOrderConsignee != null">
  3285. and
  3286. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3287. "saleOrderConsignee" like '%${item}%'
  3288. </foreach>
  3289. </if>
  3290. <if test="saleOrderConsigneeTel != null">
  3291. and
  3292. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3293. "saleOrderConsigneeTel" like '%${item}%'
  3294. </foreach>
  3295. </if>
  3296. <if test="shipperName != null">
  3297. and
  3298. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3299. "shipperName" like '%${item}%'
  3300. </foreach>
  3301. </if>
  3302. <if test="consigneeCompanyName != null">
  3303. and
  3304. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3305. "consigneeCompanyName" like '%${item}%'
  3306. </foreach>
  3307. </if>
  3308. <if test="isselfMention != null">
  3309. and
  3310. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3311. "isselfMention" like '%${item}%'
  3312. </foreach>
  3313. </if>
  3314. </where>
  3315. <include refid="orderBy"></include>
  3316. </select>
  3317. <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
  3318. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3319. RM.MATERIAL_NAME AS "materialName",
  3320. ASM.MATERIAL_ID AS "materialId",
  3321. ASM.MATERIAL_NUMBER AS "materialNumber",
  3322. ASM.MATERIAL_WEIGHT AS "materialWeight",
  3323. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3324. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  3325. RM.MATERIAL_CODE AS "materialCode",
  3326. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  3327. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3328. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3329. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3330. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3331. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3332. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  3333. RC.CAPACITY_NUMBER AS "capacityNumber",
  3334. ADSO.CARRIER_ID AS "carrierId",
  3335. ASOM.TRUCK_REMARK AS "truckRemark"
  3336. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3337. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3338. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  3339. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3340. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3341. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3342. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3343. LEFT JOIN AMS_SALE_MATERIAL ASM
  3344. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  3345. LEFT JOIN RMS_MATERIAL RM
  3346. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3347. LEFT JOIN OMSTRUCK_ORDER OO
  3348. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3349. and NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  3350. LEFT JOIN RMS_CAPACITY RC
  3351. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  3352. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3353. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3354. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3355. and ASM.SALE_MATERIAL_ID IS NOT NULL
  3356. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  3357. </select>
  3358. <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  3359. SELECT * FROM (
  3360. SELECT DISTINCT *
  3361. FROM (
  3362. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3363. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3364. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3365. "addressDeliveryAddress",
  3366. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3367. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  3368. AS "approvalStatus",
  3369. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3370. RSH.SHIPPER_NAME AS "shipperName",
  3371. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3372. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3373. ASOM.INSERT_TIME AS "insertTime",
  3374. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3375. ASO.SALE_ORDER_ID AS "saleOrderId",
  3376. RCA.CARRIER_NAME AS "carrierName",
  3377. RM.MATERIAL_NAME AS "materialName",
  3378. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3379. RM.MATERIAL_MODEL AS "materialModel",
  3380. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3381. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3382. RCP.CAPACITY_NUMBER AS "capacityNumber",
  3383. OO.DRIVER_TEL AS "drivelTel",
  3384. ASM.MATERIAL_NUMBER AS "materialNumber",
  3385. OO.ORDER_ID AS "orderId"
  3386. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3387. LEFT JOIN AMS_SALE_ORDER ASO
  3388. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3389. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3390. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3391. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3392. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3393. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3394. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3395. LEFT JOIN RMS_SHIPPER RSH
  3396. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3397. LEFT JOIN RMS_CONSIGNEE RCO
  3398. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3399. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3400. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3401. LEFT JOIN OMSTRUCK_ORDER OO
  3402. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3403. LEFT JOIN RMS_CAPACITY RCP
  3404. ON RCP.CAPACITY_ID = OO.CAPACITY_ID
  3405. LEFT JOIN RMS_CARRIER RCA
  3406. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3407. LEFT JOIN AMS_SALE_MATERIAL ASM
  3408. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3409. LEFT JOIN RMS_MATERIAL RM
  3410. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3411. WHERE OO.ORDER_TYPE = 1
  3412. AND ASO.SALE_ORDER_STATUS IN (2,4)
  3413. AND ASOM.ISSUE_STATUS IS NULL
  3414. AND ADSO.DISPATCH_TYPE = 2
  3415. AND OO.ORDER_ID IS NOT NULL
  3416. AND OO.ORDER_STATUS IN (4,5)
  3417. AND ASO.DELETED != 2
  3418. AND ASM.DELETED IS NULL
  3419. <if test="oneDate != null">
  3420. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASOM.INSERT_TIME
  3421. </if>
  3422. <if test="startDate != null">
  3423. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASOM.INSERT_TIME
  3424. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASOM.INSERT_TIME
  3425. </if>
  3426. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3427. ) "HAVECAR"
  3428. <where>
  3429. <if test="con != null" >
  3430. "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
  3431. </if>
  3432. </where>
  3433. )
  3434. <where>
  3435. <if test="saleNumber != null">
  3436. and
  3437. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3438. "saleNumber" like '%${item}%'
  3439. </foreach>
  3440. </if>
  3441. <if test="materialName != null">
  3442. and
  3443. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3444. "materialName" like '%${item}%'
  3445. </foreach>
  3446. </if>
  3447. <if test="materialSpecification != null">
  3448. and
  3449. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3450. "materialSpecification" like '%${item}%'
  3451. </foreach>
  3452. </if>
  3453. <if test="materialModel != null">
  3454. and
  3455. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3456. "materialModel" like '%${item}%'
  3457. </foreach>
  3458. </if>
  3459. <if test="materialName != null">
  3460. and
  3461. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3462. "materialName" like '%${item}%'
  3463. </foreach>
  3464. </if>
  3465. <if test="carrierName != null">
  3466. and
  3467. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3468. "carrierName" like '%${item}%'
  3469. </foreach>
  3470. </if>
  3471. <if test="truckNo != null">
  3472. and
  3473. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3474. "truckNo" like '%${item}%'
  3475. </foreach>
  3476. </if>
  3477. <if test="addressDeliveryAddress != null">
  3478. and
  3479. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3480. "addressDeliveryAddress" like '%${item}%'
  3481. </foreach>
  3482. </if>
  3483. <if test="saleDateOfReceipt != null">
  3484. and
  3485. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3486. "saleDateOfReceipt" like '%${item}%'
  3487. </foreach>
  3488. </if>
  3489. <if test="saleOrderConsignee != null">
  3490. and
  3491. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3492. "saleOrderConsignee" like '%${item}%'
  3493. </foreach>
  3494. </if>
  3495. <if test="saleOrderConsigneeTel != null">
  3496. and
  3497. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3498. "saleOrderConsigneeTel" like '%${item}%'
  3499. </foreach>
  3500. </if>
  3501. <if test="shipperName != null">
  3502. and
  3503. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3504. "shipperName" like '%${item}%'
  3505. </foreach>
  3506. </if>
  3507. <if test="consigneeCompanyName != null">
  3508. and
  3509. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3510. "consigneeCompanyName" like '%${item}%'
  3511. </foreach>
  3512. </if>
  3513. <if test="isselfMention != null">
  3514. and
  3515. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3516. "isselfMention" like '%${item}%'
  3517. </foreach>
  3518. </if>
  3519. </where>
  3520. </select>
  3521. <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
  3522. SELECT PRICE_ID AS "priceId"
  3523. FROM AMS_SALE_ORDER_MATERIAL
  3524. WHERE SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3525. ORDER BY INSERT_TIME DESC
  3526. FETCH NEXT 1 ROWS ONLY
  3527. </select>
  3528. <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
  3529. SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
  3530. FROM RMS_CONSIGNEE RC
  3531. WHERE RC.CONSIGNEE_ID = #{receiveId}
  3532. </select>
  3533. <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
  3534. SELECT RC.CARRIER_ID AS "carrierId"
  3535. FROM RMS_CARRIER RC
  3536. WHERE RC.CARRIER_NAME = #{consigneeName}
  3537. </select>
  3538. <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
  3539. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
  3540. ASO.SALE_REMARK AS "saleRemark",
  3541. ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
  3542. RSH.SHIPPER_ID AS "shipperId",
  3543. RSH.SHIPPER_NAME AS "shipperName",
  3544. RCO.CONSIGNEE_ID AS "receiveId",
  3545. RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
  3546. RSA.SALER_ID AS "salerId",
  3547. RSA.SALER_NAME AS "salerName"
  3548. FROM AMS_SALE_ORDER ASO
  3549. LEFT JOIN RMS_SHIPPER RSH
  3550. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3551. LEFT JOIN RMS_CONSIGNEE RCO
  3552. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3553. LEFT JOIN RMS_SALER RSA
  3554. ON RSA.SALER_ID = ASO.SALER_ID
  3555. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3556. </select>
  3557. <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
  3558. SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3559. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3560. RRA.ADDRESS_ID AS "shipperAddressId",
  3561. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
  3562. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3563. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3564. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3565. ASM.MATERIAL_ID AS "materialId",
  3566. RM.MATERIAL_NAME AS "materialName",
  3567. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
  3568. RM.MATERIAL_CODE AS "materialCode",
  3569. ASM.MATERIAL_NUMBER AS "materialNumber",
  3570. ASM.STEEL_METER AS "steelMeters",
  3571. ASM.IS_POUND_SALE AS "isPoundSale",
  3572. ASOM.TRUCK_REMARK AS "truckRemark"
  3573. FROM AMS_SALE_ORDER ASO
  3574. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3575. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3576. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3577. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3578. LEFT JOIN AMS_SALE_MATERIAL ASM
  3579. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3580. LEFT JOIN RMS_MATERIAL RM
  3581. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3582. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3583. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3584. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3585. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3586. WHERE asm.SALE_MATERIAL_ID is not null
  3587. and ASO.SALE_ORDER_ID = #{saleOrderId}
  3588. </select>
  3589. <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.LinkedHashMap" >
  3590. SELECT
  3591. DISTINCT
  3592. RRP.PLACE_ID "placeId",
  3593. RRP.ADDRESS_DELIVERY_ADDRESS "place",
  3594. RRA.ADDRESS_ID "shipperAddressId",
  3595. RRA.ADDRESS_PROVINCE "addressProvince",
  3596. RRA.ADDRESS_DISTRICT "addressDistrict",
  3597. RRA.ADDRESS_TOWN "addressTown",
  3598. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  3599. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS "addressPlace",
  3600. max(ASOM.SALE_ORDER_MATERIAL_ID) as b
  3601. FROM AMS_SALE_ORDER ASO
  3602. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3603. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3604. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3605. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3606. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3607. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3608. WHERE ASO.RECEIVE_ID = #{receiveId}
  3609. AND RRP.PLACE_ID IS NOT NULL
  3610. GROUP BY RRP.PLACE_ID , RRP.ADDRESS_DELIVERY_ADDRESS , RRA.ADDRESS_ID ,
  3611. RRA.ADDRESS_PROVINCE ,
  3612. RRA.ADDRESS_DISTRICT ,
  3613. RRA.ADDRESS_TOWN ,
  3614. ASOM.SALE_ORDER_CONSIGNEE_TEL
  3615. ORDER BY b DESC
  3616. </select>
  3617. <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
  3618. SELECT DISTINCT *
  3619. FROM (
  3620. SELECT RS.SALER_NAME "salerName",
  3621. RS.SALER_ID "salerId"
  3622. FROM AMS_SALE_ORDER ASO
  3623. LEFT JOIN RMS_SALER RS
  3624. ON RS.SALER_ID = ASO.SALER_ID
  3625. WHERE ASO.RECEIVE_ID = #{receiveId}
  3626. AND RS.SALER_ID IS NOT NULL
  3627. AND ASO.SALE_TYPE = 1
  3628. ORDER BY ASO.SALE_ORDER_ID DESC
  3629. )
  3630. WHERE rownum <![CDATA[
  3631. <
  3632. ]]> 2
  3633. </select>
  3634. <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
  3635. SELECT DISTINCT *
  3636. FROM (
  3637. SELECT OO.DRIVER_TEL "driverTel"
  3638. FROM RMS_CAPACITY RCA
  3639. LEFT JOIN OMSTRUCK_ORDER OO
  3640. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3641. WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
  3642. AND OO.ORDER_TYPE = 1
  3643. AND OO.DRIVER_TEL IS NOT NULL
  3644. ORDER BY OO.ORDER_ID DESC
  3645. )
  3646. WHERE ROWNUM <![CDATA[
  3647. <
  3648. ]]> 2
  3649. </select>
  3650. <!-- 查询内转焦炭订单 -->
  3651. <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3652. SELECT * FROM (
  3653. SELECT *from(
  3654. select
  3655. OO.ORDER_NUMBER "orderNumber",
  3656. ASO.SALE_NUMBER "saleNumber",
  3657. RC.CAPACITY_NUMBER "capacityNumber",
  3658. RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3659. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
  3660. ACTP.PRICE_VALUE "priceValue",
  3661. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  3662. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  3663. RS.SHIPPER_NAME "shipperName",
  3664. OO.ORDER_ID "orderId",
  3665. RC3.CARRIER_NAME "carrierName"
  3666. FROM OMSTRUCK_ORDER OO
  3667. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3668. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  3669. LEFT JOIN AMS_SALE_ORDER ASO
  3670. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  3671. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3672. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3673. LEFT JOIN RMS_CARRIER RC3
  3674. ON RC3.CARRIER_ID = ADSO.CARRIER_ID
  3675. LEFT JOIN RMS_CONSIGNEE RC2
  3676. ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
  3677. LEFT JOIN RMS_CAPACITY RC
  3678. ON OO.CAPACITY_ID=RC.CAPACITY_ID
  3679. LEFT JOIN RMS_SHIPPER RS
  3680. ON RS.SHIPPER_ID=ASO.SHIPPER_ID
  3681. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3682. ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  3683. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3684. ON OO.PRICE_ID=ACTP.PRICE_ID
  3685. WHERE OO.ORDER_TYPE = 2
  3686. AND ASO.SHIPPER_ID = 2
  3687. AND ASO.CLOSE_STATUS = 0
  3688. <where>
  3689. <if test="orderStatus!=null">
  3690. AND OO.ORDER_STATUS = #{orderStatus}
  3691. </if>
  3692. </where>
  3693. ) RRC
  3694. <if test="con != null">
  3695. WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
  3696. </if>
  3697. )
  3698. <where>
  3699. <if test="orderNumber != null">
  3700. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  3701. "orderNumber" like '%${item}%'
  3702. </foreach>
  3703. </if>
  3704. <if test="carrierName != null">
  3705. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3706. "carrierName" like '%${item}%'
  3707. </foreach>
  3708. </if>
  3709. <if test="saleNumber != null">
  3710. and
  3711. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3712. "saleNumber" like '%${item}%'
  3713. </foreach>
  3714. </if>
  3715. <if test="capacityNumber != null">
  3716. and
  3717. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  3718. "capacityNumber" like '%${item}%'
  3719. </foreach>
  3720. </if>
  3721. <if test="shipperName != null">
  3722. and
  3723. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3724. "shipperName" like '%${item}%'
  3725. </foreach>
  3726. </if>
  3727. <if test="consigneeCompanyName != null">
  3728. and
  3729. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3730. "consigneeCompanyName" like '%${item}%'
  3731. </foreach>
  3732. </if>
  3733. </where>
  3734. <include refid="orderBy">
  3735. </include>
  3736. <if test="orderField == null ">
  3737. order by "orderNumber" desc
  3738. </if>
  3739. </select>
  3740. <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
  3741. SELECT ADSO.DISPATCH_ID AS "dispatchId"
  3742. FROM AMS_DISPATCH_SALE_ORDER ADSO
  3743. WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3744. </select>
  3745. <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="java.util.Map" >
  3746. SELECT ASTM.MATERIAL_ID AS "saleMaterialId",
  3747. ASM.EAS_PRIMARY_ID AS "closeEntryId"
  3748. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3749. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3750. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3751. LEFT JOIN AMS_SALE_MATERIAL ASM
  3752. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3753. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3754. </select>
  3755. <select id="getSaleList" resultType="java.util.Map" >
  3756. SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
  3757. ASM.SALE_MATERIAL_ID "saleMaterialId",
  3758. ASM.MATERIAL_ID "materialId"
  3759. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3760. LEFT JOIN AMS_SALE_MATERIAL ASM
  3761. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3762. WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3763. AND ASM.MATERIAL_ID = #{materialId}
  3764. </select>
  3765. <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3766. select * from(
  3767. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3768. a_s_order.SALE_NUMBER "saleNumber",
  3769. r_shipper.SHIPPER_NAME "shipperName",
  3770. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3771. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3772. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3773. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3774. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3775. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3776. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3777. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3778. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3779. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3780. a_s_order.SALE_REMARK "saleRemark",
  3781. a_s_order.INSERT_TIME "insertTime",
  3782. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3783. RM.MATERIAL_NAME "materialName",
  3784. ASM.MATERIAL_WEIGHT "materialWeight",
  3785. ASM.SALE_WAREHOUSE "saleWareHouse",
  3786. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  3787. nvl(sumWeight.weight ,0) as "netWeight",
  3788. nvl(sumWeight2.weight ,0) as "weight",
  3789. nvl(carCount.coun ,0) as "carCount",
  3790. RCA.CARRIER_NAME as "carrierName"
  3791. from AMS_SALE_ORDER a_s_order
  3792. left join RMS_SHIPPER r_shipper
  3793. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3794. left join RMS_CONSIGNEE r_consignee
  3795. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3796. LEFT JOIN AMS_SALE_MATERIAL ASM
  3797. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3798. LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
  3799. ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3800. LEFT JOIN RMS_CARRIER RCA
  3801. ON RCA.CARRIER_ID = ASOC.CARRIER_ID
  3802. LEFT JOIN RMS_MATERIAL RM
  3803. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3804. left join (
  3805. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  3806. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3807. left join Omstruck_Order o_order
  3808. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3809. left join Tmstruck_Total_Result t_t_result
  3810. on o_order.order_id=t_t_result.order_id
  3811. left join Tmstruck_Weight_Result t_w_result
  3812. on t_t_result.result_total_id=t_w_result.result_total_id
  3813. GROUP BY
  3814. a_s_o_Material.SALE_ORDER_ID
  3815. ) sumWeight
  3816. on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3817. left join (
  3818. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3819. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3820. left join Omstruck_Order o_order
  3821. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3822. left join Tmstruck_Total_Result t_t_result
  3823. on o_order.order_id=t_t_result.order_id
  3824. left join Tmstruck_Weight_Result t_w_result
  3825. on t_t_result.result_total_id=t_w_result.result_total_id
  3826. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  3827. on o_order.order_id=o_o_material.ORDER_ID
  3828. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3829. GROUP BY
  3830. a_s_o_Material.SALE_ORDER_ID
  3831. ) sumWeight2
  3832. on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3833. left join (
  3834. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3835. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3836. left join Omstruck_Order o_order
  3837. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3838. left join Tmstruck_Total_Result t_t_result
  3839. on o_order.order_id=t_t_result.order_id
  3840. left join Tmstruck_Weight_Result t_w_result
  3841. on t_t_result.result_total_id=t_w_result.result_total_id
  3842. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3843. GROUP BY
  3844. a_s_o_Material.SALE_ORDER_ID
  3845. ) carCount
  3846. on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3847. where (ASM.SALE_WAREHOUSE = '副产品库'
  3848. or ASM.SALE_WAREHOUSE = '钒渣库')
  3849. and a_s_order.SALE_ORDER_STATUS in (2,4)
  3850. and a_s_order.CLOSE_STATUS is null
  3851. and a_s_order.DELETED = #{deleted}
  3852. and a_s_order.SHIPPER_ID = 1
  3853. and a_s_order.SALE_TYPE is null
  3854. <if test="con != null">
  3855. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3856. </if>
  3857. <if test="consigneeSsoId != null">
  3858. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3859. </if>
  3860. <if test="oneDate != null">
  3861. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3862. </if>
  3863. <if test="startDate != null">
  3864. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3865. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3866. </if>
  3867. ORDER BY a_s_order.UPDATE_TIME DESC
  3868. )
  3869. <where>
  3870. <if test="saleNumber != null">
  3871. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3872. "saleNumber" like '%${item}%'
  3873. </foreach>
  3874. </if>
  3875. <if test="materialName != null">
  3876. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3877. "materialName" like '%${item}%'
  3878. </foreach>
  3879. </if>
  3880. <if test="materialSpecification != null">
  3881. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3882. "materialSpecification" like '%${item}%'
  3883. </foreach>
  3884. </if>
  3885. <if test="materialModel != null">
  3886. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3887. "materialModel" like '%${item}%'
  3888. </foreach>
  3889. </if>
  3890. <if test="statusStr != null">
  3891. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3892. and "statusStr" like '%${item}%'
  3893. </foreach>
  3894. </if>
  3895. <if test="shipperName != null">
  3896. and
  3897. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3898. "shipperName" like '%${item}%'
  3899. </foreach>
  3900. </if>
  3901. <if test="consigneeCompanyName != null">
  3902. and
  3903. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3904. "consigneeCompanyName" like '%${item}%'
  3905. </foreach>
  3906. </if>
  3907. <if test="consigneeWarrantyAmount != null">
  3908. and
  3909. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3910. "consigneeWarrantyAmount" like '%${item}%'
  3911. </foreach>
  3912. </if>
  3913. <if test="consigneeWarrantyWeight != null">
  3914. and
  3915. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3916. "consigneeWarrantyWeight" like '%${item}%'
  3917. </foreach>
  3918. </if>
  3919. <if test="saleOrderIsselfMention != null">
  3920. and
  3921. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3922. "saleOrderIsselfMention" like '%${item}%'
  3923. </foreach>
  3924. </if>
  3925. <if test="saleAccountBalance != null">
  3926. and
  3927. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3928. "saleAccountBalance" like '%${item}%'
  3929. </foreach>
  3930. </if>
  3931. <if test="saleCurrentOrderAmount != null">
  3932. and
  3933. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3934. "saleCurrentOrderAmount" like '%${item}%'
  3935. </foreach>
  3936. </if>
  3937. <if test="saleHistoricalOrderAmout != null">
  3938. and
  3939. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3940. "saleHistoricalOrderAmout" like '%${item}%'
  3941. </foreach>
  3942. </if>
  3943. <if test="saleOrderReceiveCustomer != null">
  3944. and
  3945. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3946. "saleOrderReceiveCustomer" like '%${item}%'
  3947. </foreach>
  3948. </if>
  3949. <if test="saleUnitPrice != null">
  3950. and
  3951. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3952. "saleUnitPrice" like '%${item}%'
  3953. </foreach>
  3954. </if>
  3955. <if test="saleOrderTax != null">
  3956. and
  3957. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3958. "saleOrderTax" like '%${item}%'
  3959. </foreach>
  3960. </if>
  3961. <if test="saleRemark != null">
  3962. and
  3963. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3964. "saleRemark" like '%${item}%'
  3965. </foreach>
  3966. </if>
  3967. </where>
  3968. </select>
  3969. <!-- 关闭未进厂的运单 -->
  3970. <update id="closeOrderNotIn" parameterType="DECIMAL" >
  3971. UPDATE OMSTRUCK_ORDER OO
  3972. SET OO.ORDER_STATUS = 7,
  3973. OO.INSERT_UPDATE_REMARK = '关闭销售订单,运单同步关闭'
  3974. WHERE OO.ORDER_ID IN (
  3975. SELECT OO.ORDER_ID "orderId"
  3976. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3977. LEFT JOIN OMSTRUCK_ORDER OO
  3978. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3979. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  3980. ON TTR.ORDER_ID = OO.ORDER_ID
  3981. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  3982. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  3983. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  3984. AND TER.RESULT_ENTRY_GATE_TIME IS NULL
  3985. AND OO.ORDER_TYPE IN (1,2)
  3986. AND OO.ORDER_ID IS NOT NULL
  3987. AND OO.ORDER_STATUS IN (4,5)
  3988. )
  3989. </update>
  3990. <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
  3991. SELECT RCA.CAPACITY_NUMBER AS "r1c1",
  3992. OO.ORDER_NUMBER AS "r1c2",
  3993. RM.EAS_MATERIAL_ID AS "r1c3",
  3994. RM.MATERIAL_NAME AS "r1c4",
  3995. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
  3996. FROM OMSTRUCK_ORDER OO
  3997. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  3998. ON OOM.ORDER_ID = OO.ORDER_ID
  3999. LEFT JOIN RMS_MATERIAL RM
  4000. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  4001. LEFT JOIN RMS_CAPACITY RCA
  4002. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  4003. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  4004. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4005. LEFT JOIN AMS_SALE_ORDER ASO
  4006. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4007. LEFT JOIN RMS_CONSIGNEE RC
  4008. ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  4009. </select>
  4010. <select id="getSteelOrderDeletedList" resultType="java.util.Map" parameterType="java.util.Map">
  4011. select * from(
  4012. select a_s_order.SALE_ORDER_ID "saleOrderId",
  4013. a_s_order.SALE_NUMBER "saleNumber",
  4014. r_shipper.SHIPPER_NAME "shipperName",
  4015. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  4016. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  4017. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  4018. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  4019. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  4020. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4021. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4022. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4023. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4024. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4025. a_s_order.SALE_REMARK "saleRemark",
  4026. a_s_order.INSERT_TIME "insertTime",
  4027. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  4028. RM.MATERIAL_NAME "materialName",
  4029. RM.MATERIAL_SPECIFICATION "materialSpecification",
  4030. RM.MATERIAL_MODEL "materialModel",
  4031. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  4032. ASM.MATERIAL_NUMBER "materialNumber",
  4033. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  4034. ASM.SALE_WAREHOUSE "saleWareHouse",
  4035. a_s_order.DELETED "deleted"
  4036. from AMS_SALE_ORDER a_s_order
  4037. left join RMS_SHIPPER r_shipper
  4038. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4039. left join RMS_CONSIGNEE r_consignee
  4040. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4041. LEFT JOIN AMS_SALE_MATERIAL ASM
  4042. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4043. LEFT JOIN RMS_MATERIAL RM
  4044. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4045. LEFT JOIN RMS_SALER R_SALER
  4046. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  4047. where a_s_order.SALE_ORDER_STATUS in (2,4)
  4048. and a_s_order.DELETED = 1
  4049. and a_s_order.SALE_TYPE = 1
  4050. <if test="con != null">
  4051. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  4052. </if>
  4053. <if test="saler != null" >
  4054. and R_SALER.SALER_NAME = #{saler}
  4055. </if>
  4056. <if test="oneDate != null">
  4057. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4058. </if>
  4059. <if test="startDate != null">
  4060. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4061. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  4062. </if>
  4063. <if test="consigneeSsoId != null">
  4064. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4065. </if>
  4066. ORDER BY a_s_order.UPDATE_TIME DESC
  4067. )
  4068. <where>
  4069. <if test="saleNumber != null">
  4070. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4071. "saleNumber" like '%${item}%'
  4072. </foreach>
  4073. </if>
  4074. <if test="materialName != null">
  4075. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4076. "materialName" like '%${item}%'
  4077. </foreach>
  4078. </if>
  4079. <if test="materialSpecification != null">
  4080. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4081. "materialSpecification" like '%${item}%'
  4082. </foreach>
  4083. </if>
  4084. <if test="materialModel != null">
  4085. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4086. "materialModel" like '%${item}%'
  4087. </foreach>
  4088. </if>
  4089. <if test="statusStr != null">
  4090. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4091. and "statusStr" like '%${item}%'
  4092. </foreach>
  4093. </if>
  4094. <!-- <if test="startTime != null">-->
  4095. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4096. <!-- </if>-->
  4097. <!-- <if test="endTime != null">-->
  4098. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4099. <!-- </if>-->
  4100. <if test="shipperName != null">
  4101. and
  4102. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4103. "shipperName" like '%${item}%'
  4104. </foreach>
  4105. </if>
  4106. <if test="consigneeCompanyName != null">
  4107. and
  4108. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4109. "consigneeCompanyName" like '%${item}%'
  4110. </foreach>
  4111. </if>
  4112. <if test="consigneeWarrantyAmount != null">
  4113. and
  4114. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4115. "consigneeWarrantyAmount" like '%${item}%'
  4116. </foreach>
  4117. </if>
  4118. <if test="consigneeWarrantyWeight != null">
  4119. and
  4120. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4121. "consigneeWarrantyWeight" like '%${item}%'
  4122. </foreach>
  4123. </if>
  4124. <if test="saleOrderIsselfMention != null">
  4125. and
  4126. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4127. "saleOrderIsselfMention" like '%${item}%'
  4128. </foreach>
  4129. </if>
  4130. <if test="saleAccountBalance != null">
  4131. and
  4132. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4133. "saleAccountBalance" like '%${item}%'
  4134. </foreach>
  4135. </if>
  4136. <if test="saleCurrentOrderAmount != null">
  4137. and
  4138. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4139. "saleCurrentOrderAmount" like '%${item}%'
  4140. </foreach>
  4141. </if>
  4142. <if test="saleHistoricalOrderAmout != null">
  4143. and
  4144. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4145. "saleHistoricalOrderAmout" like '%${item}%'
  4146. </foreach>
  4147. </if>
  4148. <if test="saleOrderReceiveCustomer != null">
  4149. and
  4150. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4151. "saleOrderReceiveCustomer" like '%${item}%'
  4152. </foreach>
  4153. </if>
  4154. <if test="saleUnitPrice != null">
  4155. and
  4156. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4157. "saleUnitPrice" like '%${item}%'
  4158. </foreach>
  4159. </if>
  4160. <if test="saleOrderTax != null">
  4161. and
  4162. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4163. "saleOrderTax" like '%${item}%'
  4164. </foreach>
  4165. </if>
  4166. <if test="saleRemark != null">
  4167. and
  4168. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4169. "saleRemark" like '%${item}%'
  4170. </foreach>
  4171. </if>
  4172. </where>
  4173. </select>
  4174. <select id="getAllSteelSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map" >
  4175. select * from(
  4176. select a_s_order.SALE_ORDER_ID "saleOrderId",
  4177. a_s_order.SALE_NUMBER "saleNumber",
  4178. r_shipper.SHIPPER_NAME "shipperName",
  4179. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  4180. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  4181. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  4182. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  4183. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  4184. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4185. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4186. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4187. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4188. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4189. a_s_order.SALE_REMARK "saleRemark",
  4190. a_s_order.INSERT_TIME "insertTime",
  4191. DECODE(a_s_order.SALE_ORDER_STATUS || a_s_order.DELETED,00,'未上传',10,'已上传',20,'销售已提交',40,'财务已审批',21,'反审核',41,'反审核',22,'已关闭',42,'已关闭') "statusStr",
  4192. RM.MATERIAL_NAME "materialName",
  4193. RM.MATERIAL_SPECIFICATION "materialSpecification",
  4194. RM.MATERIAL_MODEL "materialModel",
  4195. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  4196. ASM.SALE_WAREHOUSE "saleWareHouse"
  4197. from AMS_SALE_ORDER a_s_order
  4198. left join RMS_SHIPPER r_shipper
  4199. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4200. left join RMS_CONSIGNEE r_consignee
  4201. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4202. LEFT JOIN AMS_SALE_MATERIAL ASM
  4203. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4204. LEFT JOIN RMS_MATERIAL RM
  4205. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4206. where a_s_order.CLOSE_STATUS is null
  4207. and a_s_order.DELETED = 0
  4208. <if test="con != null">
  4209. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  4210. </if>
  4211. <if test="shipperId != null">
  4212. and a_s_order.SHIPPER_ID = #{shipperId}
  4213. </if>
  4214. <if test="saleType != null">
  4215. and a_s_order.SALE_TYPE = #{saleType}
  4216. </if>
  4217. <if test="saleType == null">
  4218. and a_s_order.SALE_TYPE is null
  4219. </if>
  4220. <if test="consigneeSsoId != null">
  4221. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4222. </if>
  4223. ORDER BY a_s_order.UPDATE_TIME DESC
  4224. )
  4225. <where>
  4226. <if test="saleNumber != null">
  4227. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4228. "saleNumber" like '%${item}%'
  4229. </foreach>
  4230. </if>
  4231. <if test="materialName != null">
  4232. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4233. "materialName" like '%${item}%'
  4234. </foreach>
  4235. </if>
  4236. <if test="materialSpecification != null">
  4237. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4238. "materialSpecification" like '%${item}%'
  4239. </foreach>
  4240. </if>
  4241. <if test="materialModel != null">
  4242. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4243. "materialModel" like '%${item}%'
  4244. </foreach>
  4245. </if>
  4246. <if test="statusStr != null">
  4247. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4248. and "statusStr" like '%${item}%'
  4249. </foreach>
  4250. </if>
  4251. <!-- <if test="startTime != null">-->
  4252. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4253. <!-- </if>-->
  4254. <!-- <if test="endTime != null">-->
  4255. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4256. <!-- </if>-->
  4257. <if test="shipperName != null">
  4258. and
  4259. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4260. "shipperName" like '%${item}%'
  4261. </foreach>
  4262. </if>
  4263. <if test="consigneeCompanyName != null">
  4264. and
  4265. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4266. "consigneeCompanyName" like '%${item}%'
  4267. </foreach>
  4268. </if>
  4269. <if test="consigneeWarrantyAmount != null">
  4270. and
  4271. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4272. "consigneeWarrantyAmount" like '%${item}%'
  4273. </foreach>
  4274. </if>
  4275. <if test="consigneeWarrantyWeight != null">
  4276. and
  4277. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4278. "consigneeWarrantyWeight" like '%${item}%'
  4279. </foreach>
  4280. </if>
  4281. <if test="saleOrderIsselfMention != null">
  4282. and
  4283. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4284. "saleOrderIsselfMention" like '%${item}%'
  4285. </foreach>
  4286. </if>
  4287. <if test="saleAccountBalance != null">
  4288. and
  4289. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4290. "saleAccountBalance" like '%${item}%'
  4291. </foreach>
  4292. </if>
  4293. <if test="saleCurrentOrderAmount != null">
  4294. and
  4295. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4296. "saleCurrentOrderAmount" like '%${item}%'
  4297. </foreach>
  4298. </if>
  4299. <if test="saleHistoricalOrderAmout != null">
  4300. and
  4301. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4302. "saleHistoricalOrderAmout" like '%${item}%'
  4303. </foreach>
  4304. </if>
  4305. <if test="saleOrderReceiveCustomer != null">
  4306. and
  4307. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4308. "saleOrderReceiveCustomer" like '%${item}%'
  4309. </foreach>
  4310. </if>
  4311. <if test="saleUnitPrice != null">
  4312. and
  4313. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4314. "saleUnitPrice" like '%${item}%'
  4315. </foreach>
  4316. </if>
  4317. <if test="saleOrderTax != null">
  4318. and
  4319. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4320. "saleOrderTax" like '%${item}%'
  4321. </foreach>
  4322. </if>
  4323. <if test="saleRemark != null">
  4324. and
  4325. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4326. "saleRemark" like '%${item}%'
  4327. </foreach>
  4328. </if>
  4329. </where>
  4330. </select>
  4331. <!-- 修改厂内未装货车辆的运单车牌号 -->
  4332. <update id="updateCapacityNumberInFactory" parameterType="java.util.Map" >
  4333. UPDATE OMSTRUCK_ORDER OO
  4334. SET OO.CAPACITY_ID = #{capacityId},
  4335. OO.CAPACITYIDS=#{capacityids},
  4336. OO.insert_update_remark = '修改车牌号'
  4337. WHERE OO.ORDER_ID = #{orderId}
  4338. </update>
  4339. <update id="bindSaleArea">
  4340. UPDATE RMS_CONSIGNEE RC
  4341. SET RC.AREA_ID = #{saleAreaId}
  4342. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4343. </update>
  4344. <select id="getCarrierByAddress" parameterType="DECIMAL" resultType="java.util.Map" >
  4345. SELECT DISTINCT ACTP.CARRIER_ID "carrierId"
  4346. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4347. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4348. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4349. WHERE
  4350. ACTP.CARRIER_ID IS NOT NULL
  4351. AND RRP.ADDRESS_ID = #{addressId}
  4352. and ACTP.DELETED = 0
  4353. </select>
  4354. <select id="getSaleCokeOrder" parameterType="java.util.Map" resultType="java.util.Map">
  4355. SELECT DISTINCT * FROM(
  4356. SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
  4357. a_s_order.SALE_NUMBER "saleNumber",
  4358. r_shipper.SHIPPER_NAME "shipperName",
  4359. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  4360. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  4361. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  4362. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  4363. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  4364. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4365. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4366. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4367. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4368. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4369. a_s_order.SALE_REMARK "saleRemark",
  4370. a_s_order.INSERT_TIME "insertTime",
  4371. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  4372. RM.MATERIAL_NAME "materialName",
  4373. ASM.MATERIAL_NUMBER "materialNumber",
  4374. ASM.SALE_WAREHOUSE "saleWareHouse",
  4375. a_s_order.DELETED "deleted",
  4376. a_s_order.SHIPPER_ID "shipperId",
  4377. a_s_order.RECEIVE_ID "receiveId",
  4378. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention"
  4379. from AMS_SALE_ORDER a_s_order
  4380. left join RMS_SHIPPER r_shipper
  4381. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4382. left join RMS_CONSIGNEE r_consignee
  4383. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4384. LEFT JOIN AMS_SALE_MATERIAL ASM
  4385. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4386. LEFT JOIN RMS_MATERIAL RM
  4387. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4388. where a_s_order.SALE_ORDER_STATUS in (2,4)
  4389. and a_s_order.CLOSE_STATUS is null
  4390. and a_s_order.DELETED = 0
  4391. and ASM.DELETED IS NULL
  4392. <if test="con != null">
  4393. 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 )
  4394. </if>
  4395. <if test="oneDate != null">
  4396. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4397. </if>
  4398. <if test="startDate != null">
  4399. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4400. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  4401. </if>
  4402. <if test="shipperId != null">
  4403. and a_s_order.SHIPPER_ID = #{shipperId}
  4404. </if>
  4405. <if test="consigneeSsoId != null">
  4406. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4407. </if>
  4408. <if test="saleType == null">
  4409. and a_s_order.SALE_TYPE is null
  4410. </if>
  4411. ORDER BY a_s_order.UPDATE_TIME DESC
  4412. )
  4413. <where>
  4414. <if test="saleNumber != null">
  4415. and
  4416. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4417. "saleNumber" like '%${item}%'
  4418. </foreach>
  4419. </if>
  4420. <if test="saleWareHouse != null">
  4421. and
  4422. <foreach collection="saleWareHouse" item="item" open="(" separator="or" close=")">
  4423. "saleWareHouse" like '%${item}%'
  4424. </foreach>
  4425. </if>
  4426. <if test="materialName != null">
  4427. and
  4428. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4429. "materialName" like '%${item}%'
  4430. </foreach>
  4431. </if>
  4432. <if test="materialSpecification != null">
  4433. and
  4434. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4435. "materialSpecification" like '%${item}%'
  4436. </foreach>
  4437. </if>
  4438. <if test="materialModel != null">
  4439. and
  4440. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4441. "materialModel" like '%${item}%'
  4442. </foreach>
  4443. </if>
  4444. <if test="statusStr != null">
  4445. and
  4446. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4447. "statusStr" like '%${item}%'
  4448. </foreach>
  4449. </if>
  4450. <!-- <if test="startTime != null">-->
  4451. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4452. <!-- </if>-->
  4453. <!-- <if test="endTime != null">-->
  4454. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4455. <!-- </if>-->
  4456. <if test="shipperName != null">
  4457. and
  4458. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4459. "shipperName" like '%${item}%'
  4460. </foreach>
  4461. </if>
  4462. <if test="consigneeCompanyName != null">
  4463. and
  4464. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4465. "consigneeCompanyName" like '%${item}%'
  4466. </foreach>
  4467. </if>
  4468. <if test="consigneeWarrantyAmount != null">
  4469. and
  4470. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4471. "consigneeWarrantyAmount" like '%${item}%'
  4472. </foreach>
  4473. </if>
  4474. <if test="consigneeWarrantyWeight != null">
  4475. and
  4476. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4477. "consigneeWarrantyWeight" like '%${item}%'
  4478. </foreach>
  4479. </if>
  4480. <if test="saleOrderIsselfMention != null">
  4481. and
  4482. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4483. "saleOrderIsselfMention" like '%${item}%'
  4484. </foreach>
  4485. </if>
  4486. <if test="saleAccountBalance != null">
  4487. and
  4488. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4489. "saleAccountBalance" like '%${item}%'
  4490. </foreach>
  4491. </if>
  4492. <if test="saleCurrentOrderAmount != null">
  4493. and
  4494. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4495. "saleCurrentOrderAmount" like '%${item}%'
  4496. </foreach>
  4497. </if>
  4498. <if test="saleHistoricalOrderAmout != null">
  4499. and
  4500. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4501. "saleHistoricalOrderAmout" like '%${item}%'
  4502. </foreach>
  4503. </if>
  4504. <if test="saleOrderReceiveCustomer != null">
  4505. and
  4506. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4507. "saleOrderReceiveCustomer" like '%${item}%'
  4508. </foreach>
  4509. </if>
  4510. <if test="saleUnitPrice != null">
  4511. and
  4512. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4513. "saleUnitPrice" like '%${item}%'
  4514. </foreach>
  4515. </if>
  4516. <if test="saleOrderTax != null">
  4517. and
  4518. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4519. "saleOrderTax" like '%${item}%'
  4520. </foreach>
  4521. </if>
  4522. <if test="saleRemark != null">
  4523. and
  4524. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4525. "saleRemark" like '%${item}%'
  4526. </foreach>
  4527. </if>
  4528. </where>
  4529. </select>
  4530. <select id="findStatus" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4531. SELECT ASO.SALE_ORDER_STATUS AS "saleStatus"
  4532. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4533. LEFT JOIN AMS_SALE_ORDER ASO
  4534. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4535. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4536. </select>
  4537. <select id="getPlaceId" parameterType="DECIMAL" resultType="DECIMAL" >
  4538. SELECT ASOM.SALE_SHIPPING_ADDRESS_ID "placeId"
  4539. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4540. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4541. </select>
  4542. <select id="getAddressPriceList" parameterType="java.util.Map" resultType="java.util.Map" >
  4543. SELECT ACTP.PRICE_ID AS "priceId"
  4544. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4545. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4546. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4547. WHERE ACTP.CARRIER_ID = #{carrierId}
  4548. AND RRP.ADDRESS_ID = #{addressId}
  4549. AND ACTP.DELETED = 0
  4550. ORDER BY ACTP.OLD_DATE DESC
  4551. NULLS LAST
  4552. </select>
  4553. <select id="findSelfMention" parameterType="DECIMAL" resultType="java.lang.String" >
  4554. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "selfMention"
  4555. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4556. LEFT JOIN AMS_SALE_ORDER ASO
  4557. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4558. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4559. </select>
  4560. <select id="findReceiveId" parameterType="java.lang.String" resultType="DECIMAL" >
  4561. SELECT RC.CONSIGNEE_ID AS "receiveId"
  4562. FROM RMS_CONSIGNEE RC
  4563. WHERE RC.CONSIGNEE_COMPANY_NAME = #{receiveName}
  4564. AND RC.CONSIGNEE_CODE IS NOT NULL
  4565. AND RC.EAS_CONSIGNEE_ID IS NOT NULL
  4566. </select>
  4567. <select id="findSalerId" parameterType="java.lang.String" resultType="DECIMAL" >
  4568. SELECT RS.SALER_ID AS "salerId"
  4569. FROM RMS_SALER RS
  4570. WHERE RS.SALER_NAME = #{salerName}
  4571. </select>
  4572. <select id="findMaterialId" parameterType="java.util.Map" resultType="DECIMAL">
  4573. SELECT RM.MATERIAL_ID AS "materialId"
  4574. FROM RMS_MATERIAL RM
  4575. WHERE RM.MATERIAL_NAME = #{name}
  4576. AND RM.MATERIAL_SPECIFICATION = #{specification}
  4577. <if test="model != null">
  4578. AND RM.MATERIAL_MODEL = #{model}
  4579. </if>
  4580. </select>
  4581. <select id="findAddressId" parameterType="java.util.Map" resultType="DECIMAL" >
  4582. SELECT RRA.ADDRESS_ID AS "addressId"
  4583. FROM RMS_RECEIVE_ADDRESS RRA
  4584. WHERE RRA.ADDRESS_PROVINCE = #{province}
  4585. AND RRA.ADDRESS_DISTRICT = #{district}
  4586. AND RRA.ADDRESS_TOWN = #{town}
  4587. </select>
  4588. <select id="getSaleMaterialMessage" parameterType="DECIMAL" resultType="java.util.Map" >
  4589. SELECT ASM.MATERIAL_ID "materialId",
  4590. OO.ORDER_ID "orderId",
  4591. TTR.RESULT_TOTAL_ID "resultTotalId",
  4592. OO.ORDER_STATUS "orderStatus",
  4593. WOR.RESULT_ID "outBoundId",
  4594. ASM.MATERIAL_NUMBER "materialNumber"
  4595. FROM AMS_SALE_MATERIAL ASM
  4596. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4597. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  4598. LEFT JOIN OMSTRUCK_ORDER OO
  4599. ON ASTM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4600. AND OO.ORDER_TYPE in (1,4)
  4601. LEFT JOIN WMSP_OUTBOUND_RESULT WOR
  4602. ON WOR.BILL_LADING_ID = OO.ORDER_ID
  4603. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4604. ON TTR.ORDER_ID = OO.ORDER_ID
  4605. WHERE ASM.SALE_MATERIAL_ID = #{saleMaterialId}
  4606. </select>
  4607. <select id="findOrderMaxNum" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4608. SELECT MAx(TLFR.SEGMENT_SQE)
  4609. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  4610. WHERE TLFR.RESULT_TOTAL_ID = #{resultTotalId}
  4611. </select>
  4612. <select id="getKucunList" resultType="java.util.Map" parameterType="java.util.Map">
  4613. SELECT * FROM (
  4614. SELECT ASO.SALE_NUMBER "saleNo", ASO.SALE_REMARK "saleRemark",
  4615. RAS1.ARRIVAL_NAME "sendStation",
  4616. RAS.ARRIVAL_NAME "toTheStation",
  4617. RM.MATERIAL_NAME "materialName",
  4618. RM.MATERIAL_SPECIFICATION||'('||RM.MATERIAL_MODEL||')' "materialSpa",
  4619. ASM.MATERIAL_NUMBER "materialNum",
  4620. ASM.MATERIAL_WEIGHT "materialWeight",
  4621. RDOINDEP.ORG_NAME "transInDep",
  4622. RDOOUTDEP.ORG_NAME "transOutDep",
  4623. RISWINOF.INWARD_WAREHOUSE_NAME "transInWarehouse",
  4624. RC.CONSIGNEE_COMPANY_NAME "receiveName",
  4625. ASO.SALE_ORDER_ID "saleOrderId",
  4626. RAS1.ARRIVAL_ID "sendStationId",
  4627. RAS.ARRIVAL_ID "toTheStationId",
  4628. ASM.IS_POUND_SALE "isPoundSale",
  4629. ASM.SALE_MATERIAL_ID "saleMaterialId",
  4630. ASM.EAS_PRIMARY_ID "flId",
  4631. TPAR.RESULT_ID "approveId",
  4632. TPAR.UPDATE_USERNAME "sendStationOptionName",
  4633. ASO.UPDATE_USERNAME "consigneeOptionName",
  4634. SW."sumWeight" "sumWeight",
  4635. (case
  4636. WHEN RM.MATERIAL_NAME LIKE '%螺纹钢%'
  4637. THEN 1
  4638. ELSE 0
  4639. end) AS "weight",
  4640. (CASE
  4641. WHEN ASO.DELETED IN (1,2)
  4642. THEN '关闭'
  4643. ELSE '正常'
  4644. END) "saleOrderStatus",
  4645. (CASE WHEN
  4646. TWR.RESULT_NET_WEIGHT IS NOT NULL
  4647. THEN '已出库'
  4648. ELSE
  4649. '未出库'
  4650. END) "netWeightStatus"
  4651. FROM AMS_SALE_ORDER ASO
  4652. LEFT JOIN AMS_SALE_MATERIAL ASM
  4653. ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  4654. LEFT JOIN RMS_MATERIAL RM
  4655. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4656. LEFT JOIN TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
  4657. ON TPAR.RAIL_PLAN_ID = ASM.SALE_MATERIAL_ID
  4658. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
  4659. ON RAS.ARRIVAL_ID = TPAR.TO_THE_STATION_ID
  4660. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS1
  4661. ON RAS1.ARRIVAL_ID = TPAR.SEND_STATION_ID
  4662. LEFT JOIN RMS_CONSIGNEE RC
  4663. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  4664. LEFT JOIN RMS_DEP_ORG RDOINDEP
  4665. ON RDOINDEP.ORG_CODE = ASO.TRANSFER_IN_DEP
  4666. LEFT JOIN RMS_DEP_ORG RDOOUTDEP
  4667. ON RDOOUTDEP.ORG_CODE = ASO.TRANSFER_OUT_DEP
  4668. LEFT JOIN RMS_INWARD_STEEL_WAREHOUSE RISWINOF
  4669. ON RISWINOF.INWARD_WAREHOUSE_CODE = ASM.TRANSFER_IN_OF_WAREHOUSE
  4670. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  4671. ON TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_ID
  4672. LEFT JOIN (
  4673. SELECT "saleNo",
  4674. SUM("weight") "sumWeight"
  4675. FROM
  4676. (
  4677. SELECT ASO.SALE_NUMBER "saleNo",
  4678. ASM.SALE_MATERIAL_ID "saleMaterialId",
  4679. (case
  4680. WHEN RM.MATERIAL_NAME LIKE '%螺纹钢%'
  4681. THEN 1
  4682. ELSE 0
  4683. end) AS "weight"
  4684. FROM AMS_SALE_ORDER ASO
  4685. LEFT JOIN AMS_SALE_MATERIAL ASM
  4686. ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  4687. LEFT JOIN RMS_MATERIAL RM
  4688. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4689. WHERE
  4690. ASO.SALE_TYPE = 4
  4691. and asm.DELETED is null
  4692. and asm.SALE_ORDER_ID != -1
  4693. and aso.SALE_ORDER_STATUS = 4
  4694. <if test="oneDate != null">
  4695. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  4696. </if>
  4697. <if test="startDate != null">
  4698. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  4699. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  4700. </if>
  4701. <if test="remark != null">
  4702. and ASO.SALE_REMARK||RM.MATERIAL_NAME LIKE #{remark}
  4703. </if>
  4704. )
  4705. GROUP BY "saleNo"
  4706. ) SW ON SW."saleNo" = ASO.SALE_NUMBER
  4707. WHERE ASO.SALE_TYPE = 4
  4708. and asm.DELETED is null
  4709. and asm.SALE_ORDER_ID != -1
  4710. and aso.SALE_ORDER_STATUS = 4
  4711. <if test="oneDate != null">
  4712. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  4713. </if>
  4714. <if test="startDate != null">
  4715. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  4716. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  4717. </if>
  4718. <if test="remark != null">
  4719. and ASO.SALE_REMARK||RM.MATERIAL_NAME LIKE #{remark}
  4720. </if>
  4721. <if test="totheStation != null">
  4722. and RAS.ARRIVAL_NAME LIKE #{totheStation}
  4723. </if>
  4724. <if test="consigneeName != null">
  4725. and RC.CONSIGNEE_COMPANY_NAME like #{consigneeName}
  4726. </if>
  4727. <if test="transferIndep != null">
  4728. and RDOINDEP.ORG_NAME LIKE #{transferIndep}
  4729. </if>
  4730. <if test="materialName != null">
  4731. and RM.MATERIAL_NAME LIKE '%${materialName}%'
  4732. </if>
  4733. <if test="materialSpa != null">
  4734. and RM.MATERIAL_SPECIFICATION||'('||RM.MATERIAL_MODEL||')' LIKE '%${materialSpa}%'
  4735. </if>
  4736. <if test="sendStation != null">
  4737. and RAS1.ARRIVAL_NAME LIKE '%${sendStation}%'
  4738. </if>
  4739. )
  4740. ORDER BY "sumWeight" DESC,"saleNo","weight" DESC
  4741. </select>
  4742. <select id="selectSaleAreaId" resultType="java.math.BigDecimal" parameterType="decimal">
  4743. SELECT RC.AREA_ID AS "areaId"
  4744. FROM RMS_CONSIGNEE RC
  4745. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4746. </select>
  4747. <select id="selectSaleAreaIdByName" resultType="java.math.BigDecimal" parameterType="string">
  4748. SELECT RSA.AREA_ID FROM RMS_SALE_AREA RSA
  4749. WHERE RSA.AREA_NAME = #{saleAreaName}
  4750. </select>
  4751. <select id="getMoreCarrier" resultType="java.math.BigDecimal" parameterType="string">
  4752. SELECT count(RMCP.CARRIER_PLACE_ID) FROM RMS_MORE_CARRIER_PLACE RMCP
  4753. WHERE #{place} LIKE '%' || RMCP.CARRIER_PLACE_VALUE || '%'
  4754. </select>
  4755. <select id="getOrderIdByCapacity" resultType="java.util.Map">
  4756. select OO.order_ID "orderId",
  4757. RC.CAPACITY_NUMBER "capacityNumber",
  4758. TTR.RESULT_TOTAL_ID "resultTotalId",
  4759. TER.RESULT_ENTRY_GATE_TIME "isEn",
  4760. TLFR.RESULT_OUT_GATE_TIME "isLeave",
  4761. TAR.RESULT_ID "isArrival",
  4762. TRR.RESULT_ID "isReceipt"
  4763. from OMSTRUCK_ORDER OO
  4764. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID =RC.CAPACITY_ID
  4765. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID=OO.ORDER_ID
  4766. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER ON TER.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4767. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR ON TLFR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4768. LEFT JOIN TMSTRUCK_ARRIVAL_RESULT TAR ON TAR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4769. LEFT JOIN TMSTRUCK_RECEIPT_RESULT TRR ON TRR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4770. where RC.CAPACITY_NUMBER=#{capacityNumber} and OO.order_status=5
  4771. fetch next 1 rows only
  4772. </select>
  4773. <select id="getOrderMes" resultType="java.util.Map" parameterType="java.util.Map">
  4774. SELECT TTR.RESULT_TOTAL_ID "resultTotalId",
  4775. OO.ORDER_STATUS "orderStatus"
  4776. FROM OMSTRUCK_ORDER OO
  4777. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4778. ON TTR.ORDER_ID = OO.ORDER_ID
  4779. WHERE OO.ORDER_ID = #{orderId}
  4780. </select>
  4781. <select id="getId" resultType="java.math.BigDecimal">
  4782. select ASOM.SALE_ORDER_MATERIAL_ID "saleodermatetialid"
  4783. from AMS_SALE_ORDER_MATERIAL ASOM
  4784. LEFT JOIN AMS_SALE_ORDER ASO
  4785. ON ASO.SALE_ORDER_ID= ASOM.SALE_ORDER_ID
  4786. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4787. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  4788. LEFT JOIN AMS_SALE_MATERIAL ASM
  4789. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  4790. where ASO.sale_number=#{saleOrderNo}
  4791. and ASM.SALE_MATERIAL_ID =#{saleMaterialId}
  4792. </select>
  4793. <update id="updateForTel">
  4794. update AMS_SALE_ORDER_MATERIAL ASOM
  4795. set ASOM.SALE_ORDER_CONSIGNEE_TEL=#{consigneeTel}
  4796. WHERE ASOM.SALE_ORDER_MATERIAL_ID=#{saleodermatetialid}
  4797. </update>
  4798. <update id="updateSaleOrderStatus">
  4799. update AMS_SALE_ORDER ASO
  4800. set aso.DELETED = 2,
  4801. INSERT_UPDATE_REMARK = '查询金蝶销售订单状态,物流同步关闭'
  4802. WHERE ASO.SALE_NUMBER = #{saleNumber}
  4803. </update>
  4804. <select id="getDispachSwitch" resultType="java.lang.Integer">
  4805. SELECT IS_OK "isOk" FROM AMS_DISPATCH_SWITCH
  4806. fetch NEXT 1 rows only
  4807. </select>
  4808. <select id="getSteelOrderMap" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  4809. SELECT OO.ORDER_ID FROM OMSTRUCK_ORDER OO
  4810. WHERE OO.ORDER_PLAN_ID = #{saleOrderMaterialId}
  4811. AND OO.ORDER_TYPE = 1
  4812. </select>
  4813. <update id="updateAMSDeleted">
  4814. update AMS_SALE_MATERIAL ASM
  4815. set ASM.DELETED = 0,
  4816. ASM.INSERT_UPDATE_REMARK = '继续装关闭分录'
  4817. where ASM.SALE_MATERIAL_ID=#{closeWlEntryId}
  4818. </update>
  4819. <update id="updateOldSaleOrderUpload" parameterType="java.math.BigDecimal">
  4820. update AMS_SALE_ORDER ASO
  4821. SET ASO.INSERT_UPDATE_REMARK = '物流上传金蝶成功'
  4822. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  4823. </update>
  4824. <update id="updateOldSaleOrderUploadByNo">
  4825. update AMS_SALE_ORDER ASO
  4826. SET ASO.INSERT_UPDATE_REMARK = '物流上传金蝶成功'
  4827. WHERE ASO.SALE_NUMBER = #{saleOrderNo}
  4828. </update>
  4829. <delete id="delectQueueS">
  4830. delete from QMS_QUEUE_LIST qql
  4831. where qql.LIST_ID=#{capacityIdM}
  4832. </delete>
  4833. <select id="queueSingle" resultType="java.math.BigDecimal">
  4834. select qql.LIST_ID
  4835. from OMSTRUCK_ORDER oo
  4836. LEFT JOIN QMS_QUEUE_LIST qql
  4837. on qql.capacity_id=oo.capacity_id
  4838. where oo.order_id=#{orderId}
  4839. </select>
  4840. <select id="isGPS" resultType="java.lang.Integer">
  4841. SELECT count(*) FROM RMS_CAPACITY WHERE CAPACITY_NUMBER=#{capacityNumber} and CAPACITY_GPS='是'
  4842. </select>
  4843. <select id="getEasPrimaryIds" resultType="string" parameterType="map">
  4844. SELECT distinct EAS_PRIMARY_ID FROM OMSTRUCK_ORDER OO
  4845. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  4846. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4847. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4848. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  4849. LEFT JOIN AMS_SALE_MATERIAL ASM
  4850. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  4851. LEFT JOIN TMSTRUCK_WEIGHT_BATCH TWB
  4852. on TWB.WEIGHT_BATCH_ID = ASM.WEIGHT_BATCH_ID
  4853. where NVL(ASM.DELETED,0) = 0
  4854. AND TWB.BATCH_NET_WEIGHT IS NOT NULL
  4855. AND TWB.BATCH_GROSS_WEIGHT_TIME IS NOT NULL
  4856. AND ASM.EAS_PRIMARY_ID IS NOT NULL
  4857. AND OO.ORDER_TYPE = 1
  4858. AND OO.ORDER_STATUS IN (2,5)
  4859. <if test="easPrimaryList != null and easPrimaryList.size > 0">
  4860. and <foreach collection="easPrimaryList" item="item" open="(" separator="or" close=")">
  4861. ASM.EAS_PRIMARY_ID LIKE '%${item}%'
  4862. </foreach>
  4863. </if>
  4864. <if test="easPrimaryList == null">
  4865. and TWB.BATCH_GROSS_WEIGHT_TIME + 2 > sysdate
  4866. ORDER BY TWB.BATCH_GROSS_WEIGHT_TIME desc
  4867. FETCH NEXT 50000 ROWS ONLY
  4868. </if>
  4869. </select>
  4870. <select id="getNextCarrier" resultType="java.util.Map" parameterType="java.lang.Integer">
  4871. select adso.CARRIER_ID "carrierId" from AMS_SALE_ORDER_MATERIAL asom
  4872. left join RMS_RECEIVE_PLACE rrp
  4873. on rrp.PLACE_ID = asom.SALE_SHIPPING_ADDRESS_ID
  4874. left join AMS_DISPATCH_SALE_ORDER adso
  4875. on adso.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
  4876. left join rms_carrier rc
  4877. on rc.CARRIER_ID = adso.CARRIER_ID
  4878. where rrp.ADDRESS_ID = #{addressId}
  4879. and rc.CARRIER_TYPE = '销售钢材承运商'
  4880. and (rrp.ADDRESS_ID in (500105,500101,500154) and rrp.ADDRESS_DELIVERY_ADDRESS not like '%库%' OR rrp.ADDRESS_ID NOT IN ( 500105, 500101, 500154 ) )
  4881. order by asom.SALE_ORDER_MATERIAL_ID desc
  4882. fetch first 1 row only
  4883. </select>
  4884. <select id="getPriceIdByPlaceId" resultType="java.math.BigDecimal" parameterType="java.math.BigDecimal">
  4885. SELECT ACTP.PRICE_ID FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4886. WHERE ACTP.TYPE = 1
  4887. and ACTP.DELETED = 0
  4888. AND ACTP.PLACE_ID = #{placeId}
  4889. fetch first 1 row only
  4890. </select>
  4891. <select id="isBlackList" resultType="java.lang.Integer">
  4892. SELECT count(CAPACITY_ID)
  4893. FROM RMS_CAPACITY
  4894. WHERE CAPACITY_NUMBER=#{capacityNumber} AND CAPACITY_BLACKLIST='是'
  4895. </select>
  4896. <select id="selectSaleGroupCode" resultType="java.lang.String" parameterType="string">
  4897. SELECT RSA.AREA_CODE FROM RMS_SALE_AREA RSA
  4898. WHERE RSA.AREA_NAME = #{saleGroup}
  4899. </select>
  4900. <select id="selectOutFactoryResult" resultType="java.lang.Integer">
  4901. SELECT COUNT(TLFR.RESULT_OUT_GATE_TIME) FROM OMSTRUCK_ORDER OO
  4902. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
  4903. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  4904. WHERE OO.ORDER_NUMBER = #{orderNo}
  4905. AND TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  4906. ORDER BY OO.ORDER_ID DESC
  4907. </select>
  4908. <select id="getSaleOrderTime" resultType="java.util.Date" parameterType="decimal">
  4909. SELECT INSERT_TIME FROM AMS_SALE_ORDER
  4910. WHERE SALE_ORDER_ID = #{saleOrderId}
  4911. </select>
  4912. <select id="getSaleOrderIds" resultType="java.math.BigDecimal">
  4913. SELECT SALE_ORDER_ID FROM AMS_SALE_ORDER
  4914. WHERE SALE_TYPE = 4
  4915. </select>
  4916. <select id="getSaleOrderId" resultType="java.math.BigDecimal" parameterType="string">
  4917. SELECT SALE_ORDER_ID FROM AMS_SALE_ORDER
  4918. WHERE SALE_NUMBER = #{saleNumber}
  4919. </select>
  4920. <select id="getSaleOrderIdByASOM" resultType="java.math.BigDecimal" parameterType="decimal">
  4921. SELECT SALE_ORDER_ID FROM AMS_SALE_ORDER_MATERIAL
  4922. WHERE SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4923. </select>
  4924. </mapper>