AmsSaleOrderMapper.xml 188 KB

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