AmsSaleOrderMapper.xml 169 KB

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