AmsSaleOrderMapper.xml 196 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747
  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="consigneeName != null">
  1529. and r_consignee.CONSIGNEE_COMPANY_NAME = #{consigneeName}
  1530. </if>
  1531. <if test="oneDate != null">
  1532. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1533. </if>
  1534. <if test="startDate != null">
  1535. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1536. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1537. </if>
  1538. ORDER BY a_s_order.SALE_ORDER_ID DESC
  1539. )
  1540. <where>
  1541. <if test="saleNumber != null">
  1542. and
  1543. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1544. "saleNumber" like '%${item}%'
  1545. </foreach>
  1546. </if>
  1547. <if test="materialName != null">
  1548. and
  1549. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1550. "materialName" like '%${item}%'
  1551. </foreach>
  1552. </if>
  1553. <if test="specificationModel != null">
  1554. and
  1555. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  1556. "specificationModel" like '%${item}%'
  1557. </foreach>
  1558. </if>
  1559. <if test="materialModel != null">
  1560. and
  1561. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1562. "materialModel" like '%${item}%'
  1563. </foreach>
  1564. </if>
  1565. <if test="shipperName != null">
  1566. and
  1567. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1568. "shipperName" like '%${item}%'
  1569. </foreach>
  1570. </if>
  1571. <if test="consigneeCompanyName != null">
  1572. and
  1573. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1574. "consigneeCompanyName" like '%${item}%'
  1575. </foreach>
  1576. </if>
  1577. <if test="saleOrderIsselfMention != null">
  1578. and
  1579. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1580. "saleOrderIsselfMention" like '%${item}%'
  1581. </foreach>
  1582. </if>
  1583. <if test="saleOrderReceiveCustomer != null">
  1584. and
  1585. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1586. "saleOrderReceiveCustomer" like '%${item}%'
  1587. </foreach>
  1588. </if>
  1589. <if test="saleRemark != null">
  1590. and
  1591. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1592. "saleRemark" like '%${item}%'
  1593. </foreach>
  1594. </if>
  1595. </where>
  1596. <include refid="orderBy1">
  1597. </include>
  1598. </select>
  1599. <select id="getSaleOrderReportedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1600. select * from(
  1601. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1602. a_s_order.SALE_NUMBER "saleNumber",
  1603. r_shipper.SHIPPER_NAME "shipperName",
  1604. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1605. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1606. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1607. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1608. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1609. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1610. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1611. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1612. a_s_order.SALE_REMARK "saleRemark",
  1613. a_s_order.INSERT_TIME "insertTime",
  1614. RM.MATERIAL_NAME "materialName",
  1615. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1616. RM.MATERIAL_MODEL "materialModel",
  1617. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1618. ASM.MATERIAL_NUMBER "materialNumber",
  1619. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1620. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace"
  1621. from AMS_SALE_ORDER a_s_order
  1622. left join RMS_SHIPPER r_shipper
  1623. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1624. left join RMS_CONSIGNEE r_consignee
  1625. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1626. left join AMS_SALE_ORDER_MATERIAL ASOM
  1627. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1628. left join RMS_RECEIVE_PLACE RRP
  1629. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1630. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1631. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1632. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1633. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1634. LEFT JOIN AMS_SALE_MATERIAL ASM
  1635. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1636. LEFT JOIN RMS_MATERIAL RM
  1637. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1638. LEFT JOIN RMS_SALER R_SALER
  1639. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1640. where a_s_order.SALE_ORDER_STATUS=1
  1641. and a_s_order.DELETED = 0
  1642. AND ASM.DELETED IS NULL
  1643. <if test="con != null">
  1644. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  1645. </if>
  1646. <if test="oneDate != null">
  1647. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1648. </if>
  1649. <if test="startDate != null">
  1650. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1651. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1652. </if>
  1653. <if test="consigneeSsoId != null">
  1654. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1655. </if>
  1656. <if test="saler != null" >
  1657. and R_SALER.INSERT_UPDATE_REMARK like #{saler}
  1658. </if>
  1659. )
  1660. <where>
  1661. <if test="saleNumber != null">
  1662. and
  1663. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1664. "saleNumber" like '%${item}%'
  1665. </foreach>
  1666. </if>
  1667. <if test="materialName != null">
  1668. and
  1669. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1670. "materialName" like '%${item}%'
  1671. </foreach>
  1672. </if>
  1673. <if test="materialModel != null">
  1674. and
  1675. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1676. "materialModel" like '%${item}%'
  1677. </foreach>
  1678. </if>
  1679. <if test="materialSpecification != null">
  1680. and
  1681. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1682. "materialSpecification" like '%${item}%'
  1683. </foreach>
  1684. </if>
  1685. <if test="shipperName != null">
  1686. and
  1687. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1688. "shipperName" like '%${item}%'
  1689. </foreach>
  1690. </if>
  1691. <if test="consigneeCompanyName != null">
  1692. and
  1693. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1694. "consigneeCompanyName" like '%${item}%'
  1695. </foreach>
  1696. </if>
  1697. <if test="saleOrderIsselfMention != null">
  1698. and
  1699. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1700. "saleOrderIsselfMention" like '%${item}%'
  1701. </foreach>
  1702. </if>
  1703. <if test="saleAccountBalance != null">
  1704. and
  1705. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1706. "saleAccountBalance" like '%${item}%'
  1707. </foreach>
  1708. </if>
  1709. <if test="saleCurrentOrderAmount != null">
  1710. and
  1711. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1712. "saleCurrentOrderAmount" like '%${item}%'
  1713. </foreach>
  1714. </if>
  1715. <if test="saleHistoricalOrderAmout != null">
  1716. and
  1717. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1718. "saleHistoricalOrderAmout" like '%${item}%'
  1719. </foreach>
  1720. </if>
  1721. <if test="saleOrderReceiveCustomer != null">
  1722. and
  1723. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1724. "saleOrderReceiveCustomer" like '%${item}%'
  1725. </foreach>
  1726. </if>
  1727. <if test="saleRemark != null">
  1728. and
  1729. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1730. "saleRemark" like '%${item}%'
  1731. </foreach>
  1732. </if>
  1733. </where>
  1734. <include refid="orderBy1"></include>
  1735. </select>
  1736. <!-- 销售公司查询已审核的焦炭销售订单 -->
  1737. <select id="getCokeSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1738. select * from(
  1739. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1740. a_s_order.SALE_NUMBER "saleNumber",
  1741. r_shipper.SHIPPER_NAME "shipperName",
  1742. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1743. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1744. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1745. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1746. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1747. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1748. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1749. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1750. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1751. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1752. a_s_order.SALE_REMARK "saleRemark",
  1753. a_s_order.INSERT_TIME "insertTime",
  1754. a_s_order.SALE_TYPE ,
  1755. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  1756. RM.MATERIAL_NAME "materialName",
  1757. a_s_order.CLOSE_STATUS "closeStatus"
  1758. from AMS_SALE_ORDER a_s_order
  1759. left join RMS_SHIPPER r_shipper
  1760. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1761. left join RMS_CONSIGNEE r_consignee
  1762. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1763. left join AMS_SALE_MATERIAL ASM
  1764. on ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1765. left join RMS_MATERIAL RM
  1766. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  1767. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1768. and a_s_order.CLOSE_STATUS is not null
  1769. and a_s_order.DELETED = 0
  1770. and a_s_order.SALE_TYPE is null
  1771. ) SSSR
  1772. <if test="con != null" >
  1773. where SSSR."consigneeCompanyName" LIKE #{con}
  1774. </if>
  1775. <if test="con != null" >
  1776. or SSSR."saleNumber" LIKE #{con}
  1777. </if>
  1778. <where>
  1779. <if test="saleNumber != null">
  1780. and
  1781. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1782. "saleNumber" like '%${item}%'
  1783. </foreach>
  1784. </if>
  1785. <if test="materialName != null">
  1786. and
  1787. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1788. "materialName" like '%${item}%'
  1789. </foreach>
  1790. </if>
  1791. <if test="statusStr != null">
  1792. and
  1793. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1794. "statusStr" like '%${item}%'
  1795. </foreach>
  1796. </if>
  1797. <if test="shipperName != null">
  1798. and
  1799. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1800. "shipperName" like '%${item}%'
  1801. </foreach>
  1802. </if>
  1803. <if test="consigneeCompanyName != null">
  1804. and
  1805. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1806. "consigneeCompanyName" like '%${item}%'
  1807. </foreach>
  1808. </if>
  1809. <if test="consigneeWarrantyAmount != null">
  1810. and
  1811. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  1812. "consigneeWarrantyAmount" like '%${item}%'
  1813. </foreach>
  1814. </if>
  1815. <if test="consigneeWarrantyWeight != null">
  1816. and
  1817. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  1818. "consigneeWarrantyWeight" like '%${item}%'
  1819. </foreach>
  1820. </if>
  1821. <if test="saleOrderIsselfMention != null">
  1822. and
  1823. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  1824. "saleOrderIsselfMention" like '%${item}%'
  1825. </foreach>
  1826. </if>
  1827. <if test="saleAccountBalance != null">
  1828. and
  1829. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  1830. "saleAccountBalance" like '%${item}%'
  1831. </foreach>
  1832. </if>
  1833. <if test="saleCurrentOrderAmount != null">
  1834. and
  1835. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  1836. "saleCurrentOrderAmount" like '%${item}%'
  1837. </foreach>
  1838. </if>
  1839. <if test="saleHistoricalOrderAmout != null">
  1840. and
  1841. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  1842. "saleHistoricalOrderAmout" like '%${item}%'
  1843. </foreach>
  1844. </if>
  1845. <if test="saleOrderReceiveCustomer != null">
  1846. and
  1847. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  1848. "saleOrderReceiveCustomer" like '%${item}%'
  1849. </foreach>
  1850. </if>
  1851. <if test="saleUnitPrice != null">
  1852. and
  1853. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  1854. "saleUnitPrice" like '%${item}%'
  1855. </foreach>
  1856. </if>
  1857. <if test="saleOrderTax != null">
  1858. and
  1859. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  1860. "saleOrderTax" like '%${item}%'
  1861. </foreach>
  1862. </if>
  1863. <if test="saleRemark != null">
  1864. and
  1865. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  1866. "saleRemark" like '%${item}%'
  1867. </foreach>
  1868. </if>
  1869. </where>
  1870. <include refid="orderBy"></include>
  1871. </select>
  1872. <select id="getSaleOrderListBySaleCompanyes" parameterType="java.util.Map" resultType="java.util.Map">
  1873. select * from(
  1874. select a_s_order.SALE_ORDER_ID "saleOrderId",
  1875. a_s_order.SALE_NUMBER "saleNumber",
  1876. r_shipper.SHIPPER_NAME "shipperName",
  1877. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  1878. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  1879. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  1880. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  1881. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  1882. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  1883. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  1884. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  1885. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  1886. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  1887. a_s_order.SALE_REMARK "saleRemark",
  1888. a_s_order.INSERT_TIME "insertTime",
  1889. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  1890. RM.MATERIAL_NAME "materialName",
  1891. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1892. RM.MATERIAL_MODEL "materialModel",
  1893. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  1894. ASM.MATERIAL_NUMBER "materialNumber",
  1895. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  1896. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
  1897. ASM.SALE_WAREHOUSE "saleWareHouse",
  1898. a_s_order.DELETED "deleted",
  1899. a_s_order.SHIPPER_ID "shipperId",
  1900. a_s_order.RECEIVE_ID "receiveId",
  1901. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention",
  1902. a_s_order.SALER_ID "salerId"
  1903. from AMS_SALE_ORDER a_s_order
  1904. left join RMS_SHIPPER r_shipper
  1905. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  1906. left join RMS_CONSIGNEE r_consignee
  1907. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  1908. left join AMS_SALE_ORDER_MATERIAL ASOM
  1909. on asom.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  1910. left join RMS_RECEIVE_PLACE RRP
  1911. on RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  1912. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1913. ON RRP.ADDRESS_ID = RRA.ADDRESS_ID
  1914. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  1915. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  1916. LEFT JOIN AMS_SALE_MATERIAL ASM
  1917. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  1918. LEFT JOIN RMS_MATERIAL RM
  1919. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  1920. LEFT JOIN RMS_SALER R_SALER
  1921. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  1922. where a_s_order.SALE_ORDER_STATUS in (2,4)
  1923. and a_s_order.CLOSE_STATUS is null
  1924. and ASM.DELETED IS NULL
  1925. and ASM.SALE_MATERIAL_ID IS NOT NULL
  1926. <if test="con != null">
  1927. and r_consignee.CONSIGNEE_COMPANY_NAME||a_s_order.SALE_NUMBER||rm.material_name||RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL like #{con}
  1928. </if>
  1929. <if test="oneDate != null">
  1930. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1931. </if>
  1932. <if test="startDate != null">
  1933. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  1934. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  1935. </if>
  1936. <if test="shipperId != null">
  1937. and a_s_order.SHIPPER_ID = #{shipperId}
  1938. </if>
  1939. <if test="saleType != null">
  1940. and a_s_order.SALE_TYPE = #{saleType}
  1941. </if>
  1942. <if test="saleType == null">
  1943. and a_s_order.SALE_TYPE is null
  1944. </if>
  1945. <if test="saler != null" >
  1946. and R_SALER.INSERT_UPDATE_REMARK like #{saler}
  1947. </if>
  1948. <if test="consigneeSsoId != null">
  1949. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  1950. </if>
  1951. ORDER BY a_s_order.UPDATE_TIME DESC
  1952. )
  1953. <where>
  1954. <if test="saleNumber != null">
  1955. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  1956. "saleNumber" like '%${item}%'
  1957. </foreach>
  1958. </if>
  1959. <if test="materialName != null">
  1960. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1961. "materialName" like '%${item}%'
  1962. </foreach>
  1963. </if>
  1964. <if test="materialSpecification != null">
  1965. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  1966. "materialSpecification" like '%${item}%'
  1967. </foreach>
  1968. </if>
  1969. <if test="materialModel != null">
  1970. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  1971. "materialModel" like '%${item}%'
  1972. </foreach>
  1973. </if>
  1974. <if test="statusStr != null">
  1975. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  1976. and "statusStr" like '%${item}%'
  1977. </foreach>
  1978. </if>
  1979. <!-- <if test="startTime != null">-->
  1980. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  1981. <!-- </if>-->
  1982. <!-- <if test="endTime != null">-->
  1983. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  1984. <!-- </if>-->
  1985. <if test="shipperName != null">
  1986. and
  1987. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1988. "shipperName" like '%${item}%'
  1989. </foreach>
  1990. </if>
  1991. <if test="consigneeCompanyName != null">
  1992. and
  1993. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1994. "consigneeCompanyName" like '%${item}%'
  1995. </foreach>
  1996. </if>
  1997. <if test="consigneeWarrantyAmount != null">
  1998. and
  1999. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2000. "consigneeWarrantyAmount" like '%${item}%'
  2001. </foreach>
  2002. </if>
  2003. <if test="consigneeWarrantyWeight != null">
  2004. and
  2005. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2006. "consigneeWarrantyWeight" like '%${item}%'
  2007. </foreach>
  2008. </if>
  2009. <if test="saleOrderIsselfMention != null">
  2010. and
  2011. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2012. "saleOrderIsselfMention" like '%${item}%'
  2013. </foreach>
  2014. </if>
  2015. <if test="saleAccountBalance != null">
  2016. and
  2017. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2018. "saleAccountBalance" like '%${item}%'
  2019. </foreach>
  2020. </if>
  2021. <if test="saleCurrentOrderAmount != null">
  2022. and
  2023. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2024. "saleCurrentOrderAmount" like '%${item}%'
  2025. </foreach>
  2026. </if>
  2027. <if test="saleHistoricalOrderAmout != null">
  2028. and
  2029. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2030. "saleHistoricalOrderAmout" like '%${item}%'
  2031. </foreach>
  2032. </if>
  2033. <if test="saleOrderReceiveCustomer != null">
  2034. and
  2035. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2036. "saleOrderReceiveCustomer" like '%${item}%'
  2037. </foreach>
  2038. </if>
  2039. <if test="saleUnitPrice != null">
  2040. and
  2041. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2042. "saleUnitPrice" like '%${item}%'
  2043. </foreach>
  2044. </if>
  2045. <if test="saleOrderTax != null">
  2046. and
  2047. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2048. "saleOrderTax" like '%${item}%'
  2049. </foreach>
  2050. </if>
  2051. <if test="saleRemark != null">
  2052. and
  2053. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2054. "saleRemark" like '%${item}%'
  2055. </foreach>
  2056. </if>
  2057. </where>
  2058. </select>
  2059. <select id="getAmsSaleOrderApprovedes" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  2060. select * from(
  2061. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2062. a_s_order.SALE_NUMBER "saleNumber",
  2063. r_shipper.SHIPPER_NAME "shipperName",
  2064. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2065. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2066. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2067. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2068. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2069. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2070. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2071. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2072. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2073. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2074. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2075. a_s_order.SALE_REMARK "saleRemark",
  2076. a_s_order.INSERT_TIME "insertTime"
  2077. from AMS_SALE_ORDER a_s_order
  2078. left join RMS_SHIPPER r_shipper
  2079. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2080. left join RMS_CONSIGNEE r_consignee
  2081. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2082. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2083. AND a_s_order.SHIPPER_ID = 2
  2084. <if test="con != null">
  2085. and instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0
  2086. </if>
  2087. )
  2088. <where>
  2089. <if test="saleNumber != null">
  2090. and
  2091. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2092. "saleNumber" like '%${item}%'
  2093. </foreach>
  2094. </if>
  2095. <if test="statusStr != null">
  2096. and
  2097. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  2098. "statusStr" like '%${item}%'
  2099. </foreach>
  2100. </if>
  2101. <if test="shipperName != null">
  2102. and
  2103. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2104. "shipperName" like '%${item}%'
  2105. </foreach>
  2106. </if>
  2107. <if test="consigneeCompanyName != null">
  2108. and
  2109. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2110. "consigneeCompanyName" like '%${item}%'
  2111. </foreach>
  2112. </if>
  2113. <if test="consigneeWarrantyAmount != null">
  2114. and
  2115. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2116. "consigneeWarrantyAmount" like '%${item}%'
  2117. </foreach>
  2118. </if>
  2119. <if test="consigneeWarrantyWeight != null">
  2120. and
  2121. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2122. "consigneeWarrantyWeight" like '%${item}%'
  2123. </foreach>
  2124. </if>
  2125. <if test="saleOrderIsselfMention != null">
  2126. and
  2127. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2128. "saleOrderIsselfMention" like '%${item}%'
  2129. </foreach>
  2130. </if>
  2131. <if test="saleAccountBalance != null">
  2132. and
  2133. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2134. "saleAccountBalance" like '%${item}%'
  2135. </foreach>
  2136. </if>
  2137. <if test="saleCurrentOrderAmount != null">
  2138. and
  2139. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2140. "saleCurrentOrderAmount" like '%${item}%'
  2141. </foreach>
  2142. </if>
  2143. <if test="saleHistoricalOrderAmout != null">
  2144. and
  2145. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2146. "saleHistoricalOrderAmout" like '%${item}%'
  2147. </foreach>
  2148. </if>
  2149. <if test="saleOrderReceiveCustomer != null">
  2150. and
  2151. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2152. "saleOrderReceiveCustomer" like '%${item}%'
  2153. </foreach>
  2154. </if>
  2155. <if test="saleUnitPrice != null">
  2156. and
  2157. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2158. "saleUnitPrice" like '%${item}%'
  2159. </foreach>
  2160. </if>
  2161. <if test="saleOrderTax != null">
  2162. and
  2163. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2164. "saleOrderTax" like '%${item}%'
  2165. </foreach>
  2166. </if>
  2167. <if test="saleRemark != null">
  2168. and
  2169. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2170. "saleRemark" like '%${item}%'
  2171. </foreach>
  2172. </if>
  2173. </where>
  2174. <include refid="orderBy"></include>
  2175. </select>
  2176. <select id="getSaleOrderAndMaterialById" resultType="java.util.Map" parameterType="java.util.Map">
  2177. SELECT *
  2178. FROM (
  2179. SELECT
  2180. ASO.SALE_ORDER_ID AS "saleOrderId",
  2181. ASM.SALE_MATERIAL_ID AS "saleMaterialId",
  2182. RM.MATERIAL_ID AS "materialId",
  2183. ASO.SALE_NUMBER AS "saleNumber",
  2184. ASO.SALE_ORDER_ISSELF_MENTION AS "saleOrderIsselfMention",
  2185. ASO.SALE_REMARK AS "saleRemark",
  2186. RS.SHIPPER_NAME AS "shipperName",
  2187. RC.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2188. RM.MATERIAL_NAME AS "materialName",
  2189. ASM.MATERIAL_NUMBER AS "materialNumber",
  2190. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2191. ASM.SALE_WAREHOUSE AS "saleWareHouse",
  2192. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2193. RM.MATERIAL_CODE AS "materialCode",
  2194. nvl( sumWeight.weight, 0 ) + nvl( sumWeight2.weight, 0 ) + + nvl( sumWeight3.weight, 0 ) AS "totalWeight",
  2195. nvl( sumWeight.weight, 0 ) AS "netWeight",
  2196. nvl( sumWeight2.weight, 0 ) AS "weight",
  2197. nvl( carCount.coun, 0 ) + nvl( carCount1.coun, 0 ) AS "carCount"
  2198. FROM
  2199. AMS_SALE_ORDER ASO
  2200. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  2201. LEFT JOIN RMS_CONSIGNEE RC ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2202. LEFT JOIN AMS_SALE_MATERIAL ASM ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2203. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2204. LEFT JOIN (
  2205. SELECT
  2206. sum( t_w_result.RESULT_NET_WEIGHT ) weight,
  2207. a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  2208. FROM
  2209. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2210. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2211. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2212. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2213. WHERE
  2214. o_order.ORDER_TYPE = 2
  2215. GROUP BY
  2216. a_s_o_Material.SALE_ORDER_ID
  2217. ) sumWeight ON sumWeight.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2218. LEFT JOIN (
  2219. SELECT
  2220. sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
  2221. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2222. FROM
  2223. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2224. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2225. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2226. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2227. LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
  2228. WHERE
  2229. t_w_result.RESULT_NET_WEIGHT IS NULL
  2230. AND o_order.order_status IN ( 2, 5 )
  2231. AND o_order.ORDER_TYPE = 2
  2232. GROUP BY
  2233. a_s_o_Material.SALE_ORDER_ID
  2234. ) sumWeight2 ON sumWeight2.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2235. LEFT JOIN (
  2236. SELECT
  2237. sum( o_o_material.ORDER_MATERIAL_WEIGHT ) weight,
  2238. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2239. FROM
  2240. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2241. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2242. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2243. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2244. LEFT JOIN OMSTRUCK_ORDER_MATERIAL o_o_material ON o_order.order_id = o_o_material.ORDER_ID
  2245. WHERE
  2246. t_w_result.RESULT_NET_WEIGHT IS NULL
  2247. AND o_order.order_status = 4
  2248. AND o_order.ORDER_TYPE = 2
  2249. AND a_s_o_material.SALE_DATE_OF_RECEIPT &lt; SYSDATE
  2250. GROUP BY
  2251. a_s_o_Material.SALE_ORDER_ID
  2252. ) sumWeight3 ON sumWeight3.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2253. LEFT JOIN (
  2254. SELECT
  2255. count( o_order.order_id ) coun,
  2256. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2257. FROM
  2258. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2259. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2260. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2261. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2262. WHERE
  2263. o_order.order_status IN ( 2, 5 )
  2264. AND o_order.ORDER_TYPE = 2
  2265. GROUP BY
  2266. a_s_o_Material.SALE_ORDER_ID
  2267. ) carCount ON carCount.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2268. LEFT JOIN (
  2269. SELECT
  2270. count( o_order.order_id ) coun,
  2271. a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  2272. FROM
  2273. AMS_SALE_ORDER_MATERIAL a_s_o_material
  2274. LEFT JOIN Omstruck_Order o_order ON a_s_o_material.SALE_ORDER_MATERIAL_ID = o_order.order_plan_id
  2275. LEFT JOIN Tmstruck_Total_Result t_t_result ON o_order.order_id = t_t_result.order_id
  2276. LEFT JOIN Tmstruck_Weight_Result t_w_result ON t_t_result.result_total_id = t_w_result.result_total_id
  2277. WHERE
  2278. o_order.order_status = 4
  2279. AND o_order.ORDER_TYPE = 2
  2280. AND a_s_o_material.SALE_DATE_OF_RECEIPT &lt; SYSDATE
  2281. GROUP BY
  2282. a_s_o_Material.SALE_ORDER_ID
  2283. ) carCount1 ON carCount1.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2284. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2285. )
  2286. <where>
  2287. <if test="saleNumber != null">
  2288. and
  2289. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2290. "saleNumber" like '%${item}%'
  2291. </foreach>
  2292. </if>
  2293. <if test="shipperName != null">
  2294. and
  2295. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2296. "shipperName" like '%${item}%'
  2297. </foreach>
  2298. </if>
  2299. <if test="consigneeCompanyName != null">
  2300. and
  2301. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2302. "consigneeCompanyName" like '%${item}%'
  2303. </foreach>
  2304. </if>
  2305. <if test="materialName != null">
  2306. and
  2307. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2308. "materialName" like '%${item}%'
  2309. </foreach>
  2310. </if>
  2311. <if test="specificationModel != null">
  2312. and
  2313. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2314. "specificationModel" like '%${item}%'
  2315. </foreach>
  2316. </if>
  2317. <if test="materialCode != null">
  2318. and
  2319. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2320. "materialCode" like '%${item}%'
  2321. </foreach>
  2322. </if>
  2323. </where>
  2324. </select>
  2325. <select id="getSaleOrderAndMaterialById2" resultType="java.util.Map" parameterType="java.util.Map">
  2326. SELECT *
  2327. FROM (
  2328. select ASO.SALE_ORDER_ID as "saleOrderId",
  2329. ASM.SALE_MATERIAL_ID as "saleMaterialId",
  2330. RM.MATERIAL_ID as "materialId",
  2331. ASO.SALE_NUMBER as "saleNumber",
  2332. ASO.SALE_ORDER_ISSELF_MENTION as "saleOrderIsselfMention",
  2333. RS.SHIPPER_NAME as "shipperName",
  2334. RC.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  2335. RM.MATERIAL_NAME as "materialName",
  2336. ASM.MATERIAL_NUMBER as "materialNumber",
  2337. ASM.MATERIAL_WEIGHT as "materialWeight",
  2338. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
  2339. RM.MATERIAL_CODE as "materialCode"
  2340. from AMS_SALE_ORDER ASO
  2341. left join RMS_SHIPPER RS
  2342. on ASO.SHIPPER_ID = RS.SHIPPER_ID
  2343. left join RMS_CONSIGNEE RC
  2344. on ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  2345. left join AMS_SALE_MATERIAL ASM
  2346. on ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  2347. left join RMS_MATERIAL RM
  2348. on RM.MATERIAL_ID = ASM.MATERIAL_ID
  2349. where ASO.SALE_ORDER_ID = #{saleOrderId}
  2350. )
  2351. <where>
  2352. <if test="saleNumber != null">
  2353. and
  2354. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2355. "saleNumber" like '%${item}%'
  2356. </foreach>
  2357. </if>
  2358. <if test="shipperName != null">
  2359. and
  2360. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2361. "shipperName" like '%${item}%'
  2362. </foreach>
  2363. </if>
  2364. <if test="consigneeCompanyName != null">
  2365. and
  2366. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2367. "consigneeCompanyName" like '%${item}%'
  2368. </foreach>
  2369. </if>
  2370. <if test="materialName != null">
  2371. and
  2372. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2373. "materialName" like '%${item}%'
  2374. </foreach>
  2375. </if>
  2376. <if test="specificationModel != null">
  2377. and
  2378. <foreach collection="specificationModel" item="item" open="(" separator="or" close=")">
  2379. "specificationModel" like '%${item}%'
  2380. </foreach>
  2381. </if>
  2382. <if test="materialCode != null">
  2383. and
  2384. <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
  2385. "materialCode" like '%${item}%'
  2386. </foreach>
  2387. </if>
  2388. </where>
  2389. </select>
  2390. <select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
  2391. SELECT * FROM (SELECT
  2392. RM.MATERIAL_NAME AS "materialName",
  2393. ASM.SALE_WAREHOUSE AS "saleWareHouse"
  2394. FROM AMS_SALE_MATERIAL ASM
  2395. LEFT JOIN RMS_MATERIAL RM
  2396. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2397. WHERE ASM.SALE_ORDER_ID = #{saleOrderId}
  2398. <if test="con != null">
  2399. AND instr(RM.MATERIAL_NAME, #{con}) > 0
  2400. </if>
  2401. )
  2402. <where>
  2403. <if test="materialName != null">
  2404. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2405. "materialName" like '%${item}%'
  2406. </foreach>
  2407. </if>
  2408. </where>
  2409. </select>
  2410. <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
  2411. SELECT SUM(twr.RESULT_NET_WEIGHT)
  2412. FROM AMS_SALE_ORDER_MATERIAL asom
  2413. left join OMSTRUCK_ORDER oo on oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  2414. left join TMSTRUCK_TOTAL_RESULT ttr on ttr.ORDER_ID = oo.ORDER_ID
  2415. left join TMSTRUCK_WEIGHT_RESULT twr on twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  2416. where asom.sale_order_id = #{saleOrderId}
  2417. </select>
  2418. <select id="getCarNum" parameterType="DECIMAL" resultType="DECIMAL">
  2419. SELECT COUNT(ASOM.SALE_ORDER_MATERIAL_ID)
  2420. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2421. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2422. </select>
  2423. <select id="getTruckNoAndMaterial" parameterType="java.util.Map" resultType="java.util.Map" >
  2424. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2425. RM.MATERIAL_NAME AS "materialName",
  2426. ASM.MATERIAL_ID AS "materialId",
  2427. ASM.MATERIAL_NUMBER AS "materialNumber",
  2428. ASM.MATERIAL_WEIGHT AS "materialWeight",
  2429. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2430. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  2431. RM.MATERIAL_CODE AS "materialCode",
  2432. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  2433. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  2434. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  2435. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2436. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  2437. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2438. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  2439. RC.CAPACITY_NUMBER AS "capacityNumber",
  2440. ADSO.CARRIER_ID AS "carrierId",
  2441. RCA.CARRIER_NAME AS "carrierName",
  2442. ASOM.TRUCK_REMARK AS "truckRemark",
  2443. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr"
  2444. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  2445. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2446. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  2447. LEFT JOIN AMS_SALE_ORDER ASO
  2448. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2449. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2450. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2451. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2452. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2453. LEFT JOIN AMS_SALE_MATERIAL ASM
  2454. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  2455. LEFT JOIN RMS_MATERIAL RM
  2456. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2457. LEFT JOIN OMSTRUCK_ORDER OO
  2458. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2459. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  2460. LEFT JOIN RMS_CAPACITY RC
  2461. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  2462. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2463. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2464. LEFT JOIN RMS_CARRIER RCA
  2465. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  2466. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  2467. <if test="carrierSsoId != null">
  2468. AND RCA.CARRIER_SSO_ID = #{carrierSsoId}
  2469. </if>
  2470. AND OO.ORDER_ID IS NULL
  2471. AND ADSO.DISPATCH_ID IS NOT NULL
  2472. AND ASM.DELETED IS NULL
  2473. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2474. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  2475. </select>
  2476. <select id="getAddressByPlace" parameterType="DECIMAL" resultType="DECIMAL" >
  2477. SELECT RRP.ADDRESS_ID AS "adddressId"
  2478. FROM RMS_RECEIVE_PLACE RRP
  2479. WHERE RRP.PLACE_ID = #{placeId}
  2480. </select>
  2481. <select id="getCarrierByPlace" parameterType="DECIMAL" resultType="java.util.Map">
  2482. SELECT DISTINCT RC.CARRIER_ID AS "id",
  2483. RC.CARRIER_ID AS "value",
  2484. RC.CARRIER_NAME AS "label",
  2485. ACTP.PRICE_ID AS "priceId",
  2486. ACTP.PRICE_VALUE AS "priceValue"
  2487. FROM RMS_RECEIVE_PLACE RRP
  2488. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2489. ON ACTP.PLACE_ID = RRP.PLACE_ID
  2490. LEFT JOIN RMS_CARRIER RC
  2491. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  2492. WHERE RRP.PLACE_ID = #{placeId}
  2493. AND ACTP.CARRIER_ID IS NOT NULL
  2494. AND ACTP.DELETED = 0
  2495. ORDER BY ACTP.PRICE_VALUE DESC
  2496. </select>
  2497. <select id="getPriceByCarrierAndPlace" parameterType="java.util.Map" resultType="java.util.Map">
  2498. SELECT ACTP.PRICE_ID AS "priceId",
  2499. ACTP.PRICE_VALUE AS "priceValue"
  2500. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  2501. WHERE ACTP.CARRIER_ID = #{carrierId}
  2502. AND ACTP.PLACE_ID = #{placeId}
  2503. AND ACTP.DELETED = 0
  2504. </select>
  2505. <select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
  2506. SELECT * FROM (
  2507. select DISTINCT * from(
  2508. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2509. a_s_order.SALE_NUMBER "saleNumber",
  2510. r_shipper.SHIPPER_NAME "shipperName",
  2511. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2512. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2513. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2514. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2515. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2516. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2517. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2518. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2519. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2520. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2521. a_s_order.SALE_REMARK "saleRemark",
  2522. a_s_order.INSERT_TIME "insertTime",
  2523. DECODE(a_s_order.SALE_ORDER_STATUS,1,'订单已上报',2,'销售已提交',4,'财务已审批') "statusStr",
  2524. a_s_order.UPDATE_TIME "updateTime",
  2525. RM.MATERIAL_NAME "materialName",
  2526. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2527. RM.MATERIAL_MODEL "materialModel",
  2528. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  2529. ASM.MATERIAL_NUMBER "materialNumber",
  2530. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  2531. ASOM.SALE_SHIPPING_ADDRESS_ID "saleShippingAddressId"
  2532. from AMS_SALE_ORDER a_s_order
  2533. left join RMS_SHIPPER r_shipper
  2534. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2535. left join RMS_CONSIGNEE r_consignee
  2536. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2537. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  2538. ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2539. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2540. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2541. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2542. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2543. LEFT JOIN RMS_CARRIER RC
  2544. ON RC.CARRIER_ID = ADSO.CARRIER_ID
  2545. LEFT JOIN OMSTRUCK_ORDER OO
  2546. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2547. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  2548. LEFT JOIN AMS_SALE_MATERIAL ASM
  2549. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2550. LEFT JOIN RMS_MATERIAL RM
  2551. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2552. where a_s_order.SALE_ORDER_STATUS in (1,2,4)
  2553. and a_s_order.CLOSE_STATUS is null
  2554. and a_s_order.DELETED = 0
  2555. and ADSO.DISPATCH_TYPE = 2
  2556. and OO.ORDER_ID IS NULL
  2557. AND ASM.DELETED IS NULL
  2558. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2559. <if test="oneDate != null">
  2560. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = a_s_order.INSERT_TIME
  2561. </if>
  2562. <if test="startDate != null">
  2563. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.INSERT_TIME
  2564. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.INSERT_TIME
  2565. </if>
  2566. <if test="carrierSsoId != null" >
  2567. and RC.CARRIER_SSO_ID = #{carrierSsoId}
  2568. </if>
  2569. ) "CARRIER"
  2570. <where>
  2571. <if test="con != null">
  2572. "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
  2573. </if>
  2574. </where>
  2575. )
  2576. <where>
  2577. <if test="saleNumber != null">
  2578. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2579. "saleNumber" like '%${item}%'
  2580. </foreach>
  2581. </if>
  2582. <if test="materialName != null">
  2583. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2584. "materialName" like '%${item}%'
  2585. </foreach>
  2586. </if>
  2587. <if test="materialSpecification != null">
  2588. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2589. "materialSpecification" like '%${item}%'
  2590. </foreach>
  2591. </if>
  2592. <if test="materialModel != null">
  2593. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2594. "materialModel" like '%${item}%'
  2595. </foreach>
  2596. </if>
  2597. <if test="shipperName != null">
  2598. and
  2599. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2600. "shipperName" like '%${item}%'
  2601. </foreach>
  2602. </if>
  2603. <if test="consigneeCompanyName != null">
  2604. and
  2605. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2606. "consigneeCompanyName" like '%${item}%'
  2607. </foreach>
  2608. </if>
  2609. <if test="consigneeWarrantyAmount != null">
  2610. and
  2611. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2612. "consigneeWarrantyAmount" like '%${item}%'
  2613. </foreach>
  2614. </if>
  2615. <if test="consigneeWarrantyWeight != null">
  2616. and
  2617. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2618. "consigneeWarrantyWeight" like '%${item}%'
  2619. </foreach>
  2620. </if>
  2621. <if test="saleOrderIsselfMention != null">
  2622. and
  2623. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2624. "saleOrderIsselfMention" like '%${item}%'
  2625. </foreach>
  2626. </if>
  2627. <if test="saleAccountBalance != null">
  2628. and
  2629. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2630. "saleAccountBalance" like '%${item}%'
  2631. </foreach>
  2632. </if>
  2633. <if test="saleCurrentOrderAmount != null">
  2634. and
  2635. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2636. "saleCurrentOrderAmount" like '%${item}%'
  2637. </foreach>
  2638. </if>
  2639. <if test="saleHistoricalOrderAmout != null">
  2640. and
  2641. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2642. "saleHistoricalOrderAmout" like '%${item}%'
  2643. </foreach>
  2644. </if>
  2645. <if test="saleOrderReceiveCustomer != null">
  2646. and
  2647. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2648. "saleOrderReceiveCustomer" like '%${item}%'
  2649. </foreach>
  2650. </if>
  2651. <if test="saleUnitPrice != null">
  2652. and
  2653. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2654. "saleUnitPrice" like '%${item}%'
  2655. </foreach>
  2656. </if>
  2657. <if test="saleOrderTax != null">
  2658. and
  2659. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2660. "saleOrderTax" like '%${item}%'
  2661. </foreach>
  2662. </if>
  2663. <if test="saleRemark != null">
  2664. and
  2665. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2666. "saleRemark" like '%${item}%'
  2667. </foreach>
  2668. </if>
  2669. </where>
  2670. order by "updateTime" DESC
  2671. </select>
  2672. <select id="getshippingAddress" resultType="java.lang.String">
  2673. select
  2674. distinct
  2675. RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN
  2676. ||RRP.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress" FROM AMS_SALE_ORDER_MATERIAL ASOM
  2677. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2678. ON RRP.PLACE_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  2679. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2680. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  2681. WHERE ASOM.SALE_SHIPPING_ADDRESS_ID = #{saleShippingAddressId}
  2682. and rownum =1
  2683. </select>
  2684. <select id="getSaleOrderListByCarrierSsoId" resultType="java.util.Map">
  2685. select * from(
  2686. select a_s_order.SALE_ORDER_ID "saleOrderId",
  2687. a_s_order.SALE_NUMBER "saleNumber",
  2688. r_shipper.SHIPPER_NAME "shipperName",
  2689. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  2690. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  2691. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  2692. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  2693. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  2694. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  2695. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  2696. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  2697. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  2698. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  2699. a_s_order.SALE_REMARK "saleRemark",
  2700. a_s_order.INSERT_TIME "insertTime",
  2701. a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
  2702. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  2703. RM.MATERIAL_NAME "materialName",
  2704. RM.MATERIAL_SPECIFICATION "materialSpecification",
  2705. RM.MATERIAL_MODEL "materialModel",
  2706. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
  2707. from AMS_SALE_ORDER_CARRIER a_s_o_carrier
  2708. left join RMS_CARRIER r_carrier
  2709. on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
  2710. left join AMS_SALE_ORDER a_s_order
  2711. on a_s_o_carrier.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  2712. left join RMS_SHIPPER r_shipper
  2713. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  2714. left join RMS_CONSIGNEE r_consignee
  2715. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  2716. LEFT JOIN AMS_SALE_MATERIAL ASM
  2717. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  2718. LEFT JOIN RMS_MATERIAL RM
  2719. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2720. where a_s_order.SALE_ORDER_STATUS in (2,4)
  2721. and a_s_order.CLOSE_STATUS is null
  2722. and a_s_order.DELETED = 0
  2723. <if test="carrierSsoId != null">
  2724. and r_carrier.CARRIER_SSO_ID=#{carrierSsoId}
  2725. </if>
  2726. <if test="con != null">
  2727. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  2728. </if>
  2729. )
  2730. <where>
  2731. <if test="saleNumber != null">
  2732. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2733. "saleNumber" like '%${item}%'
  2734. </foreach>
  2735. </if>
  2736. <if test="materialName != null">
  2737. and
  2738. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2739. "materialName" like '%${item}%'
  2740. </foreach>
  2741. </if>
  2742. <if test="materialSpecification != null">
  2743. and
  2744. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2745. "materialSpecification" like '%${item}%'
  2746. </foreach>
  2747. </if>
  2748. <if test="materialModel != null">
  2749. and
  2750. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2751. "materialModel" like '%${item}%'
  2752. </foreach>
  2753. </if>
  2754. <if test="shipperName != null">
  2755. and
  2756. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2757. "shipperName" like '%${item}%'
  2758. </foreach>
  2759. </if>
  2760. <if test="consigneeCompanyName != null">
  2761. and
  2762. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2763. "consigneeCompanyName" like '%${item}%'
  2764. </foreach>
  2765. </if>
  2766. <if test="consigneeWarrantyAmount != null">
  2767. and
  2768. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  2769. "consigneeWarrantyAmount" like '%${item}%'
  2770. </foreach>
  2771. </if>
  2772. <if test="consigneeWarrantyWeight != null">
  2773. and
  2774. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  2775. "consigneeWarrantyWeight" like '%${item}%'
  2776. </foreach>
  2777. </if>
  2778. <if test="saleOrderIsselfMention != null">
  2779. and
  2780. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  2781. "saleOrderIsselfMention" like '%${item}%'
  2782. </foreach>
  2783. </if>
  2784. <if test="saleAccountBalance != null">
  2785. and
  2786. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  2787. "saleAccountBalance" like '%${item}%'
  2788. </foreach>
  2789. </if>
  2790. <if test="saleCurrentOrderAmount != null">
  2791. and
  2792. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  2793. "saleCurrentOrderAmount" like '%${item}%'
  2794. </foreach>
  2795. </if>
  2796. <if test="saleHistoricalOrderAmout != null">
  2797. and
  2798. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  2799. "saleHistoricalOrderAmout" like '%${item}%'
  2800. </foreach>
  2801. </if>
  2802. <if test="saleOrderReceiveCustomer != null">
  2803. and
  2804. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  2805. "saleOrderReceiveCustomer" like '%${item}%'
  2806. </foreach>
  2807. </if>
  2808. <if test="saleUnitPrice != null">
  2809. and
  2810. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  2811. "saleUnitPrice" like '%${item}%'
  2812. </foreach>
  2813. </if>
  2814. <if test="saleOrderTax != null">
  2815. and
  2816. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  2817. "saleOrderTax" like '%${item}%'
  2818. </foreach>
  2819. </if>
  2820. <if test="saleRemark != null">
  2821. and
  2822. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  2823. "saleRemark" like '%${item}%'
  2824. </foreach>
  2825. </if>
  2826. </where>
  2827. <include refid="orderBy1"></include>
  2828. </select>
  2829. <select id="getSteelTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2830. SELECT *
  2831. FROM (
  2832. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2833. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2834. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2835. "addressDeliveryAddress",
  2836. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2837. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  2838. AS "approvalStatus",
  2839. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2840. RSH.SHIPPER_NAME AS "shipperName",
  2841. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2842. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2843. ASOM.INSERT_TIME AS "insertTime",
  2844. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2845. ASO.SALE_ORDER_ID AS "saleOrderId",
  2846. RM.MATERIAL_NAME AS "materialName",
  2847. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  2848. RM.MATERIAL_MODEL AS "materialModel",
  2849. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2850. ASM.MATERIAL_NUMBER AS "materialNumber",
  2851. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
  2852. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2853. LEFT JOIN AMS_SALE_ORDER ASO
  2854. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  2855. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2856. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2857. LEFT JOIN RMS_RECEIVE_PLACE RRP
  2858. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  2859. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  2860. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  2861. LEFT JOIN RMS_SHIPPER RSH
  2862. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  2863. LEFT JOIN RMS_CONSIGNEE RCO
  2864. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  2865. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  2866. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2867. LEFT JOIN AMS_SALE_MATERIAL ASM
  2868. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2869. LEFT JOIN RMS_MATERIAL RM
  2870. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2871. WHERE ASO.SALE_ORDER_STATUS IN (1,2,4)
  2872. AND ASOM.ISSUE_STATUS IS NULL
  2873. AND ADSO.CARRIER_ID IS NULL
  2874. AND ASO.DELETED = 0
  2875. AND ASM.DELETED IS NULL
  2876. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  2877. <if test="oneDate != null">
  2878. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  2879. </if>
  2880. <if test="startDate != null">
  2881. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  2882. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  2883. </if>
  2884. <if test="con != null" >
  2885. AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
  2886. </if>
  2887. )
  2888. <where>
  2889. <if test="saleNumber != null">
  2890. and
  2891. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  2892. "saleNumber" like '%${item}%'
  2893. </foreach>
  2894. </if>
  2895. <if test="materialName != null">
  2896. and
  2897. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  2898. "materialName" like '%${item}%'
  2899. </foreach>
  2900. </if>
  2901. <if test="materialModel != null">
  2902. and
  2903. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  2904. "materialModel" like '%${item}%'
  2905. </foreach>
  2906. </if>
  2907. <if test="materialSpecification != null">
  2908. and
  2909. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  2910. "materialSpecification" like '%${item}%'
  2911. </foreach>
  2912. </if>
  2913. <if test="truckNo != null">
  2914. and
  2915. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  2916. "truckNo" like '%${item}%'
  2917. </foreach>
  2918. </if>
  2919. <if test="addressDeliveryAddress != null">
  2920. and
  2921. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  2922. "addressDeliveryAddress" like '%${item}%'
  2923. </foreach>
  2924. </if>
  2925. <if test="saleDateOfReceipt != null">
  2926. and
  2927. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  2928. "saleDateOfReceipt" like '%${item}%'
  2929. </foreach>
  2930. </if>
  2931. <if test="saleOrderConsignee != null">
  2932. and
  2933. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  2934. "saleOrderConsignee" like '%${item}%'
  2935. </foreach>
  2936. </if>
  2937. <if test="saleOrderConsigneeTel != null">
  2938. and
  2939. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  2940. "saleOrderConsigneeTel" like '%${item}%'
  2941. </foreach>
  2942. </if>
  2943. <if test="shipperName != null">
  2944. and
  2945. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  2946. "shipperName" like '%${item}%'
  2947. </foreach>
  2948. </if>
  2949. <if test="consigneeCompanyName != null">
  2950. and
  2951. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  2952. "consigneeCompanyName" like '%${item}%'
  2953. </foreach>
  2954. </if>
  2955. <if test="isselfMention != null">
  2956. and
  2957. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  2958. "isselfMention" like '%${item}%'
  2959. </foreach>
  2960. </if>
  2961. </where>
  2962. <include refid="orderBy"></include>
  2963. </select>
  2964. <select id="getTruckNoMaterial" resultType="java.util.Map" parameterType="DECIMAL" >
  2965. SELECT
  2966. RM.MATERIAL_ID AS "materialId",
  2967. RM.MATERIAL_NAME AS "materialName",
  2968. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  2969. RM.MATERIAL_CODE AS "materialCode",
  2970. ASTM.SALE_ORDER_MATERIAL_NUMBER AS "materialNumber"
  2971. FROM AMS_SALE_ORDER_MATERIAL ASOM
  2972. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  2973. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  2974. LEFT JOIN AMS_SALE_MATERIAL ASM
  2975. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  2976. LEFT JOIN RMS_MATERIAL RM
  2977. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  2978. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  2979. </select>
  2980. <select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
  2981. SELECT * FROM(
  2982. SELECT DISTINCT *
  2983. FROM (
  2984. SELECT ASO.SALE_NUMBER AS "saleNumber",
  2985. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  2986. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  2987. "addressDeliveryAddress",
  2988. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  2989. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  2990. AS "approvalStatus",
  2991. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  2992. RSH.SHIPPER_NAME AS "shipperName",
  2993. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  2994. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  2995. ASOM.INSERT_TIME AS "insertTime",
  2996. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  2997. ASO.SALE_ORDER_ID AS "saleOrderId",
  2998. RCA.CARRIER_NAME AS "carrierName",
  2999. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3000. RM.MATERIAL_NAME AS "materialName",
  3001. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3002. RM.MATERIAL_MODEL AS "materialModel",
  3003. RM.MATERIAL_SPECIFICATION || MATERIAL_MODEL AS "specificationModel",
  3004. ASM.MATERIAL_NUMBER AS "materialNumber"
  3005. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3006. LEFT JOIN AMS_SALE_ORDER ASO
  3007. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3008. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3009. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3010. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3011. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3012. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3013. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3014. LEFT JOIN RMS_SHIPPER RSH
  3015. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3016. LEFT JOIN RMS_CONSIGNEE RCO
  3017. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3018. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3019. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3020. LEFT JOIN OMSTRUCK_ORDER OO
  3021. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3022. AND NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  3023. LEFT JOIN RMS_CARRIER RCA
  3024. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3025. LEFT JOIN AMS_SALE_MATERIAL ASM
  3026. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3027. LEFT JOIN RMS_MATERIAL RM
  3028. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3029. WHERE ASO.SALE_ORDER_STATUS IN (2,4)
  3030. AND ASOM.ISSUE_STATUS IS NULL
  3031. AND ADSO.DISPATCH_TYPE = 2
  3032. AND OO.ORDER_ID IS NULL
  3033. AND ASO.DELETED = 0
  3034. AND ASM.DELETED IS NULL
  3035. AND ASM.SALE_MATERIAL_ID IS NOT NULL
  3036. <if test="oneDate != null">
  3037. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  3038. </if>
  3039. <if test="startDate != null">
  3040. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  3041. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  3042. </if>
  3043. ) "NOCAR"
  3044. <where>
  3045. <if test="con != null" >
  3046. "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
  3047. </if>
  3048. </where>
  3049. )
  3050. <where>
  3051. <if test="saleNumber != null">
  3052. and
  3053. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3054. "saleNumber" like '%${item}%'
  3055. </foreach>
  3056. </if>
  3057. <if test="materialName != null">
  3058. and
  3059. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3060. "materialName" like '%${item}%'
  3061. </foreach>
  3062. </if>
  3063. <if test="materialModel != null">
  3064. and
  3065. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3066. "materialModel" like '%${item}%'
  3067. </foreach>
  3068. </if>
  3069. <if test="materialSpecification != null">
  3070. and
  3071. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3072. "materialSpecification" like '%${item}%'
  3073. </foreach>
  3074. </if>
  3075. <if test="carrierName != null">
  3076. and
  3077. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3078. "carrierName" like '%${item}%'
  3079. </foreach>
  3080. </if>
  3081. <if test="truckNo != null">
  3082. and
  3083. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3084. "truckNo" like '%${item}%'
  3085. </foreach>
  3086. </if>
  3087. <if test="addressDeliveryAddress != null">
  3088. and
  3089. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3090. "addressDeliveryAddress" like '%${item}%'
  3091. </foreach>
  3092. </if>
  3093. <if test="saleDateOfReceipt != null">
  3094. and
  3095. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3096. "saleDateOfReceipt" like '%${item}%'
  3097. </foreach>
  3098. </if>
  3099. <if test="saleOrderConsignee != null">
  3100. and
  3101. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3102. "saleOrderConsignee" like '%${item}%'
  3103. </foreach>
  3104. </if>
  3105. <if test="saleOrderConsigneeTel != null">
  3106. and
  3107. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3108. "saleOrderConsigneeTel" like '%${item}%'
  3109. </foreach>
  3110. </if>
  3111. <if test="shipperName != null">
  3112. and
  3113. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3114. "shipperName" like '%${item}%'
  3115. </foreach>
  3116. </if>
  3117. <if test="consigneeCompanyName != null">
  3118. and
  3119. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3120. "consigneeCompanyName" like '%${item}%'
  3121. </foreach>
  3122. </if>
  3123. <if test="isselfMention != null">
  3124. and
  3125. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3126. "isselfMention" like '%${item}%'
  3127. </foreach>
  3128. </if>
  3129. </where>
  3130. <include refid="orderBy"></include>
  3131. </select>
  3132. <select id="getTruckNoMaterialAndCarrier" parameterType="DECIMAL" resultType="java.util.Map" >
  3133. SELECT DISTINCT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3134. RM.MATERIAL_NAME AS "materialName",
  3135. ASM.MATERIAL_ID AS "materialId",
  3136. ASM.MATERIAL_NUMBER AS "materialNumber",
  3137. ASM.MATERIAL_WEIGHT AS "materialWeight",
  3138. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3139. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "materialModelSpecification",
  3140. RM.MATERIAL_CODE AS "materialCode",
  3141. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN ||
  3142. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3143. ASOM.SALE_DATE_OF_RECEIPT AS "receiptDate",
  3144. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3145. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3146. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3147. ASOM.SALE_SHIPPING_ADDRESS_ID AS "placeId",
  3148. RC.CAPACITY_NUMBER AS "capacityNumber",
  3149. ADSO.CARRIER_ID AS "carrierId",
  3150. ASOM.TRUCK_REMARK AS "truckRemark"
  3151. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3152. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3153. ON ASOM.SALE_ORDER_MATERIAL_ID = ASTM.SALE_ORDER_MATERIAL_ID
  3154. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3155. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3156. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3157. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3158. LEFT JOIN AMS_SALE_MATERIAL ASM
  3159. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  3160. LEFT JOIN RMS_MATERIAL RM
  3161. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3162. LEFT JOIN OMSTRUCK_ORDER OO
  3163. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3164. and NVL(OO.ORDER_TYPE,0) BETWEEN 0 AND 1
  3165. LEFT JOIN RMS_CAPACITY RC
  3166. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  3167. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3168. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3169. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3170. and ASM.SALE_MATERIAL_ID IS NOT NULL
  3171. ORDER BY ASOM.SALE_ORDER_MATERIAL_TRUCK_NO ASC
  3172. </select>
  3173. <select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  3174. SELECT * FROM (
  3175. SELECT DISTINCT *
  3176. FROM (
  3177. SELECT ASO.SALE_NUMBER AS "saleNumber",
  3178. ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3179. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS
  3180. "addressDeliveryAddress",
  3181. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3182. DECODE(ASO.SALE_ORDER_STATUS,1,'订单已上报',2, '销售已提交',4, '财务已审批')
  3183. AS "approvalStatus",
  3184. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3185. RSH.SHIPPER_NAME AS "shipperName",
  3186. RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
  3187. ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
  3188. ASOM.INSERT_TIME AS "insertTime",
  3189. ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
  3190. ASO.SALE_ORDER_ID AS "saleOrderId",
  3191. RCA.CARRIER_NAME AS "carrierName",
  3192. RM.MATERIAL_NAME AS "materialName",
  3193. RM.MATERIAL_SPECIFICATION AS "materialSpecification",
  3194. RM.MATERIAL_MODEL AS "materialModel",
  3195. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "specificationModel",
  3196. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
  3197. RCP.CAPACITY_NUMBER AS "capacityNumber",
  3198. OO.DRIVER_TEL AS "drivelTel",
  3199. ASM.MATERIAL_NUMBER AS "materialNumber",
  3200. OO.ORDER_ID AS "orderId"
  3201. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3202. LEFT JOIN AMS_SALE_ORDER ASO
  3203. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3204. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3205. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3206. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3207. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3208. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3209. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3210. LEFT JOIN RMS_SHIPPER RSH
  3211. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3212. LEFT JOIN RMS_CONSIGNEE RCO
  3213. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3214. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3215. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3216. LEFT JOIN OMSTRUCK_ORDER OO
  3217. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3218. LEFT JOIN RMS_CAPACITY RCP
  3219. ON RCP.CAPACITY_ID = OO.CAPACITY_ID
  3220. LEFT JOIN RMS_CARRIER RCA
  3221. ON RCA.CARRIER_ID = ADSO.CARRIER_ID
  3222. LEFT JOIN AMS_SALE_MATERIAL ASM
  3223. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3224. LEFT JOIN RMS_MATERIAL RM
  3225. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3226. WHERE OO.ORDER_TYPE = 1
  3227. AND ASO.SALE_ORDER_STATUS IN (2,4)
  3228. AND ASOM.ISSUE_STATUS IS NULL
  3229. AND ADSO.DISPATCH_TYPE = 2
  3230. AND OO.ORDER_ID IS NOT NULL
  3231. AND OO.ORDER_STATUS IN (4,5)
  3232. AND ASO.DELETED != 2
  3233. AND ASM.DELETED IS NULL
  3234. <if test="oneDate != null">
  3235. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASOM.INSERT_TIME
  3236. </if>
  3237. <if test="startDate != null">
  3238. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASOM.INSERT_TIME
  3239. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASOM.INSERT_TIME
  3240. </if>
  3241. ORDER BY ASOM.SALE_ORDER_MATERIAL_ID DESC
  3242. ) "HAVECAR"
  3243. <where>
  3244. <if test="con != null" >
  3245. "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
  3246. </if>
  3247. </where>
  3248. )
  3249. <where>
  3250. <if test="saleNumber != null">
  3251. and
  3252. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3253. "saleNumber" like '%${item}%'
  3254. </foreach>
  3255. </if>
  3256. <if test="materialName != null">
  3257. and
  3258. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3259. "materialName" like '%${item}%'
  3260. </foreach>
  3261. </if>
  3262. <if test="materialSpecification != null">
  3263. and
  3264. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3265. "materialSpecification" like '%${item}%'
  3266. </foreach>
  3267. </if>
  3268. <if test="materialModel != null">
  3269. and
  3270. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3271. "materialModel" like '%${item}%'
  3272. </foreach>
  3273. </if>
  3274. <if test="materialName != null">
  3275. and
  3276. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3277. "materialName" like '%${item}%'
  3278. </foreach>
  3279. </if>
  3280. <if test="carrierName != null">
  3281. and
  3282. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3283. "carrierName" like '%${item}%'
  3284. </foreach>
  3285. </if>
  3286. <if test="truckNo != null">
  3287. and
  3288. <foreach collection="truckNo" item="item" open="(" separator="or" close=")">
  3289. "truckNo" like '%${item}%'
  3290. </foreach>
  3291. </if>
  3292. <if test="addressDeliveryAddress != null">
  3293. and
  3294. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  3295. "addressDeliveryAddress" like '%${item}%'
  3296. </foreach>
  3297. </if>
  3298. <if test="saleDateOfReceipt != null">
  3299. and
  3300. <foreach collection="saleDateOfReceipt" item="item" open="(" separator="or" close=")">
  3301. "saleDateOfReceipt" like '%${item}%'
  3302. </foreach>
  3303. </if>
  3304. <if test="saleOrderConsignee != null">
  3305. and
  3306. <foreach collection="saleOrderConsignee" item="item" open="(" separator="or" close=")">
  3307. "saleOrderConsignee" like '%${item}%'
  3308. </foreach>
  3309. </if>
  3310. <if test="saleOrderConsigneeTel != null">
  3311. and
  3312. <foreach collection="saleOrderConsigneeTel" item="item" open="(" separator="or" close=")">
  3313. "saleOrderConsigneeTel" like '%${item}%'
  3314. </foreach>
  3315. </if>
  3316. <if test="shipperName != null">
  3317. and
  3318. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3319. "shipperName" like '%${item}%'
  3320. </foreach>
  3321. </if>
  3322. <if test="consigneeCompanyName != null">
  3323. and
  3324. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3325. "consigneeCompanyName" like '%${item}%'
  3326. </foreach>
  3327. </if>
  3328. <if test="isselfMention != null">
  3329. and
  3330. <foreach collection="isselfMention" item="item" open="(" separator="or" close=")">
  3331. "isselfMention" like '%${item}%'
  3332. </foreach>
  3333. </if>
  3334. </where>
  3335. </select>
  3336. <select id="getOrderPrice" parameterType="java.util.Map" resultType="DECIMAL" >
  3337. SELECT PRICE_ID AS "priceId"
  3338. FROM AMS_SALE_ORDER_MATERIAL
  3339. WHERE SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3340. ORDER BY INSERT_TIME DESC
  3341. FETCH NEXT 1 ROWS ONLY
  3342. </select>
  3343. <select id="selectConsigneeName" parameterType="DECIMAL" resultType="java.lang.String" >
  3344. SELECT RC.CONSIGNEE_COMPANY_NAME AS "consigneeName"
  3345. FROM RMS_CONSIGNEE RC
  3346. WHERE RC.CONSIGNEE_ID = #{receiveId}
  3347. </select>
  3348. <select id="selectCarrierId" resultType="DECIMAL" parameterType="java.lang.String">
  3349. SELECT RC.CARRIER_ID AS "carrierId"
  3350. FROM RMS_CARRIER RC
  3351. WHERE RC.CARRIER_NAME = #{consigneeName}
  3352. </select>
  3353. <select id="getSaleMapMessages" resultType="java.util.Map" parameterType="DECIMAL" >
  3354. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "isSelfMention",
  3355. ASO.SALE_REMARK AS "saleRemark",
  3356. ASO.SALE_ORDER_RECEIVE_CUSTOMER AS "saleOrderReceiveCustomer",
  3357. RSH.SHIPPER_ID AS "shipperId",
  3358. RSH.SHIPPER_NAME AS "shipperName",
  3359. RCO.CONSIGNEE_ID AS "receiveId",
  3360. RCO.CONSIGNEE_COMPANY_NAME AS "receiveName",
  3361. RSA.SALER_ID AS "salerId",
  3362. RSA.SALER_NAME AS "salerName"
  3363. FROM AMS_SALE_ORDER ASO
  3364. LEFT JOIN RMS_SHIPPER RSH
  3365. ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
  3366. LEFT JOIN RMS_CONSIGNEE RCO
  3367. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  3368. LEFT JOIN RMS_SALER RSA
  3369. ON RSA.SALER_ID = ASO.SALER_ID
  3370. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  3371. </select>
  3372. <select id="getSaleListMessages" parameterType="DECIMAL" resultType="java.util.Map" >
  3373. SELECT ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "truckNo",
  3374. RRP.ADDRESS_DELIVERY_ADDRESS AS "place",
  3375. RRA.ADDRESS_ID AS "shipperAddressId",
  3376. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN AS "saleShipperAddressName",
  3377. ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
  3378. ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
  3379. ASOM.SALE_DATE_OF_RECEIPT AS "saleDateOfReceipt",
  3380. ASM.MATERIAL_ID AS "materialId",
  3381. RM.MATERIAL_NAME AS "materialName",
  3382. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "Specification",
  3383. RM.MATERIAL_CODE AS "materialCode",
  3384. ASM.MATERIAL_NUMBER AS "materialNumber",
  3385. ASM.STEEL_METER AS "steelMeters",
  3386. ASM.IS_POUND_SALE AS "isPoundSale",
  3387. ASOM.TRUCK_REMARK AS "truckRemark"
  3388. FROM AMS_SALE_ORDER ASO
  3389. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3390. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3391. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3392. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3393. LEFT JOIN AMS_SALE_MATERIAL ASM
  3394. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3395. LEFT JOIN RMS_MATERIAL RM
  3396. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3397. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3398. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3399. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3400. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3401. WHERE asm.SALE_MATERIAL_ID is not null
  3402. and ASO.SALE_ORDER_ID = #{saleOrderId}
  3403. </select>
  3404. <select id="matchingAddressRecently" parameterType="DECIMAL" resultType="java.util.LinkedHashMap" >
  3405. SELECT
  3406. DISTINCT
  3407. RRP.PLACE_ID "placeId",
  3408. RRP.ADDRESS_DELIVERY_ADDRESS "place",
  3409. RRA.ADDRESS_ID "shipperAddressId",
  3410. RRA.ADDRESS_PROVINCE "addressProvince",
  3411. RRA.ADDRESS_DISTRICT "addressDistrict",
  3412. RRA.ADDRESS_TOWN "addressTown",
  3413. ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
  3414. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS "addressPlace",
  3415. max(ASOM.SALE_ORDER_MATERIAL_ID) as b
  3416. FROM AMS_SALE_ORDER ASO
  3417. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3418. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3419. LEFT JOIN RMS_RECEIVE_PLACE RRP
  3420. ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
  3421. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3422. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  3423. WHERE ASO.RECEIVE_ID = #{receiveId}
  3424. AND RRP.PLACE_ID IS NOT NULL
  3425. GROUP BY RRP.PLACE_ID , RRP.ADDRESS_DELIVERY_ADDRESS , RRA.ADDRESS_ID ,
  3426. RRA.ADDRESS_PROVINCE ,
  3427. RRA.ADDRESS_DISTRICT ,
  3428. RRA.ADDRESS_TOWN ,
  3429. ASOM.SALE_ORDER_CONSIGNEE_TEL
  3430. ORDER BY b DESC
  3431. </select>
  3432. <select id="getSalerByReceiveId" parameterType="DECIMAL" resultType="java.util.Map" >
  3433. SELECT DISTINCT *
  3434. FROM (
  3435. SELECT RS.SALER_NAME "salerName",
  3436. RS.SALER_ID "salerId"
  3437. FROM AMS_SALE_ORDER ASO
  3438. LEFT JOIN RMS_SALER RS
  3439. ON RS.SALER_ID = ASO.SALER_ID
  3440. WHERE ASO.RECEIVE_ID = #{receiveId}
  3441. AND RS.SALER_ID IS NOT NULL
  3442. AND ASO.SALE_TYPE = 1
  3443. ORDER BY ASO.SALE_ORDER_ID DESC
  3444. )
  3445. WHERE rownum <![CDATA[
  3446. <
  3447. ]]> 2
  3448. </select>
  3449. <select id="matchingDriverTelRecently" parameterType="java.lang.String" resultType="java.lang.String">
  3450. SELECT DISTINCT *
  3451. FROM (
  3452. SELECT OO.DRIVER_TEL "driverTel"
  3453. FROM RMS_CAPACITY RCA
  3454. LEFT JOIN OMSTRUCK_ORDER OO
  3455. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3456. WHERE RCA.CAPACITY_NUMBER = #{capacityNumber}
  3457. AND OO.ORDER_TYPE = 1
  3458. AND OO.DRIVER_TEL IS NOT NULL
  3459. ORDER BY OO.ORDER_ID DESC
  3460. )
  3461. WHERE ROWNUM <![CDATA[
  3462. <
  3463. ]]> 2
  3464. </select>
  3465. <!-- 查询内转焦炭订单 -->
  3466. <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3467. SELECT * FROM (
  3468. SELECT *from(
  3469. select
  3470. OO.ORDER_NUMBER "orderNumber",
  3471. ASO.SALE_NUMBER "saleNumber",
  3472. RC.CAPACITY_NUMBER "capacityNumber",
  3473. RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3474. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
  3475. ACTP.PRICE_VALUE "priceValue",
  3476. ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
  3477. OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
  3478. RS.SHIPPER_NAME "shipperName",
  3479. OO.ORDER_ID "orderId",
  3480. RC3.CARRIER_NAME "carrierName"
  3481. FROM OMSTRUCK_ORDER OO
  3482. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3483. ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
  3484. LEFT JOIN AMS_SALE_ORDER ASO
  3485. ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
  3486. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  3487. ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3488. LEFT JOIN RMS_CARRIER RC3
  3489. ON RC3.CARRIER_ID = ADSO.CARRIER_ID
  3490. LEFT JOIN RMS_CONSIGNEE RC2
  3491. ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
  3492. LEFT JOIN RMS_CAPACITY RC
  3493. ON OO.CAPACITY_ID=RC.CAPACITY_ID
  3494. LEFT JOIN RMS_SHIPPER RS
  3495. ON RS.SHIPPER_ID=ASO.SHIPPER_ID
  3496. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  3497. ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
  3498. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  3499. ON OO.PRICE_ID=ACTP.PRICE_ID
  3500. WHERE OO.ORDER_TYPE = 2
  3501. AND ASO.SHIPPER_ID = 2
  3502. AND ASO.CLOSE_STATUS = 0
  3503. <where>
  3504. <if test="orderStatus!=null">
  3505. AND OO.ORDER_STATUS = #{orderStatus}
  3506. </if>
  3507. </where>
  3508. ) RRC
  3509. <if test="con != null">
  3510. WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
  3511. </if>
  3512. )
  3513. <where>
  3514. <if test="orderNumber != null">
  3515. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  3516. "orderNumber" like '%${item}%'
  3517. </foreach>
  3518. </if>
  3519. <if test="carrierName != null">
  3520. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  3521. "carrierName" like '%${item}%'
  3522. </foreach>
  3523. </if>
  3524. <if test="saleNumber != null">
  3525. and
  3526. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3527. "saleNumber" like '%${item}%'
  3528. </foreach>
  3529. </if>
  3530. <if test="capacityNumber != null">
  3531. and
  3532. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  3533. "capacityNumber" like '%${item}%'
  3534. </foreach>
  3535. </if>
  3536. <if test="shipperName != null">
  3537. and
  3538. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3539. "shipperName" like '%${item}%'
  3540. </foreach>
  3541. </if>
  3542. <if test="consigneeCompanyName != null">
  3543. and
  3544. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3545. "consigneeCompanyName" like '%${item}%'
  3546. </foreach>
  3547. </if>
  3548. </where>
  3549. <include refid="orderBy">
  3550. </include>
  3551. <if test="orderField == null ">
  3552. order by "orderNumber" desc
  3553. </if>
  3554. </select>
  3555. <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
  3556. SELECT ADSO.DISPATCH_ID AS "dispatchId"
  3557. FROM AMS_DISPATCH_SALE_ORDER ADSO
  3558. WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3559. </select>
  3560. <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="java.util.Map" >
  3561. SELECT ASTM.MATERIAL_ID AS "saleMaterialId",
  3562. ASM.EAS_PRIMARY_ID AS "closeEntryId"
  3563. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3564. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  3565. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3566. LEFT JOIN AMS_SALE_MATERIAL ASM
  3567. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3568. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3569. </select>
  3570. <select id="getSaleList" resultType="java.util.Map" >
  3571. SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
  3572. ASM.SALE_MATERIAL_ID "saleMaterialId",
  3573. ASM.MATERIAL_ID "materialId"
  3574. FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
  3575. LEFT JOIN AMS_SALE_MATERIAL ASM
  3576. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  3577. WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  3578. AND ASM.MATERIAL_ID = #{materialId}
  3579. </select>
  3580. <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  3581. select * from(
  3582. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3583. a_s_order.SALE_NUMBER "saleNumber",
  3584. r_shipper.SHIPPER_NAME "shipperName",
  3585. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3586. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3587. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3588. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3589. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3590. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3591. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3592. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3593. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3594. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3595. a_s_order.SALE_REMARK "saleRemark",
  3596. a_s_order.INSERT_TIME "insertTime",
  3597. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3598. RM.MATERIAL_NAME "materialName",
  3599. ASM.MATERIAL_WEIGHT "materialWeight",
  3600. ASM.SALE_WAREHOUSE "saleWareHouse",
  3601. nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
  3602. nvl(sumWeight.weight ,0) as "netWeight",
  3603. nvl(sumWeight2.weight ,0) as "weight",
  3604. nvl(carCount.coun ,0) as "carCount",
  3605. RCA.CARRIER_NAME as "carrierName"
  3606. from AMS_SALE_ORDER a_s_order
  3607. left join RMS_SHIPPER r_shipper
  3608. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3609. left join RMS_CONSIGNEE r_consignee
  3610. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3611. LEFT JOIN AMS_SALE_MATERIAL ASM
  3612. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3613. LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
  3614. ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3615. LEFT JOIN RMS_CARRIER RCA
  3616. ON RCA.CARRIER_ID = ASOC.CARRIER_ID
  3617. LEFT JOIN RMS_MATERIAL RM
  3618. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3619. left join (
  3620. select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
  3621. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3622. left join Omstruck_Order o_order
  3623. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3624. left join Tmstruck_Total_Result t_t_result
  3625. on o_order.order_id=t_t_result.order_id
  3626. left join Tmstruck_Weight_Result t_w_result
  3627. on t_t_result.result_total_id=t_w_result.result_total_id
  3628. GROUP BY
  3629. a_s_o_Material.SALE_ORDER_ID
  3630. ) sumWeight
  3631. on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3632. left join (
  3633. select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3634. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3635. left join Omstruck_Order o_order
  3636. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3637. left join Tmstruck_Total_Result t_t_result
  3638. on o_order.order_id=t_t_result.order_id
  3639. left join Tmstruck_Weight_Result t_w_result
  3640. on t_t_result.result_total_id=t_w_result.result_total_id
  3641. left join OMSTRUCK_ORDER_MATERIAL o_o_material
  3642. on o_order.order_id=o_o_material.ORDER_ID
  3643. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3644. GROUP BY
  3645. a_s_o_Material.SALE_ORDER_ID
  3646. ) sumWeight2
  3647. on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3648. left join (
  3649. select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
  3650. from AMS_SALE_ORDER_MATERIAL a_s_o_material
  3651. left join Omstruck_Order o_order
  3652. on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
  3653. left join Tmstruck_Total_Result t_t_result
  3654. on o_order.order_id=t_t_result.order_id
  3655. left join Tmstruck_Weight_Result t_w_result
  3656. on t_t_result.result_total_id=t_w_result.result_total_id
  3657. where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
  3658. GROUP BY
  3659. a_s_o_Material.SALE_ORDER_ID
  3660. ) carCount
  3661. on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  3662. where (ASM.SALE_WAREHOUSE = '副产品库'
  3663. or ASM.SALE_WAREHOUSE = '钒渣库')
  3664. and a_s_order.SALE_ORDER_STATUS in (2,4)
  3665. and a_s_order.CLOSE_STATUS is null
  3666. and a_s_order.DELETED = #{deleted}
  3667. and a_s_order.SHIPPER_ID = 1
  3668. and a_s_order.SALE_TYPE is null
  3669. <if test="con != null">
  3670. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3671. </if>
  3672. <if test="consigneeSsoId != null">
  3673. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3674. </if>
  3675. <if test="oneDate != null">
  3676. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3677. </if>
  3678. <if test="startDate != null">
  3679. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3680. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3681. </if>
  3682. ORDER BY a_s_order.UPDATE_TIME DESC
  3683. )
  3684. <where>
  3685. <if test="saleNumber != null">
  3686. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3687. "saleNumber" like '%${item}%'
  3688. </foreach>
  3689. </if>
  3690. <if test="materialName != null">
  3691. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3692. "materialName" like '%${item}%'
  3693. </foreach>
  3694. </if>
  3695. <if test="materialSpecification != null">
  3696. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3697. "materialSpecification" like '%${item}%'
  3698. </foreach>
  3699. </if>
  3700. <if test="materialModel != null">
  3701. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3702. "materialModel" like '%${item}%'
  3703. </foreach>
  3704. </if>
  3705. <if test="statusStr != null">
  3706. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3707. and "statusStr" like '%${item}%'
  3708. </foreach>
  3709. </if>
  3710. <if test="shipperName != null">
  3711. and
  3712. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3713. "shipperName" like '%${item}%'
  3714. </foreach>
  3715. </if>
  3716. <if test="consigneeCompanyName != null">
  3717. and
  3718. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3719. "consigneeCompanyName" like '%${item}%'
  3720. </foreach>
  3721. </if>
  3722. <if test="consigneeWarrantyAmount != null">
  3723. and
  3724. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3725. "consigneeWarrantyAmount" like '%${item}%'
  3726. </foreach>
  3727. </if>
  3728. <if test="consigneeWarrantyWeight != null">
  3729. and
  3730. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3731. "consigneeWarrantyWeight" like '%${item}%'
  3732. </foreach>
  3733. </if>
  3734. <if test="saleOrderIsselfMention != null">
  3735. and
  3736. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3737. "saleOrderIsselfMention" like '%${item}%'
  3738. </foreach>
  3739. </if>
  3740. <if test="saleAccountBalance != null">
  3741. and
  3742. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3743. "saleAccountBalance" like '%${item}%'
  3744. </foreach>
  3745. </if>
  3746. <if test="saleCurrentOrderAmount != null">
  3747. and
  3748. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3749. "saleCurrentOrderAmount" like '%${item}%'
  3750. </foreach>
  3751. </if>
  3752. <if test="saleHistoricalOrderAmout != null">
  3753. and
  3754. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3755. "saleHistoricalOrderAmout" like '%${item}%'
  3756. </foreach>
  3757. </if>
  3758. <if test="saleOrderReceiveCustomer != null">
  3759. and
  3760. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3761. "saleOrderReceiveCustomer" like '%${item}%'
  3762. </foreach>
  3763. </if>
  3764. <if test="saleUnitPrice != null">
  3765. and
  3766. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3767. "saleUnitPrice" like '%${item}%'
  3768. </foreach>
  3769. </if>
  3770. <if test="saleOrderTax != null">
  3771. and
  3772. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3773. "saleOrderTax" like '%${item}%'
  3774. </foreach>
  3775. </if>
  3776. <if test="saleRemark != null">
  3777. and
  3778. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3779. "saleRemark" like '%${item}%'
  3780. </foreach>
  3781. </if>
  3782. </where>
  3783. </select>
  3784. <!-- 关闭未进厂的运单 -->
  3785. <update id="closeOrderNotIn" parameterType="DECIMAL" >
  3786. UPDATE OMSTRUCK_ORDER OO
  3787. SET OO.ORDER_STATUS = 7,
  3788. OO.INSERT_UPDATE_REMARK = '关闭销售订单,运单同步关闭'
  3789. WHERE OO.ORDER_ID IN (
  3790. SELECT OO.ORDER_ID "orderId"
  3791. FROM AMS_SALE_ORDER_MATERIAL ASOM
  3792. LEFT JOIN OMSTRUCK_ORDER OO
  3793. ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
  3794. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  3795. ON TTR.ORDER_ID = OO.ORDER_ID
  3796. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  3797. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  3798. WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
  3799. AND TER.RESULT_ENTRY_GATE_TIME IS NULL
  3800. AND OO.ORDER_TYPE IN (1,2)
  3801. AND OO.ORDER_ID IS NOT NULL
  3802. AND OO.ORDER_STATUS IN (4,5)
  3803. )
  3804. </update>
  3805. <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
  3806. SELECT RCA.CAPACITY_NUMBER AS "r1c1",
  3807. OO.ORDER_NUMBER AS "r1c2",
  3808. RM.EAS_MATERIAL_ID AS "r1c3",
  3809. RM.MATERIAL_NAME AS "r1c4",
  3810. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
  3811. FROM OMSTRUCK_ORDER OO
  3812. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  3813. ON OOM.ORDER_ID = OO.ORDER_ID
  3814. LEFT JOIN RMS_MATERIAL RM
  3815. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  3816. LEFT JOIN RMS_CAPACITY RCA
  3817. ON OO.CAPACITY_ID = RCA.CAPACITY_ID
  3818. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  3819. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  3820. LEFT JOIN AMS_SALE_ORDER ASO
  3821. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  3822. LEFT JOIN RMS_CONSIGNEE RC
  3823. ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
  3824. </select>
  3825. <select id="getSteelOrderDeletedList" resultType="java.util.Map" parameterType="java.util.Map">
  3826. select * from(
  3827. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3828. a_s_order.SALE_NUMBER "saleNumber",
  3829. r_shipper.SHIPPER_NAME "shipperName",
  3830. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3831. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3832. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3833. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3834. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3835. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  3836. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  3837. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  3838. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  3839. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  3840. a_s_order.SALE_REMARK "saleRemark",
  3841. a_s_order.INSERT_TIME "insertTime",
  3842. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  3843. RM.MATERIAL_NAME "materialName",
  3844. RM.MATERIAL_SPECIFICATION "materialSpecification",
  3845. RM.MATERIAL_MODEL "materialModel",
  3846. RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "specificationModel",
  3847. ASM.MATERIAL_NUMBER "materialNumber",
  3848. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  3849. ASM.SALE_WAREHOUSE "saleWareHouse",
  3850. a_s_order.DELETED "deleted"
  3851. from AMS_SALE_ORDER a_s_order
  3852. left join RMS_SHIPPER r_shipper
  3853. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  3854. left join RMS_CONSIGNEE r_consignee
  3855. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  3856. LEFT JOIN AMS_SALE_MATERIAL ASM
  3857. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  3858. LEFT JOIN RMS_MATERIAL RM
  3859. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  3860. LEFT JOIN RMS_SALER R_SALER
  3861. ON R_SALER.SALER_ID = a_s_order.SALER_ID
  3862. where a_s_order.SALE_ORDER_STATUS in (2,4)
  3863. and a_s_order.DELETED = 1
  3864. and a_s_order.SALE_TYPE = 1
  3865. <if test="con != null">
  3866. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  3867. </if>
  3868. <if test="saler != null" >
  3869. and R_SALER.SALER_NAME = #{saler}
  3870. </if>
  3871. <if test="oneDate != null">
  3872. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3873. </if>
  3874. <if test="startDate != null">
  3875. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  3876. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  3877. </if>
  3878. <if test="consigneeSsoId != null">
  3879. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  3880. </if>
  3881. ORDER BY a_s_order.UPDATE_TIME DESC
  3882. )
  3883. <where>
  3884. <if test="saleNumber != null">
  3885. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  3886. "saleNumber" like '%${item}%'
  3887. </foreach>
  3888. </if>
  3889. <if test="materialName != null">
  3890. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  3891. "materialName" like '%${item}%'
  3892. </foreach>
  3893. </if>
  3894. <if test="materialSpecification != null">
  3895. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  3896. "materialSpecification" like '%${item}%'
  3897. </foreach>
  3898. </if>
  3899. <if test="materialModel != null">
  3900. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  3901. "materialModel" like '%${item}%'
  3902. </foreach>
  3903. </if>
  3904. <if test="statusStr != null">
  3905. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  3906. and "statusStr" like '%${item}%'
  3907. </foreach>
  3908. </if>
  3909. <!-- <if test="startTime != null">-->
  3910. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  3911. <!-- </if>-->
  3912. <!-- <if test="endTime != null">-->
  3913. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  3914. <!-- </if>-->
  3915. <if test="shipperName != null">
  3916. and
  3917. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  3918. "shipperName" like '%${item}%'
  3919. </foreach>
  3920. </if>
  3921. <if test="consigneeCompanyName != null">
  3922. and
  3923. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  3924. "consigneeCompanyName" like '%${item}%'
  3925. </foreach>
  3926. </if>
  3927. <if test="consigneeWarrantyAmount != null">
  3928. and
  3929. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  3930. "consigneeWarrantyAmount" like '%${item}%'
  3931. </foreach>
  3932. </if>
  3933. <if test="consigneeWarrantyWeight != null">
  3934. and
  3935. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  3936. "consigneeWarrantyWeight" like '%${item}%'
  3937. </foreach>
  3938. </if>
  3939. <if test="saleOrderIsselfMention != null">
  3940. and
  3941. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  3942. "saleOrderIsselfMention" like '%${item}%'
  3943. </foreach>
  3944. </if>
  3945. <if test="saleAccountBalance != null">
  3946. and
  3947. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  3948. "saleAccountBalance" like '%${item}%'
  3949. </foreach>
  3950. </if>
  3951. <if test="saleCurrentOrderAmount != null">
  3952. and
  3953. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  3954. "saleCurrentOrderAmount" like '%${item}%'
  3955. </foreach>
  3956. </if>
  3957. <if test="saleHistoricalOrderAmout != null">
  3958. and
  3959. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  3960. "saleHistoricalOrderAmout" like '%${item}%'
  3961. </foreach>
  3962. </if>
  3963. <if test="saleOrderReceiveCustomer != null">
  3964. and
  3965. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  3966. "saleOrderReceiveCustomer" like '%${item}%'
  3967. </foreach>
  3968. </if>
  3969. <if test="saleUnitPrice != null">
  3970. and
  3971. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  3972. "saleUnitPrice" like '%${item}%'
  3973. </foreach>
  3974. </if>
  3975. <if test="saleOrderTax != null">
  3976. and
  3977. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  3978. "saleOrderTax" like '%${item}%'
  3979. </foreach>
  3980. </if>
  3981. <if test="saleRemark != null">
  3982. and
  3983. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  3984. "saleRemark" like '%${item}%'
  3985. </foreach>
  3986. </if>
  3987. </where>
  3988. </select>
  3989. <select id="getAllSteelSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map" >
  3990. select * from(
  3991. select a_s_order.SALE_ORDER_ID "saleOrderId",
  3992. a_s_order.SALE_NUMBER "saleNumber",
  3993. r_shipper.SHIPPER_NAME "shipperName",
  3994. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  3995. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  3996. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  3997. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  3998. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  3999. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4000. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4001. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4002. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4003. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4004. a_s_order.SALE_REMARK "saleRemark",
  4005. a_s_order.INSERT_TIME "insertTime",
  4006. DECODE(a_s_order.SALE_ORDER_STATUS || a_s_order.DELETED,00,'未上传',10,'已上传',20,'销售已提交',40,'财务已审批',21,'反审核',41,'反审核',22,'已关闭',42,'已关闭') "statusStr",
  4007. RM.MATERIAL_NAME "materialName",
  4008. RM.MATERIAL_SPECIFICATION "materialSpecification",
  4009. RM.MATERIAL_MODEL "materialModel",
  4010. RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
  4011. ASM.SALE_WAREHOUSE "saleWareHouse"
  4012. from AMS_SALE_ORDER a_s_order
  4013. left join RMS_SHIPPER r_shipper
  4014. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4015. left join RMS_CONSIGNEE r_consignee
  4016. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4017. LEFT JOIN AMS_SALE_MATERIAL ASM
  4018. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4019. LEFT JOIN RMS_MATERIAL RM
  4020. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4021. where a_s_order.CLOSE_STATUS is null
  4022. and a_s_order.DELETED = 0
  4023. <if test="con != null">
  4024. and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
  4025. </if>
  4026. <if test="shipperId != null">
  4027. and a_s_order.SHIPPER_ID = #{shipperId}
  4028. </if>
  4029. <if test="saleType != null">
  4030. and a_s_order.SALE_TYPE = #{saleType}
  4031. </if>
  4032. <if test="saleType == null">
  4033. and a_s_order.SALE_TYPE is null
  4034. </if>
  4035. <if test="consigneeSsoId != null">
  4036. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4037. </if>
  4038. ORDER BY a_s_order.UPDATE_TIME DESC
  4039. )
  4040. <where>
  4041. <if test="saleNumber != null">
  4042. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4043. "saleNumber" like '%${item}%'
  4044. </foreach>
  4045. </if>
  4046. <if test="materialName != null">
  4047. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4048. "materialName" like '%${item}%'
  4049. </foreach>
  4050. </if>
  4051. <if test="materialSpecification != null">
  4052. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4053. "materialSpecification" like '%${item}%'
  4054. </foreach>
  4055. </if>
  4056. <if test="materialModel != null">
  4057. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4058. "materialModel" like '%${item}%'
  4059. </foreach>
  4060. </if>
  4061. <if test="statusStr != null">
  4062. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4063. and "statusStr" like '%${item}%'
  4064. </foreach>
  4065. </if>
  4066. <!-- <if test="startTime != null">-->
  4067. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4068. <!-- </if>-->
  4069. <!-- <if test="endTime != null">-->
  4070. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4071. <!-- </if>-->
  4072. <if test="shipperName != null">
  4073. and
  4074. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4075. "shipperName" like '%${item}%'
  4076. </foreach>
  4077. </if>
  4078. <if test="consigneeCompanyName != null">
  4079. and
  4080. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4081. "consigneeCompanyName" like '%${item}%'
  4082. </foreach>
  4083. </if>
  4084. <if test="consigneeWarrantyAmount != null">
  4085. and
  4086. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4087. "consigneeWarrantyAmount" like '%${item}%'
  4088. </foreach>
  4089. </if>
  4090. <if test="consigneeWarrantyWeight != null">
  4091. and
  4092. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4093. "consigneeWarrantyWeight" like '%${item}%'
  4094. </foreach>
  4095. </if>
  4096. <if test="saleOrderIsselfMention != null">
  4097. and
  4098. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4099. "saleOrderIsselfMention" like '%${item}%'
  4100. </foreach>
  4101. </if>
  4102. <if test="saleAccountBalance != null">
  4103. and
  4104. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4105. "saleAccountBalance" like '%${item}%'
  4106. </foreach>
  4107. </if>
  4108. <if test="saleCurrentOrderAmount != null">
  4109. and
  4110. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4111. "saleCurrentOrderAmount" like '%${item}%'
  4112. </foreach>
  4113. </if>
  4114. <if test="saleHistoricalOrderAmout != null">
  4115. and
  4116. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4117. "saleHistoricalOrderAmout" like '%${item}%'
  4118. </foreach>
  4119. </if>
  4120. <if test="saleOrderReceiveCustomer != null">
  4121. and
  4122. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4123. "saleOrderReceiveCustomer" like '%${item}%'
  4124. </foreach>
  4125. </if>
  4126. <if test="saleUnitPrice != null">
  4127. and
  4128. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4129. "saleUnitPrice" like '%${item}%'
  4130. </foreach>
  4131. </if>
  4132. <if test="saleOrderTax != null">
  4133. and
  4134. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4135. "saleOrderTax" like '%${item}%'
  4136. </foreach>
  4137. </if>
  4138. <if test="saleRemark != null">
  4139. and
  4140. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4141. "saleRemark" like '%${item}%'
  4142. </foreach>
  4143. </if>
  4144. </where>
  4145. </select>
  4146. <!-- 修改厂内未装货车辆的运单车牌号 -->
  4147. <update id="updateCapacityNumberInFactory" parameterType="java.util.Map" >
  4148. UPDATE OMSTRUCK_ORDER OO
  4149. SET OO.CAPACITY_ID = #{capacityId},
  4150. OO.CAPACITYIDS=#{capacityids},
  4151. OO.insert_update_remark = '修改车牌号'
  4152. WHERE OO.ORDER_ID = #{orderId}
  4153. </update>
  4154. <update id="bindSaleArea">
  4155. UPDATE RMS_CONSIGNEE RC
  4156. SET RC.AREA_ID = #{saleAreaId}
  4157. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4158. </update>
  4159. <select id="getCarrierByAddress" parameterType="DECIMAL" resultType="java.util.Map" >
  4160. SELECT DISTINCT ACTP.CARRIER_ID "carrierId"
  4161. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4162. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4163. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4164. WHERE
  4165. ACTP.CARRIER_ID IS NOT NULL
  4166. AND RRP.ADDRESS_ID = #{addressId}
  4167. and ACTP.DELETED = 0
  4168. </select>
  4169. <select id="getSaleCokeOrder" parameterType="java.util.Map" resultType="java.util.Map">
  4170. SELECT DISTINCT * FROM(
  4171. SELECT a_s_order.SALE_ORDER_ID "saleOrderId",
  4172. a_s_order.SALE_NUMBER "saleNumber",
  4173. r_shipper.SHIPPER_NAME "shipperName",
  4174. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  4175. r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
  4176. r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
  4177. a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
  4178. a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
  4179. a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
  4180. a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
  4181. a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
  4182. a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
  4183. a_s_order.SALE_ORDER_TAX "saleOrderTax",
  4184. a_s_order.SALE_REMARK "saleRemark",
  4185. a_s_order.INSERT_TIME "insertTime",
  4186. DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已提交',4,'财务已审批') "statusStr",
  4187. RM.MATERIAL_NAME "materialName",
  4188. ASM.MATERIAL_NUMBER "materialNumber",
  4189. ASM.SALE_WAREHOUSE "saleWareHouse",
  4190. a_s_order.DELETED "deleted",
  4191. a_s_order.SHIPPER_ID "shipperId",
  4192. a_s_order.RECEIVE_ID "receiveId",
  4193. a_s_order.SALE_ORDER_ISSELF_MENTION "isSelfMention"
  4194. from AMS_SALE_ORDER a_s_order
  4195. left join RMS_SHIPPER r_shipper
  4196. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  4197. left join RMS_CONSIGNEE r_consignee
  4198. on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
  4199. LEFT JOIN AMS_SALE_MATERIAL ASM
  4200. ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
  4201. LEFT JOIN RMS_MATERIAL RM
  4202. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4203. where a_s_order.SALE_ORDER_STATUS in (2,4)
  4204. and a_s_order.CLOSE_STATUS is null
  4205. and a_s_order.DELETED = 0
  4206. and ASM.DELETED IS NULL
  4207. <if test="con != null">
  4208. 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 )
  4209. </if>
  4210. <if test="oneDate != null">
  4211. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4212. </if>
  4213. <if test="startDate != null">
  4214. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= a_s_order.UPDATE_TIME
  4215. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= a_s_order.UPDATE_TIME
  4216. </if>
  4217. <if test="shipperId != null">
  4218. and a_s_order.SHIPPER_ID = #{shipperId}
  4219. </if>
  4220. <if test="consigneeSsoId != null">
  4221. and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
  4222. </if>
  4223. <if test="saleType == null">
  4224. and a_s_order.SALE_TYPE is null
  4225. </if>
  4226. ORDER BY a_s_order.UPDATE_TIME DESC
  4227. )
  4228. <where>
  4229. <if test="saleNumber != null">
  4230. and
  4231. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  4232. "saleNumber" like '%${item}%'
  4233. </foreach>
  4234. </if>
  4235. <if test="saleWareHouse != null">
  4236. and
  4237. <foreach collection="saleWareHouse" item="item" open="(" separator="or" close=")">
  4238. "saleWareHouse" like '%${item}%'
  4239. </foreach>
  4240. </if>
  4241. <if test="materialName != null">
  4242. and
  4243. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  4244. "materialName" like '%${item}%'
  4245. </foreach>
  4246. </if>
  4247. <if test="materialSpecification != null">
  4248. and
  4249. <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
  4250. "materialSpecification" like '%${item}%'
  4251. </foreach>
  4252. </if>
  4253. <if test="materialModel != null">
  4254. and
  4255. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  4256. "materialModel" like '%${item}%'
  4257. </foreach>
  4258. </if>
  4259. <if test="statusStr != null">
  4260. and
  4261. <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
  4262. "statusStr" like '%${item}%'
  4263. </foreach>
  4264. </if>
  4265. <!-- <if test="startTime != null">-->
  4266. <!-- and "insertTime" &gt;= to_date('${startTime}','yyyy-mm-dd')-->
  4267. <!-- </if>-->
  4268. <!-- <if test="endTime != null">-->
  4269. <!-- and "insertTime" &lt;= to_date('${endTime}','yyyy-mm-dd')-->
  4270. <!-- </if>-->
  4271. <if test="shipperName != null">
  4272. and
  4273. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  4274. "shipperName" like '%${item}%'
  4275. </foreach>
  4276. </if>
  4277. <if test="consigneeCompanyName != null">
  4278. and
  4279. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  4280. "consigneeCompanyName" like '%${item}%'
  4281. </foreach>
  4282. </if>
  4283. <if test="consigneeWarrantyAmount != null">
  4284. and
  4285. <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
  4286. "consigneeWarrantyAmount" like '%${item}%'
  4287. </foreach>
  4288. </if>
  4289. <if test="consigneeWarrantyWeight != null">
  4290. and
  4291. <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
  4292. "consigneeWarrantyWeight" like '%${item}%'
  4293. </foreach>
  4294. </if>
  4295. <if test="saleOrderIsselfMention != null">
  4296. and
  4297. <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
  4298. "saleOrderIsselfMention" like '%${item}%'
  4299. </foreach>
  4300. </if>
  4301. <if test="saleAccountBalance != null">
  4302. and
  4303. <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
  4304. "saleAccountBalance" like '%${item}%'
  4305. </foreach>
  4306. </if>
  4307. <if test="saleCurrentOrderAmount != null">
  4308. and
  4309. <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
  4310. "saleCurrentOrderAmount" like '%${item}%'
  4311. </foreach>
  4312. </if>
  4313. <if test="saleHistoricalOrderAmout != null">
  4314. and
  4315. <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
  4316. "saleHistoricalOrderAmout" like '%${item}%'
  4317. </foreach>
  4318. </if>
  4319. <if test="saleOrderReceiveCustomer != null">
  4320. and
  4321. <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
  4322. "saleOrderReceiveCustomer" like '%${item}%'
  4323. </foreach>
  4324. </if>
  4325. <if test="saleUnitPrice != null">
  4326. and
  4327. <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
  4328. "saleUnitPrice" like '%${item}%'
  4329. </foreach>
  4330. </if>
  4331. <if test="saleOrderTax != null">
  4332. and
  4333. <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
  4334. "saleOrderTax" like '%${item}%'
  4335. </foreach>
  4336. </if>
  4337. <if test="saleRemark != null">
  4338. and
  4339. <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
  4340. "saleRemark" like '%${item}%'
  4341. </foreach>
  4342. </if>
  4343. </where>
  4344. </select>
  4345. <select id="findStatus" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4346. SELECT ASO.SALE_ORDER_STATUS AS "saleStatus"
  4347. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4348. LEFT JOIN AMS_SALE_ORDER ASO
  4349. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4350. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4351. </select>
  4352. <select id="getPlaceId" parameterType="DECIMAL" resultType="DECIMAL" >
  4353. SELECT ASOM.SALE_SHIPPING_ADDRESS_ID "placeId"
  4354. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4355. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4356. </select>
  4357. <select id="getAddressPriceList" parameterType="java.util.Map" resultType="java.util.Map" >
  4358. SELECT ACTP.PRICE_ID AS "priceId"
  4359. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4360. LEFT JOIN RMS_RECEIVE_PLACE RRP
  4361. ON RRP.PLACE_ID = ACTP.PLACE_ID
  4362. WHERE ACTP.CARRIER_ID = #{carrierId}
  4363. AND RRP.ADDRESS_ID = #{addressId}
  4364. AND ACTP.DELETED = 0
  4365. ORDER BY ACTP.OLD_DATE DESC
  4366. NULLS LAST
  4367. </select>
  4368. <select id="findSelfMention" parameterType="DECIMAL" resultType="java.lang.String" >
  4369. SELECT ASO.SALE_ORDER_ISSELF_MENTION AS "selfMention"
  4370. FROM AMS_SALE_ORDER_MATERIAL ASOM
  4371. LEFT JOIN AMS_SALE_ORDER ASO
  4372. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  4373. WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
  4374. </select>
  4375. <select id="findReceiveId" parameterType="java.lang.String" resultType="DECIMAL" >
  4376. SELECT RC.CONSIGNEE_ID AS "receiveId"
  4377. FROM RMS_CONSIGNEE RC
  4378. WHERE RC.CONSIGNEE_COMPANY_NAME = #{receiveName}
  4379. AND RC.CONSIGNEE_CODE IS NOT NULL
  4380. </select>
  4381. <select id="findSalerId" parameterType="java.lang.String" resultType="DECIMAL" >
  4382. SELECT RS.SALER_ID AS "salerId"
  4383. FROM RMS_SALER RS
  4384. WHERE RS.SALER_NAME = #{salerName}
  4385. </select>
  4386. <select id="findMaterialId" parameterType="java.util.Map" resultType="DECIMAL">
  4387. SELECT RM.MATERIAL_ID AS "materialId"
  4388. FROM RMS_MATERIAL RM
  4389. WHERE RM.MATERIAL_NAME = #{name}
  4390. AND RM.MATERIAL_SPECIFICATION = #{specification}
  4391. <if test="model != null">
  4392. AND RM.MATERIAL_MODEL = #{model}
  4393. </if>
  4394. </select>
  4395. <select id="findAddressId" parameterType="java.util.Map" resultType="DECIMAL" >
  4396. SELECT RRA.ADDRESS_ID AS "addressId"
  4397. FROM RMS_RECEIVE_ADDRESS RRA
  4398. WHERE RRA.ADDRESS_PROVINCE = #{province}
  4399. AND RRA.ADDRESS_DISTRICT = #{district}
  4400. AND RRA.ADDRESS_TOWN = #{town}
  4401. </select>
  4402. <select id="getSaleMaterialMessage" parameterType="DECIMAL" resultType="java.util.Map" >
  4403. SELECT ASM.MATERIAL_ID "materialId",
  4404. OO.ORDER_ID "orderId",
  4405. TTR.RESULT_TOTAL_ID "resultTotalId",
  4406. OO.ORDER_STATUS "orderStatus",
  4407. WOR.RESULT_ID "outBoundId",
  4408. ASM.MATERIAL_NUMBER "materialNumber"
  4409. FROM AMS_SALE_MATERIAL ASM
  4410. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4411. ON ASTM.MATERIAL_ID = ASM.SALE_MATERIAL_ID
  4412. LEFT JOIN OMSTRUCK_ORDER OO
  4413. ON ASTM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4414. AND OO.ORDER_TYPE = 1
  4415. LEFT JOIN WMSP_OUTBOUND_RESULT WOR
  4416. ON WOR.BILL_LADING_ID = OO.ORDER_ID
  4417. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4418. ON TTR.ORDER_ID = OO.ORDER_ID
  4419. WHERE ASM.SALE_MATERIAL_ID = #{saleMaterialId}
  4420. </select>
  4421. <select id="findOrderMaxNum" parameterType="DECIMAL" resultType="java.lang.Integer" >
  4422. SELECT MAx(TLFR.SEGMENT_SQE)
  4423. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  4424. WHERE TLFR.RESULT_TOTAL_ID = #{resultTotalId}
  4425. </select>
  4426. <select id="getKucunList" resultType="java.util.Map" parameterType="java.util.Map">
  4427. SELECT * FROM (
  4428. SELECT ASO.SALE_NUMBER "saleNo", ASO.SALE_REMARK "saleRemark",
  4429. RAS1.ARRIVAL_NAME "sendStation",
  4430. RAS.ARRIVAL_NAME "toTheStation",
  4431. RM.MATERIAL_NAME "materialName",
  4432. RM.MATERIAL_SPECIFICATION||'('||RM.MATERIAL_MODEL||')' "materialSpa",
  4433. ASM.MATERIAL_NUMBER "materialNum",
  4434. ASM.MATERIAL_WEIGHT "materialWeight",
  4435. RDOINDEP.ORG_NAME "transInDep",
  4436. RDOOUTDEP.ORG_NAME "transOutDep",
  4437. RISWINOF.INWARD_WAREHOUSE_NAME "transInWarehouse",
  4438. RC.CONSIGNEE_COMPANY_NAME "receiveName",
  4439. ASO.SALE_ORDER_ID "saleOrderId",
  4440. RAS1.ARRIVAL_ID "sendStationId",
  4441. RAS.ARRIVAL_ID "toTheStationId",
  4442. ASM.IS_POUND_SALE "isPoundSale",
  4443. ASM.SALE_MATERIAL_ID "saleMaterialId",
  4444. TPAR.RESULT_ID "approveId"
  4445. FROM AMS_SALE_ORDER ASO
  4446. LEFT JOIN AMS_SALE_MATERIAL ASM
  4447. ON ASM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
  4448. LEFT JOIN RMS_MATERIAL RM
  4449. ON RM.MATERIAL_ID = ASM.MATERIAL_ID
  4450. LEFT JOIN TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
  4451. ON TPAR.RAIL_PLAN_ID = ASM.SALE_MATERIAL_ID
  4452. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
  4453. ON RAS.ARRIVAL_ID = TPAR.TO_THE_STATION_ID
  4454. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS1
  4455. ON RAS1.ARRIVAL_ID = TPAR.SEND_STATION_ID
  4456. LEFT JOIN RMS_CONSIGNEE RC
  4457. ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
  4458. LEFT JOIN RMS_DEP_ORG RDOINDEP
  4459. ON RDOINDEP.ORG_CODE = ASO.TRANSFER_IN_DEP
  4460. LEFT JOIN RMS_DEP_ORG RDOOUTDEP
  4461. ON RDOOUTDEP.ORG_CODE = ASO.TRANSFER_OUT_DEP
  4462. LEFT JOIN RMS_INWARD_STEEL_WAREHOUSE RISWINOF
  4463. ON RISWINOF.INWARD_WAREHOUSE_CODE = ASM.TRANSFER_IN_OF_WAREHOUSE
  4464. WHERE ASO.SALE_TYPE = 4
  4465. <if test="oneDate != null">
  4466. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = ASO.INSERT_TIME
  4467. </if>
  4468. <if test="startDate != null">
  4469. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ASO.INSERT_TIME
  4470. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASO.INSERT_TIME
  4471. </if>
  4472. <if test="remark != null">
  4473. and ASO.SALE_REMARK||RM.MATERIAL_NAME LIKE #{remark}
  4474. </if>
  4475. <if test="totheStation != null">
  4476. and RAS.ARRIVAL_NAME LIKE #{totheStation}
  4477. </if>
  4478. <if test="consigneeName != null">
  4479. and RC.CONSIGNEE_COMPANY_NAME like #{consigneeName}
  4480. </if>
  4481. <if test="transferIndep != null">
  4482. and RDOINDEP.ORG_NAME LIKE #{transferIndep}
  4483. </if>
  4484. )
  4485. </select>
  4486. <select id="selectSaleAreaId" resultType="java.math.BigDecimal" parameterType="decimal">
  4487. SELECT RC.AREA_ID AS "areaId"
  4488. FROM RMS_CONSIGNEE RC
  4489. WHERE RC.CONSIGNEE_ID = #{receiveId}
  4490. </select>
  4491. <select id="selectSaleAreaIdByName" resultType="java.math.BigDecimal" parameterType="string">
  4492. SELECT RSA.AREA_ID FROM RMS_SALE_AREA RSA
  4493. WHERE RSA.AREA_NAME = #{saleAreaName}
  4494. </select>
  4495. <select id="getMoreCarrier" resultType="java.math.BigDecimal" parameterType="string">
  4496. SELECT count(RMCP.CARRIER_PLACE_ID) FROM RMS_MORE_CARRIER_PLACE RMCP
  4497. WHERE #{place} LIKE '%' || RMCP.CARRIER_PLACE_VALUE || '%'
  4498. </select>
  4499. <select id="getOrderIdByCapacity" resultType="java.util.Map">
  4500. select OO.order_ID "orderId",
  4501. RC.CAPACITY_NUMBER "capacityNumber",
  4502. TTR.RESULT_TOTAL_ID "resultTotalId",
  4503. TER.RESULT_ENTRY_GATE_TIME "isEn",
  4504. TLFR.RESULT_OUT_GATE_TIME "isLeave",
  4505. TAR.RESULT_ID "isArrival",
  4506. TRR.RESULT_ID "isReceipt"
  4507. from OMSTRUCK_ORDER OO
  4508. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID =RC.CAPACITY_ID
  4509. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID=OO.ORDER_ID
  4510. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER ON TER.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4511. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR ON TLFR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4512. LEFT JOIN TMSTRUCK_ARRIVAL_RESULT TAR ON TAR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4513. LEFT JOIN TMSTRUCK_RECEIPT_RESULT TRR ON TRR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  4514. where RC.CAPACITY_NUMBER=#{capacityNumber} and OO.order_status=5
  4515. fetch next 1 rows only
  4516. </select>
  4517. <select id="getOrderMes" resultType="java.util.Map" parameterType="java.util.Map">
  4518. SELECT TTR.RESULT_TOTAL_ID "resultTotalId",
  4519. OO.ORDER_STATUS "orderStatus"
  4520. FROM OMSTRUCK_ORDER OO
  4521. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4522. ON TTR.ORDER_ID = OO.ORDER_ID
  4523. WHERE OO.ORDER_ID = #{orderId}
  4524. </select>
  4525. <select id="getId" resultType="java.math.BigDecimal">
  4526. select ASOM.SALE_ORDER_MATERIAL_ID "saleodermatetialid"
  4527. from AMS_SALE_ORDER_MATERIAL ASOM
  4528. LEFT JOIN AMS_SALE_ORDER ASO
  4529. ON ASO.SALE_ORDER_ID= ASOM.SALE_ORDER_ID
  4530. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4531. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  4532. LEFT JOIN AMS_SALE_MATERIAL ASM
  4533. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  4534. where ASO.sale_number=#{saleOrderNo}
  4535. and ASM.SALE_MATERIAL_ID =#{saleMaterialId}
  4536. </select>
  4537. <update id="updateForTel">
  4538. update AMS_SALE_ORDER_MATERIAL ASOM
  4539. set ASOM.SALE_ORDER_CONSIGNEE_TEL=#{consigneeTel}
  4540. WHERE ASOM.SALE_ORDER_MATERIAL_ID=#{saleodermatetialid}
  4541. </update>
  4542. <update id="updateSaleOrderStatus">
  4543. update AMS_SALE_ORDER ASO
  4544. set aso.DELETED = 2
  4545. WHERE ASO.SALE_NUMBER = #{saleNumber}
  4546. </update>
  4547. <select id="getDispachSwitch" resultType="java.lang.Integer">
  4548. SELECT IS_OK "isOk" FROM AMS_DISPATCH_SWITCH
  4549. fetch NEXT 1 rows only
  4550. </select>
  4551. <select id="getSteelOrderMap" resultType="java.util.Map" parameterType="java.math.BigDecimal">
  4552. SELECT OO.ORDER_ID FROM OMSTRUCK_ORDER OO
  4553. WHERE OO.ORDER_PLAN_ID = #{saleOrderMaterialId}
  4554. AND OO.ORDER_TYPE = 1
  4555. </select>
  4556. <update id="updateAMSDeleted">
  4557. update AMS_SALE_MATERIAL ASM
  4558. set ASM.DELETED = 0,
  4559. ASM.INSERT_UPDATE_REMARK = '继续装关闭分录'
  4560. where ASM.SALE_MATERIAL_ID=#{closeWlEntryId}
  4561. </update>
  4562. <update id="updateOldSaleOrderUpload" parameterType="java.math.BigDecimal">
  4563. update AMS_SALE_ORDER ASO
  4564. SET ASO.INSERT_UPDATE_REMARK = '物流上传金蝶成功'
  4565. WHERE ASO.SALE_ORDER_ID = #{saleOrderId}
  4566. </update>
  4567. <delete id="delectQueueS">
  4568. delete from QMS_QUEUE_LIST qql
  4569. where qql.LIST_ID=#{capacityIdM}
  4570. </delete>
  4571. <select id="queueSingle" resultType="java.math.BigDecimal">
  4572. select qql.LIST_ID
  4573. from OMSTRUCK_ORDER oo
  4574. LEFT JOIN QMS_QUEUE_LIST qql
  4575. on qql.capacity_id=oo.capacity_id
  4576. where oo.order_id=#{orderId}
  4577. </select>
  4578. <select id="isGPS" resultType="java.lang.Integer">
  4579. SELECT count(*) FROM RMS_CAPACITY WHERE CAPACITY_NUMBER=#{capacityNumber} and CAPACITY_GPS='是'
  4580. </select>
  4581. <select id="getEasPrimaryIds" resultType="string" parameterType="map">
  4582. SELECT distinct EAS_PRIMARY_ID FROM OMSTRUCK_ORDER OO
  4583. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  4584. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  4585. LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
  4586. ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
  4587. LEFT JOIN AMS_SALE_MATERIAL ASM
  4588. ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
  4589. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  4590. ON TTR.ORDER_ID = TTR.ORDER_ID
  4591. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  4592. ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  4593. AND ASM.MATERIAL_ID = TWR.MATERIAL_ID
  4594. where NVL(ASM.DELETED,0) = 0
  4595. AND TWR.RESULT_NET_WEIGHT IS NOT NULL
  4596. AND ASM.EAS_PRIMARY_ID IS NOT NULL
  4597. AND OO.ORDER_TYPE = 1
  4598. AND OO.ORDER_STATUS IN (2,5)
  4599. <if test="easPrimaryList != null and easPrimaryList.size > 0">
  4600. and <foreach collection="easPrimaryList" item="item" open="(" separator="or" close=")">
  4601. ASM.EAS_PRIMARY_ID LIKE '%${item}%'
  4602. </foreach>
  4603. </if>
  4604. <if test="easPrimaryList == null">
  4605. and ASM.SALE_MAKE_DATE IS NULL
  4606. ORDER BY OO.ORDER_ID
  4607. FETCH NEXT 50000 ROWS ONLY
  4608. </if>
  4609. </select>
  4610. <select id="getNextCarrier" resultType="java.util.Map" parameterType="java.lang.Integer">
  4611. select adso.CARRIER_ID "carrierId" from AMS_SALE_ORDER_MATERIAL asom
  4612. left join RMS_RECEIVE_PLACE rrp
  4613. on rrp.PLACE_ID = asom.SALE_SHIPPING_ADDRESS_ID
  4614. left join AMS_DISPATCH_SALE_ORDER adso
  4615. on adso.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
  4616. left join rms_carrier rc
  4617. on rc.CARRIER_ID = adso.CARRIER_ID
  4618. where rrp.ADDRESS_ID = #{addressId}
  4619. and rc.CARRIER_TYPE = '销售钢材承运商'
  4620. and (rrp.ADDRESS_ID in (500105,500101,500154) and rrp.ADDRESS_DELIVERY_ADDRESS not like '%库%' OR rrp.ADDRESS_ID NOT IN ( 500105, 500101, 500154 ) )
  4621. order by asom.SALE_ORDER_MATERIAL_ID desc
  4622. fetch first 1 row only
  4623. </select>
  4624. <select id="getPriceIdByPlaceId" resultType="java.math.BigDecimal" parameterType="java.math.BigDecimal">
  4625. SELECT ACTP.PRICE_ID FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  4626. WHERE ACTP.TYPE = 1
  4627. and ACTP.DELETED = 0
  4628. AND ACTP.PLACE_ID = #{placeId}
  4629. fetch first 1 row only
  4630. </select>
  4631. <select id="isBlackList" resultType="java.lang.Integer">
  4632. SELECT count(CAPACITY_ID)
  4633. FROM RMS_CAPACITY
  4634. WHERE CAPACITY_NUMBER=#{capacityNumber} AND CAPACITY_BLACKLIST='是'
  4635. </select>
  4636. <select id="selectSaleGroupCode" resultType="java.lang.String" parameterType="string">
  4637. SELECT RSA.AREA_CODE FROM RMS_SALE_AREA RSA
  4638. WHERE RSA.AREA_NAME = #{saleGroup}
  4639. </select>
  4640. <select id="selectOutFactoryResult" resultType="java.lang.Integer">
  4641. SELECT COUNT(TLFR.RESULT_OUT_GATE_TIME) FROM OMSTRUCK_ORDER OO
  4642. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
  4643. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  4644. WHERE OO.ORDER_NUMBER = #{orderNo}
  4645. AND TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  4646. ORDER BY OO.ORDER_ID DESC
  4647. </select>
  4648. </mapper>