AmsSaleOrderMapper.xml 188 KB

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