AmsSaleOrderMapper.xml 169 KB

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