AmsSaleOrderMapper.xml 187 KB

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