AmsSaleOrderMapper.xml 190 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585
  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.INSERT_UPDATE_REMARK like #{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 ASM.DELETED IS NULL
  1933. and ASM.SALE_MATERIAL_ID IS NOT 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.INSERT_UPDATE_REMARK like #{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. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2481. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2482. </select>
  2483. <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
  2484. SELECT RRP.ADDRESS_ID AS "adddressId"
  2485. FROM RMS_RECEIVE_PLACE RRP
  2486. WHERE RRP.PLACE_ID = #{placeId}
  2487. </select>
  2488. <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
  2489. SELECT DISTINCT RC.CARRIER_ID AS "id",
  2490. RC.CARRIER_ID AS "value",
  2491. RC.CARRIER_NAME AS "label",
  2492. ACTP.PRICE_ID AS "priceId",
  2493. ACTP.PRICE_VALUE AS "priceValue"
  2494. FROM RMS_RECEIVE_PLACE RRP
  2495. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2496. ON ACTP.PLACE_ID = RRP.PLACE_ID
  2497. LEFT JOIN RMS_CARRIER RC
  2498. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  2499. WHERE RRP.PLACE_ID = #{placeId}
  2500. AND ACTP.CARRIER_ID IS NOT NULL
  2501. AND ACTP.DELETED = 0
  2502. ORDER BY ACTP.PRICE_VALUE DESC
  2503. </select>
  2504. <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
  2505. SELECT ACTP.PRICE_ID AS "priceId",
  2506. ACTP.PRICE_VALUE AS "priceValue"
  2507. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2508. WHERE ACTP.CARRIER_ID = #{carrierId}
  2509. AND ACTP.PLACE_ID = #{placeId}
  2510. AND ACTP.DELETED = 0
  2511. </select>
  2512. <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
  2513. SELECT * FROM (
  2514. select DISTINCT * from(
  2515. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2516. a_s_order.SALE_NUMBER "saleNumber",
  2517. r_shipper.SHIPPER_NAME "shipperName",
  2518. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2519. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2520. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2521. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2522. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2523. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2524. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2525. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2526. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2527. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2528. a_s_order.SALE_REMARK "saleRemark",
  2529. a_s_order.INSERT_TIME "insertTime",
  2530. DECODE(a_s_order.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr",
  2531. a_s_order.UPDATE_TIME "updateTime",
  2532. RM.MATERIAL_NAME "materialName",
  2533. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2534. RM.MATERIAL_MODEL "materialModel",
  2535. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  2536. ASM.MATERIAL_NUMBER "materialNumber",
  2537. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2538. from AMS_SALE_ORDER a_s_order
  2539. left join RMS_SHIPPER r_shipper
  2540. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2541. left join RMS_CONSIGNEE r_consignee
  2542. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2543. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2544. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2545. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2546. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2547. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2548. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2549. LEFT JOIN RMS_CARRIER RC
  2550. ON RC.CARRIER_ID = ADSO.CARRIER_ID
  2551. LEFT JOIN OMSTRUCK_ORDER OO
  2552. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2553. LEFT JOIN AMS_SALE_MATERIAL ASM
  2554. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2555. LEFT JOIN RMS_MATERIAL RM
  2556. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2557. where a_s_order.SALE_ORDER_STATUS in (1,2,4)
  2558. and a_s_order.CLOSE_STATUS is null
  2559. and a_s_order.DELETED = 0
  2560. and ADSO.DISPATCH_TYPE = 2
  2561. and OO.ORDER_ID IS NULL
  2562. AND ASM.DELETED IS NULL
  2563. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2564. <if test="oneDate != null">
  2565. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = a_s_order.INSERT_TIME
  2566. </if>
  2567. <if test="startDate != null">
  2568. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.INSERT_TIME
  2569. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.INSERT_TIME
  2570. </if>
  2571. <if test="carrierSsoId != null" >
  2572. and RC.CARRIER_SSO_ID = #{carrierSsoId}
  2573. </if>
  2574. ) "CARRIER"
  2575. <where>
  2576. <if test="con != null">
  2577. "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
  2578. </if>
  2579. </where>
  2580. )
  2581. <where>
  2582. <if test="saleNumber != null">
  2583. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2584. "saleNumber" like '%${item}%'
  2585. </foreach>
  2586. </if>
  2587. <if test="materialName != null">
  2588. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2589. "materialName" like '%${item}%'
  2590. </foreach>
  2591. </if>
  2592. <if test="materialSpecification != null">
  2593. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2594. "materialSpecification" like '%${item}%'
  2595. </foreach>
  2596. </if>
  2597. <if test="materialModel != null">
  2598. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2599. "materialModel" like '%${item}%'
  2600. </foreach>
  2601. </if>
  2602. <if test="shipperName != null">
  2603. and
  2604. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2605. "shipperName" like '%${item}%'
  2606. </foreach>
  2607. </if>
  2608. <if test="consigneeCompanyName != null">
  2609. and
  2610. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2611. "consigneeCompanyName" like '%${item}%'
  2612. </foreach>
  2613. </if>
  2614. <if test="consigneeWarrantyAmount != null">
  2615. and
  2616. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2617. "consigneeWarrantyAmount" like '%${item}%'
  2618. </foreach>
  2619. </if>
  2620. <if test="consigneeWarrantyWeight != null">
  2621. and
  2622. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2623. "consigneeWarrantyWeight" like '%${item}%'
  2624. </foreach>
  2625. </if>
  2626. <if test="saleOrderIsselfMention != null">
  2627. and
  2628. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2629. "saleOrderIsselfMention" like '%${item}%'
  2630. </foreach>
  2631. </if>
  2632. <if test="saleAccountBalance != null">
  2633. and
  2634. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2635. "saleAccountBalance" like '%${item}%'
  2636. </foreach>
  2637. </if>
  2638. <if test="saleCurrentOrderAmount != null">
  2639. and
  2640. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2641. "saleCurrentOrderAmount" like '%${item}%'
  2642. </foreach>
  2643. </if>
  2644. <if test="saleHistoricalOrderAmout != null">
  2645. and
  2646. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2647. "saleHistoricalOrderAmout" like '%${item}%'
  2648. </foreach>
  2649. </if>
  2650. <if test="saleOrderReceiveCustomer != null">
  2651. and
  2652. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2653. "saleOrderReceiveCustomer" like '%${item}%'
  2654. </foreach>
  2655. </if>
  2656. <if test="saleUnitPrice != null">
  2657. and
  2658. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2659. "saleUnitPrice" like '%${item}%'
  2660. </foreach>
  2661. </if>
  2662. <if test="saleOrderTax != null">
  2663. and
  2664. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2665. "saleOrderTax" like '%${item}%'
  2666. </foreach>
  2667. </if>
  2668. <if test="saleRemark != null">
  2669. and
  2670. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2671. "saleRemark" like '%${item}%'
  2672. </foreach>
  2673. </if>
  2674. </where>
  2675. order by "updateTime" DESC
  2676. </select>
  2677. <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
  2678. select * from(
  2679. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2680. a_s_order.SALE_NUMBER "saleNumber",
  2681. r_shipper.SHIPPER_NAME "shipperName",
  2682. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2683. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2684. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2685. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2686. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2687. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2688. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2689. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2690. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2691. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2692. a_s_order.SALE_REMARK "saleRemark",
  2693. a_s_order.INSERT_TIME "insertTime",
  2694. a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
  2695. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2696. RM.MATERIAL_NAME "materialName",
  2697. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2698. RM.MATERIAL_MODEL "materialModel",
  2699. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2700. from AMS_SALE_ORDER_CARRIER a_s_o_carrier
  2701. left join RMS_CARRIER r_carrier
  2702. on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
  2703. left join AMS_SALE_ORDER a_s_order
  2704. on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  2705. left join RMS_SHIPPER r_shipper
  2706. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2707. left join RMS_CONSIGNEE r_consignee
  2708. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2709. LEFT JOIN AMS_SALE_MATERIAL ASM
  2710. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2711. LEFT JOIN RMS_MATERIAL RM
  2712. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2713. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2714. and a_s_order.CLOSE_STATUS is null
  2715. and a_s_order.DELETED = 0
  2716. <if test="carrierSsoId != null">
  2717. and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
  2718. </if>
  2719. <if test="con != null">
  2720. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2721. </if>
  2722. )
  2723. <where>
  2724. <if test="saleNumber != null">
  2725. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2726. "saleNumber" like '%${item}%'
  2727. </foreach>
  2728. </if>
  2729. <if test="materialName != null">
  2730. and
  2731. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2732. "materialName" like '%${item}%'
  2733. </foreach>
  2734. </if>
  2735. <if test="materialSpecification != null">
  2736. and
  2737. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2738. "materialSpecification" like '%${item}%'
  2739. </foreach>
  2740. </if>
  2741. <if test="materialModel != null">
  2742. and
  2743. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2744. "materialModel" like '%${item}%'
  2745. </foreach>
  2746. </if>
  2747. <if test="shipperName != null">
  2748. and
  2749. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2750. "shipperName" like '%${item}%'
  2751. </foreach>
  2752. </if>
  2753. <if test="consigneeCompanyName != null">
  2754. and
  2755. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2756. "consigneeCompanyName" like '%${item}%'
  2757. </foreach>
  2758. </if>
  2759. <if test="consigneeWarrantyAmount != null">
  2760. and
  2761. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2762. "consigneeWarrantyAmount" like '%${item}%'
  2763. </foreach>
  2764. </if>
  2765. <if test="consigneeWarrantyWeight != null">
  2766. and
  2767. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2768. "consigneeWarrantyWeight" like '%${item}%'
  2769. </foreach>
  2770. </if>
  2771. <if test="saleOrderIsselfMention != null">
  2772. and
  2773. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2774. "saleOrderIsselfMention" like '%${item}%'
  2775. </foreach>
  2776. </if>
  2777. <if test="saleAccountBalance != null">
  2778. and
  2779. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2780. "saleAccountBalance" like '%${item}%'
  2781. </foreach>
  2782. </if>
  2783. <if test="saleCurrentOrderAmount != null">
  2784. and
  2785. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2786. "saleCurrentOrderAmount" like '%${item}%'
  2787. </foreach>
  2788. </if>
  2789. <if test="saleHistoricalOrderAmout != null">
  2790. and
  2791. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2792. "saleHistoricalOrderAmout" like '%${item}%'
  2793. </foreach>
  2794. </if>
  2795. <if test="saleOrderReceiveCustomer != null">
  2796. and
  2797. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2798. "saleOrderReceiveCustomer" like '%${item}%'
  2799. </foreach>
  2800. </if>
  2801. <if test="saleUnitPrice != null">
  2802. and
  2803. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2804. "saleUnitPrice" like '%${item}%'
  2805. </foreach>
  2806. </if>
  2807. <if test="saleOrderTax != null">
  2808. and
  2809. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2810. "saleOrderTax" like '%${item}%'
  2811. </foreach>
  2812. </if>
  2813. <if test="saleRemark != null">
  2814. and
  2815. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2816. "saleRemark" like '%${item}%'
  2817. </foreach>
  2818. </if>
  2819. </where>
  2820. <include refid="orderBy1"></include>
  2821. </select>
  2822. <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2823. SELECT *
  2824. FROM (
  2825. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2826. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2827. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2828. "addressDeliveryAddress",
  2829. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2830. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  2831. AS "approvalStatus",
  2832. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2833. RSH.SHIPPER_NAME AS "shipperName",
  2834. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2835. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2836. ASOM.INSERT_TIME AS "insertTime",
  2837. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2838. ASO.SALE_ORDER_ID AS "saleOrderId",
  2839. RM.MATERIAL_NAME AS "materialName",
  2840. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  2841. RM.MATERIAL_MODEL AS "materialModel",
  2842. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2843. ASM.MATERIAL_NUMBER AS "materialNumber",
  2844. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
  2845. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2846. LEFT JOIN AMS_SALE_ORDER ASO
  2847. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2848. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2849. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2850. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2851. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2852. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2853. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2854. LEFT JOIN RMS_SHIPPER RSH
  2855. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2856. LEFT JOIN RMS_CONSIGNEE RCO
  2857. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2858. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2859. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2860. LEFT JOIN AMS_SALE_MATERIAL ASM
  2861. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2862. LEFT JOIN RMS_MATERIAL RM
  2863. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2864. WHERE ASO.SALE_ORDER_STATUS IN (1,2,4)
  2865. AND ASOM.ISSUE_STATUS IS NULL
  2866. AND ADSO.CARRIER_ID IS NULL
  2867. AND ASO.DELETED = 0
  2868. AND ASM.DELETED IS NULL
  2869. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2870. <if test="oneDate != null">
  2871. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  2872. </if>
  2873. <if test="startDate != null">
  2874. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  2875. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  2876. </if>
  2877. <if test="con != null" >
  2878. AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
  2879. </if>
  2880. )
  2881. <where>
  2882. <if test="saleNumber != null">
  2883. and
  2884. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2885. "saleNumber" like '%${item}%'
  2886. </foreach>
  2887. </if>
  2888. <if test="materialName != null">
  2889. and
  2890. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2891. "materialName" like '%${item}%'
  2892. </foreach>
  2893. </if>
  2894. <if test="materialModel != null">
  2895. and
  2896. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2897. "materialModel" like '%${item}%'
  2898. </foreach>
  2899. </if>
  2900. <if test="materialSpecification != null">
  2901. and
  2902. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2903. "materialSpecification" like '%${item}%'
  2904. </foreach>
  2905. </if>
  2906. <if test="truckNo != null">
  2907. and
  2908. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2909. "truckNo" like '%${item}%'
  2910. </foreach>
  2911. </if>
  2912. <if test="addressDeliveryAddress != null">
  2913. and
  2914. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2915. "addressDeliveryAddress" like '%${item}%'
  2916. </foreach>
  2917. </if>
  2918. <if test="saleDateOfReceipt != null">
  2919. and
  2920. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2921. "saleDateOfReceipt" like '%${item}%'
  2922. </foreach>
  2923. </if>
  2924. <if test="saleOrderConsignee != null">
  2925. and
  2926. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2927. "saleOrderConsignee" like '%${item}%'
  2928. </foreach>
  2929. </if>
  2930. <if test="saleOrderConsigneeTel != null">
  2931. and
  2932. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2933. "saleOrderConsigneeTel" like '%${item}%'
  2934. </foreach>
  2935. </if>
  2936. <if test="shipperName != null">
  2937. and
  2938. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2939. "shipperName" like '%${item}%'
  2940. </foreach>
  2941. </if>
  2942. <if test="consigneeCompanyName != null">
  2943. and
  2944. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2945. "consigneeCompanyName" like '%${item}%'
  2946. </foreach>
  2947. </if>
  2948. <if test="isselfMention != null">
  2949. and
  2950. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2951. "isselfMention" like '%${item}%'
  2952. </foreach>
  2953. </if>
  2954. </where>
  2955. <include refid="orderBy"></include>
  2956. </select>
  2957. <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
  2958. SELECT
  2959. RM.MATERIAL_ID AS "materialId",
  2960. RM.MATERIAL_NAME AS "materialName",
  2961. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2962. RM.MATERIAL_CODE AS "materialCode",
  2963. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
  2964. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2965. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2966. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2967. LEFT JOIN AMS_SALE_MATERIAL ASM
  2968. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2969. LEFT JOIN RMS_MATERIAL RM
  2970. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2971. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2972. </select>
  2973. <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2974. SELECT * FROM(
  2975. SELECT DISTINCT *
  2976. FROM (
  2977. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2978. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2979. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2980. "addressDeliveryAddress",
  2981. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2982. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  2983. AS "approvalStatus",
  2984. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2985. RSH.SHIPPER_NAME AS "shipperName",
  2986. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2987. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2988. ASOM.INSERT_TIME AS "insertTime",
  2989. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2990. ASO.SALE_ORDER_ID AS "saleOrderId",
  2991. RCA.CARRIER_NAME AS "carrierName",
  2992. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  2993. RM.MATERIAL_NAME AS "materialName",
  2994. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  2995. RM.MATERIAL_MODEL AS "materialModel",
  2996. RM.MATERIAL_SPECIFICATION || MATERIAL_MODEL AS "specificationModel",
  2997. ASM.MATERIAL_NUMBER AS "materialNumber"
  2998. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2999. LEFT JOIN AMS_SALE_ORDER ASO
  3000. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3001. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3002. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3003. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3004. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3005. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3006. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3007. LEFT JOIN RMS_SHIPPER RSH
  3008. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3009. LEFT JOIN RMS_CONSIGNEE RCO
  3010. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3011. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3012. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3013. LEFT JOIN OMSTRUCK_ORDER OO
  3014. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3015. LEFT JOIN RMS_CARRIER RCA
  3016. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3017. LEFT JOIN AMS_SALE_MATERIAL ASM
  3018. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3019. LEFT JOIN RMS_MATERIAL RM
  3020. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3021. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  3022. AND ASOM.ISSUE_STATUS IS NULL
  3023. AND ADSO.DISPATCH_TYPE = 2
  3024. AND OO.ORDER_ID IS NULL
  3025. AND ASO.DELETED = 0
  3026. AND ASM.DELETED IS NULL
  3027. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  3028. <if test="oneDate != null">
  3029. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  3030. </if>
  3031. <if test="startDate != null">
  3032. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  3033. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  3034. </if>
  3035. ) "NOCAR"
  3036. <where>
  3037. <if test="con != null" >
  3038. "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
  3039. </if>
  3040. </where>
  3041. )
  3042. <where>
  3043. <if test="saleNumber != null">
  3044. and
  3045. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3046. "saleNumber" like '%${item}%'
  3047. </foreach>
  3048. </if>
  3049. <if test="materialName != null">
  3050. and
  3051. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3052. "materialName" like '%${item}%'
  3053. </foreach>
  3054. </if>
  3055. <if test="materialModel != null">
  3056. and
  3057. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3058. "materialModel" like '%${item}%'
  3059. </foreach>
  3060. </if>
  3061. <if test="materialSpecification != null">
  3062. and
  3063. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3064. "materialSpecification" like '%${item}%'
  3065. </foreach>
  3066. </if>
  3067. <if test="carrierName != null">
  3068. and
  3069. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3070. "carrierName" like '%${item}%'
  3071. </foreach>
  3072. </if>
  3073. <if test="truckNo != null">
  3074. and
  3075. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3076. "truckNo" like '%${item}%'
  3077. </foreach>
  3078. </if>
  3079. <if test="addressDeliveryAddress != null">
  3080. and
  3081. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3082. "addressDeliveryAddress" like '%${item}%'
  3083. </foreach>
  3084. </if>
  3085. <if test="saleDateOfReceipt != null">
  3086. and
  3087. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3088. "saleDateOfReceipt" like '%${item}%'
  3089. </foreach>
  3090. </if>
  3091. <if test="saleOrderConsignee != null">
  3092. and
  3093. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3094. "saleOrderConsignee" like '%${item}%'
  3095. </foreach>
  3096. </if>
  3097. <if test="saleOrderConsigneeTel != null">
  3098. and
  3099. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3100. "saleOrderConsigneeTel" like '%${item}%'
  3101. </foreach>
  3102. </if>
  3103. <if test="shipperName != null">
  3104. and
  3105. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3106. "shipperName" like '%${item}%'
  3107. </foreach>
  3108. </if>
  3109. <if test="consigneeCompanyName != null">
  3110. and
  3111. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3112. "consigneeCompanyName" like '%${item}%'
  3113. </foreach>
  3114. </if>
  3115. <if test="isselfMention != null">
  3116. and
  3117. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3118. "isselfMention" like '%${item}%'
  3119. </foreach>
  3120. </if>
  3121. </where>
  3122. <include refid="orderBy"></include>
  3123. </select>
  3124. <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
  3125. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3126. RM.MATERIAL_NAME AS "materialName",
  3127. ASM.MATERIAL_ID AS "materialId",
  3128. ASM.MATERIAL_NUMBER AS "materialNumber",
  3129. ASM.MATERIAL_WEIGHT AS "materialWeight",
  3130. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3131. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  3132. RM.MATERIAL_CODE AS "materialCode",
  3133. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  3134. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3135. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3136. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3137. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3138. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3139. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  3140. RC.CAPACITY_NUMBER AS "capacityNumber",
  3141. ADSO.CARRIER_ID AS "carrierId",
  3142. ASOM.TRUCK_REMARK AS "truckRemark"
  3143. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3144. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3145. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  3146. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3147. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3148. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3149. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3150. LEFT JOIN AMS_SALE_MATERIAL ASM
  3151. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  3152. LEFT JOIN RMS_MATERIAL RM
  3153. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3154. LEFT JOIN OMSTRUCK_ORDER OO
  3155. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3156. LEFT JOIN RMS_CAPACITY RC
  3157. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  3158. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3159. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3160. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3161. and ASM.SALE_MATERIAL_ID IS NOT NULL
  3162. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  3163. </select>
  3164. <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  3165. SELECT * FROM (
  3166. SELECT DISTINCT *
  3167. FROM (
  3168. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3169. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3170. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3171. "addressDeliveryAddress",
  3172. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3173. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  3174. AS "approvalStatus",
  3175. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3176. RSH.SHIPPER_NAME AS "shipperName",
  3177. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3178. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3179. ASOM.INSERT_TIME AS "insertTime",
  3180. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3181. ASO.SALE_ORDER_ID AS "saleOrderId",
  3182. RCA.CARRIER_NAME AS "carrierName",
  3183. RM.MATERIAL_NAME AS "materialName",
  3184. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3185. RM.MATERIAL_MODEL AS "materialModel",
  3186. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3187. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3188. RCP.CAPACITY_NUMBER AS "capacityNumber",
  3189. OO.DRIVER_TEL AS "drivelTel",
  3190. ASM.MATERIAL_NUMBER AS "materialNumber",
  3191. OO.ORDER_ID AS "orderId"
  3192. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3193. LEFT JOIN AMS_SALE_ORDER ASO
  3194. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3195. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3196. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3197. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3198. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3199. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3200. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3201. LEFT JOIN RMS_SHIPPER RSH
  3202. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3203. LEFT JOIN RMS_CONSIGNEE RCO
  3204. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3205. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3206. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3207. LEFT JOIN OMSTRUCK_ORDER OO
  3208. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3209. LEFT JOIN RMS_CAPACITY RCP
  3210. ON RCP.CAPACITY_ID = OO.CAPACITY_ID
  3211. LEFT JOIN RMS_CARRIER RCA
  3212. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3213. LEFT JOIN AMS_SALE_MATERIAL ASM
  3214. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3215. LEFT JOIN RMS_MATERIAL RM
  3216. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3217. WHERE OO.ORDER_TYPE = 1
  3218. AND ASO.SALE_ORDER_STATUS IN (2,4)
  3219. AND ASOM.ISSUE_STATUS IS NULL
  3220. AND ADSO.DISPATCH_TYPE = 2
  3221. AND OO.ORDER_ID IS NOT NULL
  3222. AND OO.ORDER_STATUS IN (4,5)
  3223. AND ASO.DELETED != 2
  3224. AND ASM.DELETED IS NULL
  3225. <if test="oneDate != null">
  3226. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASOM.INSERT_TIME
  3227. </if>
  3228. <if test="startDate != null">
  3229. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASOM.INSERT_TIME
  3230. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASOM.INSERT_TIME
  3231. </if>
  3232. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3233. ) "HAVECAR"
  3234. <where>
  3235. <if test="con != null" >
  3236. "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
  3237. </if>
  3238. </where>
  3239. )
  3240. <where>
  3241. <if test="saleNumber != null">
  3242. and
  3243. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3244. "saleNumber" like '%${item}%'
  3245. </foreach>
  3246. </if>
  3247. <if test="materialName != null">
  3248. and
  3249. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3250. "materialName" like '%${item}%'
  3251. </foreach>
  3252. </if>
  3253. <if test="materialSpecification != null">
  3254. and
  3255. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3256. "materialSpecification" like '%${item}%'
  3257. </foreach>
  3258. </if>
  3259. <if test="materialModel != null">
  3260. and
  3261. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3262. "materialModel" like '%${item}%'
  3263. </foreach>
  3264. </if>
  3265. <if test="materialName != null">
  3266. and
  3267. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3268. "materialName" like '%${item}%'
  3269. </foreach>
  3270. </if>
  3271. <if test="carrierName != null">
  3272. and
  3273. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3274. "carrierName" like '%${item}%'
  3275. </foreach>
  3276. </if>
  3277. <if test="truckNo != null">
  3278. and
  3279. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3280. "truckNo" like '%${item}%'
  3281. </foreach>
  3282. </if>
  3283. <if test="addressDeliveryAddress != null">
  3284. and
  3285. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3286. "addressDeliveryAddress" like '%${item}%'
  3287. </foreach>
  3288. </if>
  3289. <if test="saleDateOfReceipt != null">
  3290. and
  3291. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3292. "saleDateOfReceipt" like '%${item}%'
  3293. </foreach>
  3294. </if>
  3295. <if test="saleOrderConsignee != null">
  3296. and
  3297. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3298. "saleOrderConsignee" like '%${item}%'
  3299. </foreach>
  3300. </if>
  3301. <if test="saleOrderConsigneeTel != null">
  3302. and
  3303. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3304. "saleOrderConsigneeTel" like '%${item}%'
  3305. </foreach>
  3306. </if>
  3307. <if test="shipperName != null">
  3308. and
  3309. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3310. "shipperName" like '%${item}%'
  3311. </foreach>
  3312. </if>
  3313. <if test="consigneeCompanyName != null">
  3314. and
  3315. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3316. "consigneeCompanyName" like '%${item}%'
  3317. </foreach>
  3318. </if>
  3319. <if test="isselfMention != null">
  3320. and
  3321. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3322. "isselfMention" like '%${item}%'
  3323. </foreach>
  3324. </if>
  3325. </where>
  3326. </select>
  3327. <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
  3328. SELECT ACTP.PRICE_ID AS "priceId"
  3329. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3330. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3331. ON ASOM.SALE_SHIPPING_ADDRESS_ID = ACTP.PLACE_ID
  3332. WHERE ACTP.CARRIER_ID = #{carrierId}
  3333. AND ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3334. ORDER BY ACTP.INSERT_TIME DESC
  3335. FETCH NEXT 1 ROWS ONLY
  3336. </select>
  3337. <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
  3338. SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
  3339. FROM RMS_CONSIGNEE RC
  3340. WHERE RC.CONSIGNEE_ID = #{receiveId}
  3341. </select>
  3342. <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
  3343. SELECT RC.CARRIER_ID AS "carrierId"
  3344. FROM RMS_CARRIER RC
  3345. WHERE RC.CARRIER_NAME = #{consigneeName}
  3346. </select>
  3347. <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
  3348. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
  3349. ASO.SALE_REMARK AS "saleRemark",
  3350. ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
  3351. RSH.SHIPPER_ID AS "shipperId",
  3352. RSH.SHIPPER_NAME AS "shipperName",
  3353. RCO.CONSIGNEE_ID AS "receiveId",
  3354. RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
  3355. RSA.SALER_ID AS "salerId",
  3356. RSA.SALER_NAME AS "salerName"
  3357. FROM AMS_SALE_ORDER ASO
  3358. LEFT JOIN RMS_SHIPPER RSH
  3359. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3360. LEFT JOIN RMS_CONSIGNEE RCO
  3361. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3362. LEFT JOIN RMS_SALER RSA
  3363. ON RSA.SALER_ID = ASO.SALER_ID
  3364. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3365. </select>
  3366. <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
  3367. SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3368. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3369. RRA.ADDRESS_ID AS "shipperAddressId",
  3370. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
  3371. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3372. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3373. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3374. ASM.MATERIAL_ID AS "materialId",
  3375. RM.MATERIAL_NAME AS "materialName",
  3376. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
  3377. RM.MATERIAL_CODE AS "materialCode",
  3378. ASM.MATERIAL_NUMBER AS "materialNumber",
  3379. ASM.STEEL_METER AS "steelMeters",
  3380. ASM.IS_POUND_SALE AS "isPoundSale",
  3381. ASOM.TRUCK_REMARK AS "truckRemark"
  3382. FROM AMS_SALE_ORDER ASO
  3383. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3384. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3385. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3386. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3387. LEFT JOIN AMS_SALE_MATERIAL ASM
  3388. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3389. LEFT JOIN RMS_MATERIAL RM
  3390. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3391. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3392. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3393. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3394. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3395. WHERE asm.SALE_MATERIAL_ID is not null
  3396. and ASO.SALE_ORDER_ID = #{saleOrderId}
  3397. </select>
  3398. <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.LinkedHashMap" >
  3399. SELECT
  3400. DISTINCT
  3401. RRP.PLACE_ID "placeId",
  3402. RRP.ADDRESS_DELIVERY_ADDRESS "place",
  3403. RRA.ADDRESS_ID "shipperAddressId",
  3404. RRA.ADDRESS_PROVINCE "addressProvince",
  3405. RRA.ADDRESS_DISTRICT "addressDistrict",
  3406. RRA.ADDRESS_TOWN "addressTown",
  3407. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  3408. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS "addressPlace",
  3409. max(ASOM.SALE_ORDER_MATERIAL_ID) as b
  3410. FROM AMS_SALE_ORDER ASO
  3411. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3412. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3413. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3414. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3415. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3416. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3417. WHERE ASO.RECEIVE_ID = #{receiveId}
  3418. AND RRP.PLACE_ID IS NOT NULL
  3419. GROUP BY RRP.PLACE_ID , RRP.ADDRESS_DELIVERY_ADDRESS , RRA.ADDRESS_ID ,
  3420. RRA.ADDRESS_PROVINCE ,
  3421. RRA.ADDRESS_DISTRICT ,
  3422. RRA.ADDRESS_TOWN ,
  3423. ASOM.SALE_ORDER_CONSIGNEE_TEL
  3424. ORDER BY b DESC
  3425. </select>
  3426. <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
  3427. SELECT DISTINCT *
  3428. FROM (
  3429. SELECT RS.SALER_NAME "salerName",
  3430. RS.SALER_ID "salerId"
  3431. FROM AMS_SALE_ORDER ASO
  3432. LEFT JOIN RMS_SALER RS
  3433. ON RS.SALER_ID = ASO.SALER_ID
  3434. WHERE ASO.RECEIVE_ID = #{receiveId}
  3435. AND RS.SALER_ID IS NOT NULL
  3436. AND ASO.SALE_TYPE = 1
  3437. ORDER BY ASO.SALE_ORDER_ID DESC
  3438. )
  3439. WHERE rownum <![CDATA[
  3440. <
  3441. ]]> 2
  3442. </select>
  3443. <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
  3444. SELECT DISTINCT *
  3445. FROM (
  3446. SELECT OO.DRIVER_TEL "driverTel"
  3447. FROM RMS_CAPACITY RCA
  3448. LEFT JOIN OMSTRUCK_ORDER OO
  3449. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3450. WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
  3451. AND OO.ORDER_TYPE = 1
  3452. ORDER BY OO.ORDER_ID
  3453. )
  3454. WHERE ROWNUM <![CDATA[
  3455. <
  3456. ]]> 2
  3457. </select>
  3458. <!-- 查询内转焦炭订单 -->
  3459. <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3460. SELECT * FROM (
  3461. SELECT *from(
  3462. select
  3463. OO.ORDER_NUMBER "orderNumber",
  3464. ASO.SALE_NUMBER "saleNumber",
  3465. RC.CAPACITY_NUMBER "capacityNumber",
  3466. RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3467. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
  3468. ACTP.PRICE_VALUE "priceValue",
  3469. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  3470. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  3471. RS.SHIPPER_NAME "shipperName",
  3472. OO.ORDER_ID "orderId",
  3473. RC3.CARRIER_NAME "carrierName"
  3474. FROM OMSTRUCK_ORDER OO
  3475. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3476. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  3477. LEFT JOIN AMS_SALE_ORDER ASO
  3478. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  3479. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3480. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3481. LEFT JOIN RMS_CARRIER RC3
  3482. ON RC3.CARRIER_ID = ADSO.CARRIER_ID
  3483. LEFT JOIN RMS_CONSIGNEE RC2
  3484. ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
  3485. LEFT JOIN RMS_CAPACITY RC
  3486. ON OO.CAPACITY_ID=RC.CAPACITY_ID
  3487. LEFT JOIN RMS_SHIPPER RS
  3488. ON RS.SHIPPER_ID=ASO.SHIPPER_ID
  3489. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3490. ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  3491. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3492. ON OO.PRICE_ID=ACTP.PRICE_ID
  3493. WHERE OO.ORDER_TYPE = 2
  3494. AND ASO.SHIPPER_ID = 2
  3495. AND ASO.CLOSE_STATUS = 0
  3496. <where>
  3497. <if test="orderStatus!=null">
  3498. AND OO.ORDER_STATUS = #{orderStatus}
  3499. </if>
  3500. </where>
  3501. ) RRC
  3502. <if test="con != null">
  3503. WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
  3504. </if>
  3505. )
  3506. <where>
  3507. <if test="orderNumber != null">
  3508. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  3509. "orderNumber" like '%${item}%'
  3510. </foreach>
  3511. </if>
  3512. <if test="carrierName != null">
  3513. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3514. "carrierName" like '%${item}%'
  3515. </foreach>
  3516. </if>
  3517. <if test="saleNumber != null">
  3518. and
  3519. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3520. "saleNumber" like '%${item}%'
  3521. </foreach>
  3522. </if>
  3523. <if test="capacityNumber != null">
  3524. and
  3525. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  3526. "capacityNumber" like '%${item}%'
  3527. </foreach>
  3528. </if>
  3529. <if test="shipperName != null">
  3530. and
  3531. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3532. "shipperName" like '%${item}%'
  3533. </foreach>
  3534. </if>
  3535. <if test="consigneeCompanyName != null">
  3536. and
  3537. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3538. "consigneeCompanyName" like '%${item}%'
  3539. </foreach>
  3540. </if>
  3541. </where>
  3542. <include refid="orderBy">
  3543. </include>
  3544. <if test="orderField == null ">
  3545. order by "orderNumber" desc
  3546. </if>
  3547. </select>
  3548. <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
  3549. SELECT ADSO.DISPATCH_ID AS "dispatchId"
  3550. FROM AMS_DISPATCH_SALE_ORDER ADSO
  3551. WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3552. </select>
  3553. <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="java.util.Map" >
  3554. SELECT ASTM.MATERIAL_ID AS "saleMaterialId",
  3555. ASM.EAS_PRIMARY_ID AS "closeEntryId"
  3556. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3557. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3558. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3559. LEFT JOIN AMS_SALE_MATERIAL ASM
  3560. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3561. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3562. </select>
  3563. <select id="getSaleList" resultType="java.util.Map" >
  3564. SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
  3565. ASM.SALE_MATERIAL_ID "saleMaterialId",
  3566. ASM.MATERIAL_ID "materialId"
  3567. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3568. LEFT JOIN AMS_SALE_MATERIAL ASM
  3569. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3570. WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3571. AND ASM.MATERIAL_ID = #{materialId}
  3572. </select>
  3573. <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3574. select * from(
  3575. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3576. a_s_order.SALE_NUMBER "saleNumber",
  3577. r_shipper.SHIPPER_NAME "shipperName",
  3578. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3579. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3580. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3581. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3582. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3583. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3584. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3585. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3586. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3587. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3588. a_s_order.SALE_REMARK "saleRemark",
  3589. a_s_order.INSERT_TIME "insertTime",
  3590. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3591. RM.MATERIAL_NAME "materialName",
  3592. ASM.MATERIAL_WEIGHT "materialWeight",
  3593. ASM.SALE_WAREHOUSE "saleWareHouse",
  3594. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  3595. nvl(sumWeight.weight ,0) as "netWeight",
  3596. nvl(sumWeight2.weight ,0) as "weight",
  3597. nvl(carCount.coun ,0) as "carCount",
  3598. RCA.CARRIER_NAME as "carrierName"
  3599. from AMS_SALE_ORDER a_s_order
  3600. left join RMS_SHIPPER r_shipper
  3601. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3602. left join RMS_CONSIGNEE r_consignee
  3603. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3604. LEFT JOIN AMS_SALE_MATERIAL ASM
  3605. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3606. LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
  3607. ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3608. LEFT JOIN RMS_CARRIER RCA
  3609. ON RCA.CARRIER_ID = ASOC.CARRIER_ID
  3610. LEFT JOIN RMS_MATERIAL RM
  3611. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3612. left join (
  3613. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  3614. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3615. left join Omstruck_Order o_order
  3616. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3617. left join Tmstruck_Total_Result t_t_result
  3618. on o_order.order_id=t_t_result.order_id
  3619. left join Tmstruck_Weight_Result t_w_result
  3620. on t_t_result.result_total_id=t_w_result.result_total_id
  3621. GROUP BY
  3622. a_s_o_Material.SALE_ORDER_ID
  3623. ) sumWeight
  3624. on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3625. left join (
  3626. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3627. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3628. left join Omstruck_Order o_order
  3629. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3630. left join Tmstruck_Total_Result t_t_result
  3631. on o_order.order_id=t_t_result.order_id
  3632. left join Tmstruck_Weight_Result t_w_result
  3633. on t_t_result.result_total_id=t_w_result.result_total_id
  3634. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  3635. on o_order.order_id=o_o_material.ORDER_ID
  3636. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3637. GROUP BY
  3638. a_s_o_Material.SALE_ORDER_ID
  3639. ) sumWeight2
  3640. on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3641. left join (
  3642. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3643. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3644. left join Omstruck_Order o_order
  3645. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3646. left join Tmstruck_Total_Result t_t_result
  3647. on o_order.order_id=t_t_result.order_id
  3648. left join Tmstruck_Weight_Result t_w_result
  3649. on t_t_result.result_total_id=t_w_result.result_total_id
  3650. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3651. GROUP BY
  3652. a_s_o_Material.SALE_ORDER_ID
  3653. ) carCount
  3654. on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3655. where (ASM.SALE_WAREHOUSE = '副产品库'
  3656. or ASM.SALE_WAREHOUSE = '钒渣库')
  3657. and a_s_order.SALE_ORDER_STATUS in (2,4)
  3658. and a_s_order.CLOSE_STATUS is null
  3659. and a_s_order.DELETED = #{deleted}
  3660. and a_s_order.SHIPPER_ID = 1
  3661. and a_s_order.SALE_TYPE is null
  3662. <if test="con != null">
  3663. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3664. </if>
  3665. <if test="consigneeSsoId != null">
  3666. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3667. </if>
  3668. <if test="oneDate != null">
  3669. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3670. </if>
  3671. <if test="startDate != null">
  3672. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3673. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3674. </if>
  3675. ORDER BY a_s_order.UPDATE_TIME DESC
  3676. )
  3677. <where>
  3678. <if test="saleNumber != null">
  3679. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3680. "saleNumber" like '%${item}%'
  3681. </foreach>
  3682. </if>
  3683. <if test="materialName != null">
  3684. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3685. "materialName" like '%${item}%'
  3686. </foreach>
  3687. </if>
  3688. <if test="materialSpecification != null">
  3689. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3690. "materialSpecification" like '%${item}%'
  3691. </foreach>
  3692. </if>
  3693. <if test="materialModel != null">
  3694. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3695. "materialModel" like '%${item}%'
  3696. </foreach>
  3697. </if>
  3698. <if test="statusStr != null">
  3699. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3700. and "statusStr" like '%${item}%'
  3701. </foreach>
  3702. </if>
  3703. <if test="shipperName != null">
  3704. and
  3705. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3706. "shipperName" like '%${item}%'
  3707. </foreach>
  3708. </if>
  3709. <if test="consigneeCompanyName != null">
  3710. and
  3711. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3712. "consigneeCompanyName" like '%${item}%'
  3713. </foreach>
  3714. </if>
  3715. <if test="consigneeWarrantyAmount != null">
  3716. and
  3717. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3718. "consigneeWarrantyAmount" like '%${item}%'
  3719. </foreach>
  3720. </if>
  3721. <if test="consigneeWarrantyWeight != null">
  3722. and
  3723. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3724. "consigneeWarrantyWeight" like '%${item}%'
  3725. </foreach>
  3726. </if>
  3727. <if test="saleOrderIsselfMention != null">
  3728. and
  3729. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3730. "saleOrderIsselfMention" like '%${item}%'
  3731. </foreach>
  3732. </if>
  3733. <if test="saleAccountBalance != null">
  3734. and
  3735. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3736. "saleAccountBalance" like '%${item}%'
  3737. </foreach>
  3738. </if>
  3739. <if test="saleCurrentOrderAmount != null">
  3740. and
  3741. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3742. "saleCurrentOrderAmount" like '%${item}%'
  3743. </foreach>
  3744. </if>
  3745. <if test="saleHistoricalOrderAmout != null">
  3746. and
  3747. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3748. "saleHistoricalOrderAmout" like '%${item}%'
  3749. </foreach>
  3750. </if>
  3751. <if test="saleOrderReceiveCustomer != null">
  3752. and
  3753. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3754. "saleOrderReceiveCustomer" like '%${item}%'
  3755. </foreach>
  3756. </if>
  3757. <if test="saleUnitPrice != null">
  3758. and
  3759. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3760. "saleUnitPrice" like '%${item}%'
  3761. </foreach>
  3762. </if>
  3763. <if test="saleOrderTax != null">
  3764. and
  3765. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3766. "saleOrderTax" like '%${item}%'
  3767. </foreach>
  3768. </if>
  3769. <if test="saleRemark != null">
  3770. and
  3771. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3772. "saleRemark" like '%${item}%'
  3773. </foreach>
  3774. </if>
  3775. </where>
  3776. </select>
  3777. <!-- 关闭未进厂的运单 -->
  3778. <update id="closeOrderNotIn" parameterType="DECIMAL" >
  3779. UPDATE OMSTRUCK_ORDER OO
  3780. SET OO.ORDER_STATUS = 7
  3781. WHERE OO.ORDER_ID IN (
  3782. SELECT OO.ORDER_ID "orderId"
  3783. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3784. LEFT JOIN OMSTRUCK_ORDER OO
  3785. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3786. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  3787. ON TTR.ORDER_ID = OO.ORDER_ID
  3788. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  3789. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  3790. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  3791. AND TER.RESULT_ENTRY_GATE_TIME IS NULL
  3792. AND OO.ORDER_ID IS NOT NULL
  3793. AND OO.ORDER_STATUS IN (4,5)
  3794. )
  3795. </update>
  3796. <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
  3797. SELECT RCA.CAPACITY_NUMBER AS "r1c1",
  3798. OO.ORDER_NUMBER AS "r1c2",
  3799. RM.EAS_MATERIAL_ID AS "r1c3",
  3800. RM.MATERIAL_NAME AS "r1c4",
  3801. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
  3802. FROM OMSTRUCK_ORDER OO
  3803. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  3804. ON OOM.ORDER_ID = OO.ORDER_ID
  3805. LEFT JOIN RMS_MATERIAL RM
  3806. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  3807. LEFT JOIN RMS_CAPACITY RCA
  3808. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3809. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3810. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  3811. LEFT JOIN AMS_SALE_ORDER ASO
  3812. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3813. LEFT JOIN RMS_CONSIGNEE RC
  3814. ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  3815. </select>
  3816. <select id="getSteelOrderDeletedList" resultType="java.util.Map" parameterType="java.util.Map">
  3817. select * from(
  3818. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3819. a_s_order.SALE_NUMBER "saleNumber",
  3820. r_shipper.SHIPPER_NAME "shipperName",
  3821. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3822. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3823. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3824. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3825. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3826. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3827. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3828. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3829. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3830. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3831. a_s_order.SALE_REMARK "saleRemark",
  3832. a_s_order.INSERT_TIME "insertTime",
  3833. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3834. RM.MATERIAL_NAME "materialName",
  3835. RM.MATERIAL_SPECIFICATION "materialSpecification",
  3836. RM.MATERIAL_MODEL "materialModel",
  3837. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  3838. ASM.MATERIAL_NUMBER "materialNumber",
  3839. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  3840. ASM.SALE_WAREHOUSE "saleWareHouse",
  3841. a_s_order.DELETED "deleted"
  3842. from AMS_SALE_ORDER a_s_order
  3843. left join RMS_SHIPPER r_shipper
  3844. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3845. left join RMS_CONSIGNEE r_consignee
  3846. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3847. LEFT JOIN AMS_SALE_MATERIAL ASM
  3848. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3849. LEFT JOIN RMS_MATERIAL RM
  3850. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3851. LEFT JOIN RMS_SALER R_SALER
  3852. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  3853. where a_s_order.SALE_ORDER_STATUS in (2,4)
  3854. and a_s_order.DELETED = 1
  3855. and a_s_order.SALE_TYPE = 1
  3856. <if test="con != null">
  3857. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3858. </if>
  3859. <if test="saler != null" >
  3860. and R_SALER.SALER_NAME = #{saler}
  3861. </if>
  3862. <if test="oneDate != null">
  3863. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3864. </if>
  3865. <if test="startDate != null">
  3866. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3867. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3868. </if>
  3869. <if test="consigneeSsoId != null">
  3870. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3871. </if>
  3872. ORDER BY a_s_order.UPDATE_TIME DESC
  3873. )
  3874. <where>
  3875. <if test="saleNumber != null">
  3876. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3877. "saleNumber" like '%${item}%'
  3878. </foreach>
  3879. </if>
  3880. <if test="materialName != null">
  3881. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3882. "materialName" like '%${item}%'
  3883. </foreach>
  3884. </if>
  3885. <if test="materialSpecification != null">
  3886. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3887. "materialSpecification" like '%${item}%'
  3888. </foreach>
  3889. </if>
  3890. <if test="materialModel != null">
  3891. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3892. "materialModel" like '%${item}%'
  3893. </foreach>
  3894. </if>
  3895. <if test="statusStr != null">
  3896. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3897. and "statusStr" like '%${item}%'
  3898. </foreach>
  3899. </if>
  3900. <!-- <if test="startTime != null">-->
  3901. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  3902. <!-- </if>-->
  3903. <!-- <if test="endTime != null">-->
  3904. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  3905. <!-- </if>-->
  3906. <if test="shipperName != null">
  3907. and
  3908. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3909. "shipperName" like '%${item}%'
  3910. </foreach>
  3911. </if>
  3912. <if test="consigneeCompanyName != null">
  3913. and
  3914. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3915. "consigneeCompanyName" like '%${item}%'
  3916. </foreach>
  3917. </if>
  3918. <if test="consigneeWarrantyAmount != null">
  3919. and
  3920. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3921. "consigneeWarrantyAmount" like '%${item}%'
  3922. </foreach>
  3923. </if>
  3924. <if test="consigneeWarrantyWeight != null">
  3925. and
  3926. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3927. "consigneeWarrantyWeight" like '%${item}%'
  3928. </foreach>
  3929. </if>
  3930. <if test="saleOrderIsselfMention != null">
  3931. and
  3932. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3933. "saleOrderIsselfMention" like '%${item}%'
  3934. </foreach>
  3935. </if>
  3936. <if test="saleAccountBalance != null">
  3937. and
  3938. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3939. "saleAccountBalance" like '%${item}%'
  3940. </foreach>
  3941. </if>
  3942. <if test="saleCurrentOrderAmount != null">
  3943. and
  3944. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3945. "saleCurrentOrderAmount" like '%${item}%'
  3946. </foreach>
  3947. </if>
  3948. <if test="saleHistoricalOrderAmout != null">
  3949. and
  3950. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3951. "saleHistoricalOrderAmout" like '%${item}%'
  3952. </foreach>
  3953. </if>
  3954. <if test="saleOrderReceiveCustomer != null">
  3955. and
  3956. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3957. "saleOrderReceiveCustomer" like '%${item}%'
  3958. </foreach>
  3959. </if>
  3960. <if test="saleUnitPrice != null">
  3961. and
  3962. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3963. "saleUnitPrice" like '%${item}%'
  3964. </foreach>
  3965. </if>
  3966. <if test="saleOrderTax != null">
  3967. and
  3968. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3969. "saleOrderTax" like '%${item}%'
  3970. </foreach>
  3971. </if>
  3972. <if test="saleRemark != null">
  3973. and
  3974. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3975. "saleRemark" like '%${item}%'
  3976. </foreach>
  3977. </if>
  3978. </where>
  3979. </select>
  3980. <select id="getAllSteelSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map" >
  3981. select * from(
  3982. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3983. a_s_order.SALE_NUMBER "saleNumber",
  3984. r_shipper.SHIPPER_NAME "shipperName",
  3985. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3986. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3987. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3988. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3989. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3990. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3991. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3992. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3993. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3994. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3995. a_s_order.SALE_REMARK "saleRemark",
  3996. a_s_order.INSERT_TIME "insertTime",
  3997. DECODE(a_s_order.SALE_ORDER_STATUS || a_s_order.DELETED,00,'未上传',10,'已上传',20,'销售已提交',40,'财务已审批',21,'反审核',41,'反审核',22,'已关闭',42,'已关闭') "statusStr",
  3998. RM.MATERIAL_NAME "materialName",
  3999. RM.MATERIAL_SPECIFICATION "materialSpecification",
  4000. RM.MATERIAL_MODEL "materialModel",
  4001. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  4002. ASM.SALE_WAREHOUSE "saleWareHouse"
  4003. from AMS_SALE_ORDER a_s_order
  4004. left join RMS_SHIPPER r_shipper
  4005. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4006. left join RMS_CONSIGNEE r_consignee
  4007. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4008. LEFT JOIN AMS_SALE_MATERIAL ASM
  4009. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4010. LEFT JOIN RMS_MATERIAL RM
  4011. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4012. where a_s_order.CLOSE_STATUS is null
  4013. and a_s_order.DELETED = 0
  4014. <if test="con != null">
  4015. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  4016. </if>
  4017. <if test="shipperId != null">
  4018. and a_s_order.SHIPPER_ID = #{shipperId}
  4019. </if>
  4020. <if test="saleType != null">
  4021. and a_s_order.SALE_TYPE = #{saleType}
  4022. </if>
  4023. <if test="saleType == null">
  4024. and a_s_order.SALE_TYPE is null
  4025. </if>
  4026. <if test="consigneeSsoId != null">
  4027. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4028. </if>
  4029. ORDER BY a_s_order.UPDATE_TIME DESC
  4030. )
  4031. <where>
  4032. <if test="saleNumber != null">
  4033. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4034. "saleNumber" like '%${item}%'
  4035. </foreach>
  4036. </if>
  4037. <if test="materialName != null">
  4038. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4039. "materialName" like '%${item}%'
  4040. </foreach>
  4041. </if>
  4042. <if test="materialSpecification != null">
  4043. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4044. "materialSpecification" like '%${item}%'
  4045. </foreach>
  4046. </if>
  4047. <if test="materialModel != null">
  4048. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4049. "materialModel" like '%${item}%'
  4050. </foreach>
  4051. </if>
  4052. <if test="statusStr != null">
  4053. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4054. and "statusStr" like '%${item}%'
  4055. </foreach>
  4056. </if>
  4057. <!-- <if test="startTime != null">-->
  4058. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4059. <!-- </if>-->
  4060. <!-- <if test="endTime != null">-->
  4061. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4062. <!-- </if>-->
  4063. <if test="shipperName != null">
  4064. and
  4065. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4066. "shipperName" like '%${item}%'
  4067. </foreach>
  4068. </if>
  4069. <if test="consigneeCompanyName != null">
  4070. and
  4071. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4072. "consigneeCompanyName" like '%${item}%'
  4073. </foreach>
  4074. </if>
  4075. <if test="consigneeWarrantyAmount != null">
  4076. and
  4077. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4078. "consigneeWarrantyAmount" like '%${item}%'
  4079. </foreach>
  4080. </if>
  4081. <if test="consigneeWarrantyWeight != null">
  4082. and
  4083. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4084. "consigneeWarrantyWeight" like '%${item}%'
  4085. </foreach>
  4086. </if>
  4087. <if test="saleOrderIsselfMention != null">
  4088. and
  4089. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4090. "saleOrderIsselfMention" like '%${item}%'
  4091. </foreach>
  4092. </if>
  4093. <if test="saleAccountBalance != null">
  4094. and
  4095. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4096. "saleAccountBalance" like '%${item}%'
  4097. </foreach>
  4098. </if>
  4099. <if test="saleCurrentOrderAmount != null">
  4100. and
  4101. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4102. "saleCurrentOrderAmount" like '%${item}%'
  4103. </foreach>
  4104. </if>
  4105. <if test="saleHistoricalOrderAmout != null">
  4106. and
  4107. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4108. "saleHistoricalOrderAmout" like '%${item}%'
  4109. </foreach>
  4110. </if>
  4111. <if test="saleOrderReceiveCustomer != null">
  4112. and
  4113. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4114. "saleOrderReceiveCustomer" like '%${item}%'
  4115. </foreach>
  4116. </if>
  4117. <if test="saleUnitPrice != null">
  4118. and
  4119. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4120. "saleUnitPrice" like '%${item}%'
  4121. </foreach>
  4122. </if>
  4123. <if test="saleOrderTax != null">
  4124. and
  4125. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4126. "saleOrderTax" like '%${item}%'
  4127. </foreach>
  4128. </if>
  4129. <if test="saleRemark != null">
  4130. and
  4131. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4132. "saleRemark" like '%${item}%'
  4133. </foreach>
  4134. </if>
  4135. </where>
  4136. </select>
  4137. <!-- 修改厂内未装货车辆的运单车牌号 -->
  4138. <update id="updateCapacityNumberInFactory" parameterType="java.util.Map" >
  4139. UPDATE OMSTRUCK_ORDER OO
  4140. SET OO.CAPACITY_ID = #{capacityId},
  4141. OO.insert_update_remark = '修改车牌号'
  4142. WHERE OO.ORDER_ID = #{orderId}
  4143. </update>
  4144. <update id="bindSaleArea">
  4145. UPDATE RMS_CONSIGNEE RC
  4146. SET RC.AREA_ID = #{saleAreaId}
  4147. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4148. </update>
  4149. <select id="getCarrierByAddress" parameterType="DECIMAL" resultType="java.util.Map" >
  4150. SELECT DISTINCT ACTP.CARRIER_ID "carrierId"
  4151. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4152. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4153. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4154. WHERE RRP.ADDRESS_ID = #{addressId}
  4155. </select>
  4156. <select id="getSaleCokeOrder" parameterType="java.util.Map" resultType="java.util.Map">
  4157. SELECT DISTINCT * FROM(
  4158. SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
  4159. a_s_order.SALE_NUMBER "saleNumber",
  4160. r_shipper.SHIPPER_NAME "shipperName",
  4161. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  4162. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  4163. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  4164. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  4165. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  4166. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4167. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4168. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4169. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4170. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4171. a_s_order.SALE_REMARK "saleRemark",
  4172. a_s_order.INSERT_TIME "insertTime",
  4173. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  4174. RM.MATERIAL_NAME "materialName",
  4175. ASM.MATERIAL_NUMBER "materialNumber",
  4176. ASM.SALE_WAREHOUSE "saleWareHouse",
  4177. a_s_order.DELETED "deleted",
  4178. a_s_order.SHIPPER_ID "shipperId",
  4179. a_s_order.RECEIVE_ID "receiveId",
  4180. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention"
  4181. from AMS_SALE_ORDER a_s_order
  4182. left join RMS_SHIPPER r_shipper
  4183. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4184. left join RMS_CONSIGNEE r_consignee
  4185. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4186. LEFT JOIN AMS_SALE_MATERIAL ASM
  4187. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4188. LEFT JOIN RMS_MATERIAL RM
  4189. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4190. where a_s_order.SALE_ORDER_STATUS in (2,4)
  4191. and a_s_order.CLOSE_STATUS is null
  4192. and a_s_order.DELETED = 0
  4193. and ASM.DELETED IS NULL
  4194. <if test="con != null">
  4195. 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 )
  4196. </if>
  4197. <if test="oneDate != null">
  4198. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4199. </if>
  4200. <if test="startDate != null">
  4201. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4202. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  4203. </if>
  4204. <if test="shipperId != null">
  4205. and a_s_order.SHIPPER_ID = #{shipperId}
  4206. </if>
  4207. <if test="consigneeSsoId != null">
  4208. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4209. </if>
  4210. <if test="saleType == null">
  4211. and a_s_order.SALE_TYPE is null
  4212. </if>
  4213. ORDER BY a_s_order.UPDATE_TIME DESC
  4214. )
  4215. <where>
  4216. <if test="saleNumber != null">
  4217. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4218. "saleNumber" like '%${item}%'
  4219. </foreach>
  4220. </if>
  4221. <if test="materialName != null">
  4222. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4223. "materialName" like '%${item}%'
  4224. </foreach>
  4225. </if>
  4226. <if test="materialSpecification != null">
  4227. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4228. "materialSpecification" like '%${item}%'
  4229. </foreach>
  4230. </if>
  4231. <if test="materialModel != null">
  4232. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4233. "materialModel" like '%${item}%'
  4234. </foreach>
  4235. </if>
  4236. <if test="statusStr != null">
  4237. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4238. and "statusStr" like '%${item}%'
  4239. </foreach>
  4240. </if>
  4241. <!-- <if test="startTime != null">-->
  4242. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4243. <!-- </if>-->
  4244. <!-- <if test="endTime != null">-->
  4245. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4246. <!-- </if>-->
  4247. <if test="shipperName != null">
  4248. and
  4249. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4250. "shipperName" like '%${item}%'
  4251. </foreach>
  4252. </if>
  4253. <if test="consigneeCompanyName != null">
  4254. and
  4255. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4256. "consigneeCompanyName" like '%${item}%'
  4257. </foreach>
  4258. </if>
  4259. <if test="consigneeWarrantyAmount != null">
  4260. and
  4261. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4262. "consigneeWarrantyAmount" like '%${item}%'
  4263. </foreach>
  4264. </if>
  4265. <if test="consigneeWarrantyWeight != null">
  4266. and
  4267. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4268. "consigneeWarrantyWeight" like '%${item}%'
  4269. </foreach>
  4270. </if>
  4271. <if test="saleOrderIsselfMention != null">
  4272. and
  4273. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4274. "saleOrderIsselfMention" like '%${item}%'
  4275. </foreach>
  4276. </if>
  4277. <if test="saleAccountBalance != null">
  4278. and
  4279. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4280. "saleAccountBalance" like '%${item}%'
  4281. </foreach>
  4282. </if>
  4283. <if test="saleCurrentOrderAmount != null">
  4284. and
  4285. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4286. "saleCurrentOrderAmount" like '%${item}%'
  4287. </foreach>
  4288. </if>
  4289. <if test="saleHistoricalOrderAmout != null">
  4290. and
  4291. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4292. "saleHistoricalOrderAmout" like '%${item}%'
  4293. </foreach>
  4294. </if>
  4295. <if test="saleOrderReceiveCustomer != null">
  4296. and
  4297. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4298. "saleOrderReceiveCustomer" like '%${item}%'
  4299. </foreach>
  4300. </if>
  4301. <if test="saleUnitPrice != null">
  4302. and
  4303. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4304. "saleUnitPrice" like '%${item}%'
  4305. </foreach>
  4306. </if>
  4307. <if test="saleOrderTax != null">
  4308. and
  4309. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4310. "saleOrderTax" like '%${item}%'
  4311. </foreach>
  4312. </if>
  4313. <if test="saleRemark != null">
  4314. and
  4315. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4316. "saleRemark" like '%${item}%'
  4317. </foreach>
  4318. </if>
  4319. </where>
  4320. </select>
  4321. <select id="findStatus" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4322. SELECT ASO.SALE_ORDER_STATUS AS "saleStatus"
  4323. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4324. LEFT JOIN AMS_SALE_ORDER ASO
  4325. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4326. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4327. </select>
  4328. <select id="getPlaceId" parameterType="DECIMAL" resultType="DECIMAL" >
  4329. SELECT ASOM.SALE_SHIPPING_ADDRESS_ID "placeId"
  4330. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4331. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4332. </select>
  4333. <select id="getAddressPriceList" parameterType="java.util.Map" resultType="java.util.Map" >
  4334. SELECT ACTP.PRICE_ID AS "priceId"
  4335. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4336. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4337. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4338. WHERE ACTP.CARRIER_ID = #{carrierId}
  4339. AND RRP.ADDRESS_ID = #{addressId}
  4340. ORDER BY ACTP.OLD_DATE DESC
  4341. NULLS LAST
  4342. </select>
  4343. <select id="findSelfMention" parameterType="DECIMAL" resultType="java.lang.String" >
  4344. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "selfMention"
  4345. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4346. LEFT JOIN AMS_SALE_ORDER ASO
  4347. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4348. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4349. </select>
  4350. <select id="findReceiveId" parameterType="java.lang.String" resultType="DECIMAL" >
  4351. SELECT RC.CONSIGNEE_ID AS "receiveId"
  4352. FROM RMS_CONSIGNEE RC
  4353. WHERE RC.CONSIGNEE_COMPANY_NAME = #{receiveName}
  4354. </select>
  4355. <select id="findSalerId" parameterType="java.lang.String" resultType="DECIMAL" >
  4356. SELECT RS.SALER_ID AS "salerId"
  4357. FROM RMS_SALER RS
  4358. WHERE RS.SALER_NAME = #{salerName}
  4359. </select>
  4360. <select id="findMaterialId" parameterType="java.util.Map" resultType="DECIMAL">
  4361. SELECT RM.MATERIAL_ID AS "materialId"
  4362. FROM RMS_MATERIAL RM
  4363. WHERE RM.MATERIAL_NAME = #{name}
  4364. AND RM.MATERIAL_SPECIFICATION = #{specification}
  4365. <if test="model != null">
  4366. AND RM.MATERIAL_MODEL = #{model}
  4367. </if>
  4368. </select>
  4369. <select id="findAddressId" parameterType="java.util.Map" resultType="DECIMAL" >
  4370. SELECT RRA.ADDRESS_ID AS "addressId"
  4371. FROM RMS_RECEIVE_ADDRESS RRA
  4372. WHERE RRA.ADDRESS_PROVINCE = #{province}
  4373. AND RRA.ADDRESS_DISTRICT = #{district}
  4374. AND RRA.ADDRESS_TOWN = #{town}
  4375. </select>
  4376. <select id="getSaleMaterialMessage" parameterType="DECIMAL" resultType="java.util.Map" >
  4377. SELECT ASM.MATERIAL_ID "materialId",
  4378. OO.ORDER_ID "orderId",
  4379. TTR.RESULT_TOTAL_ID "resultTotalId",
  4380. OO.ORDER_STATUS "orderStatus",
  4381. WOR.RESULT_ID "outBoundId",
  4382. ASM.MATERIAL_NUMBER "materialNumber"
  4383. FROM AMS_SALE_MATERIAL ASM
  4384. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4385. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  4386. LEFT JOIN OMSTRUCK_ORDER OO
  4387. ON ASTM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4388. AND OO.ORDER_TYPE = 1
  4389. LEFT JOIN WMSP_OUTBOUND_RESULT WOR
  4390. ON WOR.BILL_LADING_ID = OO.ORDER_ID
  4391. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4392. ON TTR.ORDER_ID = OO.ORDER_ID
  4393. WHERE ASM.SALE_MATERIAL_ID = #{saleMaterialId}
  4394. </select>
  4395. <select id="findOrderMaxNum" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4396. SELECT TLFR.SEGMENT_SQE "maxNum"
  4397. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  4398. WHERE TLFR.RESULT_TOTAL_ID = #{resultTotalId}
  4399. </select>
  4400. <select id="getKucunList" resultType="java.util.Map" parameterType="java.util.Map">
  4401. SELECT * FROM (
  4402. SELECT ASO.SALE_NUMBER "saleNo", ASO.SALE_REMARK "saleRemark",
  4403. RAS1.ARRIVAL_NAME "sendStation",
  4404. RAS.ARRIVAL_NAME "toTheStation",
  4405. RM.MATERIAL_NAME "materialName",
  4406. RM.MATERIAL_SPECIFICATION||'('||RM.MATERIAL_MODEL||')' "materialSpa",
  4407. ASM.MATERIAL_NUMBER "materialNum",
  4408. ASM.MATERIAL_WEIGHT "materialWeight",
  4409. RDOINDEP.ORG_NAME "transInDep",
  4410. RDOOUTDEP.ORG_NAME "transOutDep",
  4411. RISWINOF.INWARD_WAREHOUSE_NAME "transInWarehouse",
  4412. RC.CONSIGNEE_COMPANY_NAME "receiveName",
  4413. ASO.SALE_ORDER_ID "saleOrderId",
  4414. RAS1.ARRIVAL_ID "sendStationId",
  4415. RAS.ARRIVAL_ID "toTheStationId",
  4416. ASM.IS_POUND_SALE "isPoundSale",
  4417. ASM.SALE_MATERIAL_ID "saleMaterialId",
  4418. TPAR.RESULT_ID "approveId"
  4419. FROM AMS_SALE_ORDER ASO
  4420. LEFT JOIN AMS_SALE_MATERIAL ASM
  4421. ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  4422. LEFT JOIN RMS_MATERIAL RM
  4423. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4424. LEFT JOIN TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
  4425. ON TPAR.RAIL_PLAN_ID = ASM.SALE_MATERIAL_ID
  4426. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
  4427. ON RAS.ARRIVAL_ID = TPAR.TO_THE_STATION_ID
  4428. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS1
  4429. ON RAS1.ARRIVAL_ID = TPAR.SEND_STATION_ID
  4430. LEFT JOIN RMS_CONSIGNEE RC
  4431. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  4432. LEFT JOIN RMS_DEP_ORG RDOINDEP
  4433. ON RDOINDEP.ORG_CODE = ASO.TRANSFER_IN_DEP
  4434. LEFT JOIN RMS_DEP_ORG RDOOUTDEP
  4435. ON RDOOUTDEP.ORG_CODE = ASO.TRANSFER_OUT_DEP
  4436. LEFT JOIN RMS_INWARD_STEEL_WAREHOUSE RISWINOF
  4437. ON RISWINOF.INWARD_WAREHOUSE_CODE = ASM.TRANSFER_IN_OF_WAREHOUSE
  4438. WHERE ASO.SALE_TYPE = 4
  4439. <if test="oneDate != null">
  4440. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  4441. </if>
  4442. <if test="startDate != null">
  4443. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  4444. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  4445. </if>
  4446. <if test="remark != null">
  4447. and ASO.SALE_REMARK||RM.MATERIAL_NAME LIKE #{remark}
  4448. </if>
  4449. <if test="totheStation != null">
  4450. and RAS.ARRIVAL_NAME LIKE #{totheStation}
  4451. </if>
  4452. <if test="consigneeName != null">
  4453. and RC.CONSIGNEE_COMPANY_NAME like #{consigneeName}
  4454. </if>
  4455. <if test="transferIndep != null">
  4456. and RISWINDEP.INWARD_WAREHOUSE_NAME = #{transferIndep}
  4457. </if>
  4458. )
  4459. </select>
  4460. <select id="selectSaleAreaId" resultType="java.math.BigDecimal" parameterType="decimal">
  4461. SELECT RC.AREA_ID AS "areaId"
  4462. FROM RMS_CONSIGNEE RC
  4463. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4464. </select>
  4465. <select id="selectSaleAreaIdByName" resultType="java.math.BigDecimal" parameterType="string">
  4466. SELECT RSA.AREA_ID FROM RMS_SALE_AREA RSA
  4467. WHERE RSA.AREA_NAME = #{saleAreaName}
  4468. </select>
  4469. <select id="getMoreCarrier" resultType="java.math.BigDecimal" parameterType="string">
  4470. SELECT count(RMCP.CARRIER_PLACE_ID) FROM RMS_MORE_CARRIER_PLACE RMCP
  4471. WHERE RMCP.CARRIER_PLACE_VALUE LIKE #{place}
  4472. </select>
  4473. <select id="getOrderIdByCapacity" resultType="java.util.Map">
  4474. select OO.order_ID "orderId",
  4475. RC.CAPACITY_NUMBER "capacityNumber",
  4476. OO.ORDER_STATUS "orderStatus",
  4477. OO.ORDER_LINE_SEQUENCE "orderLineSequence"
  4478. from OMSTRUCK_ORDER OO
  4479. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID =RC.CAPACITY_ID
  4480. LEFT JOIN RMS_CARRIER RCA ON OO.CARRIER_ID=RCA.CARRIER_ID
  4481. LEFT JOIN OMSTRAIN_ORDER_MATERIAL OOM ON OOM.ORDER_ID=OO.ORDER_ID
  4482. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID=OOM.MATERIAL_ID
  4483. where RC.CAPACITY_NUMBER=#{capacityNumber} and OO.order_status=5
  4484. fetch next 1 rows only
  4485. </select>
  4486. <select id="getOrderMes" resultType="java.util.Map" parameterType="java.util.Map">
  4487. SELECT TTR.RESULT_TOTAL_ID "resultTotalId",
  4488. OO.ORDER_STATUS "orderStatus"
  4489. FROM OMSTRUCK_ORDER OO
  4490. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4491. ON TTR.ORDER_ID = OO.ORDER_ID
  4492. WHERE OO.ORDER_ID = #{orderId}
  4493. </select>
  4494. </mapper>