AmsSaleOrderMapper.xml 171 KB

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