TWarehousebillsMapper.xml 172 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper">
  6. <resultMap type="TWarehousebills" id="TWarehousebillsResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCustomsdeclartion" column="f_customsdeclartion"/>
  10. <result property="fOriginalbillno" column="f_originalbillno"/>
  11. <result property="fDeptid" column="f_deptid"/>
  12. <result property="fBsdeptid" column="f_bsdeptid"/>
  13. <result property="fContacts" column="f_contacts"/>
  14. <result property="fTel" column="f_tel"/>
  15. <result property="fCorpid" column="f_corpid"/>
  16. <result property="fTocorpid" column="f_tocorpid"/>
  17. <result property="fStltypeid" column="f_stltypeid"/>
  18. <result property="fBscorpno" column="f_bscorpno"/>
  19. <result property="fWarehouseid" column="f_warehouseid"/>
  20. <result property="fStorekeeper" column="f_storekeeper"/>
  21. <result property="fChargedate" column="f_chargedate"/>
  22. <result property="fBsdate" column="f_bsdate"/>
  23. <result property="fPlanqty" column="f_planqty"/>
  24. <result property="fPlangrossweight" column="f_plangrossweight"/>
  25. <result property="fPlannetweight" column="f_plannetweight"/>
  26. <result property="fPlanvolumn" column="f_planvolumn"/>
  27. <result property="fQty" column="f_qty"/>
  28. <result property="fGrossweight" column="f_grossweight"/>
  29. <result property="fNetweight" column="f_netweight"/>
  30. <result property="fVolumn" column="f_volumn"/>
  31. <result property="fBillingway" column="f_billingway"/>
  32. <result property="fTrademodeid" column="f_trademodeid"/>
  33. <result property="fSbu" column="f_sbu"/>
  34. <result property="fFeetunit" column="f_feetunit"/>
  35. <result property="fMblno" column="f_mblno"/>
  36. <result property="fMarks" column="f_marks"/>
  37. <result property="fVslvoy" column="f_vslvoy"/>
  38. <result property="fEta" column="f_eta"/>
  39. <result property="fCustomno" column="f_customno"/>
  40. <result property="fIfweigh" column="f_ifweigh"/>
  41. <result property="fIfpledge" column="f_ifpledge"/>
  42. <result property="fIfdamage" column="f_ifdamage"/>
  43. <result property="fBankcorpid" column="f_bankcorpid"/>
  44. <result property="fBilltype" column="f_billtype"/>
  45. <result property="fBillstatus" column="f_billstatus"/>
  46. <result property="fItemsStatus" column="f_items_status"/>
  47. <result property="delFlag" column="del_flag"/>
  48. <result property="createBy" column="create_by"/>
  49. <result property="createTime" column="create_time"/>
  50. <result property="updateBy" column="update_by"/>
  51. <result property="updateTime" column="update_time"/>
  52. <result property="remark" column="remark"/>
  53. <result property="fBillingDeadline" column="f_billing_deadline"/>
  54. <result property="fProductName" column="f_product_name"/>
  55. <result property="fReviewDate" column="f_review_date"/>
  56. <result property="fTruckno" column="f_truckno"/>
  57. <result property="fDriverName" column="f_driver_name"/>
  58. <result property="fDriverTel" column="f_driver_tel"/>
  59. <result property="fDriverIdCar" column="f_driver_id_car"/>
  60. <result property="fBusinessType" column="f_business_type"/>
  61. <result property="fLabour" column="f_labour"/>
  62. <result property="fFleet" column="f_fleet"/>
  63. <result property="fInwarehouseid" column="f_inwarehouseid"/>
  64. <result property="fBstime" column="f_bstime"/>
  65. <result property="fCartype" column="f_cartype"/>
  66. <result property="fGoodsid" column="f_goodsid"/>
  67. <result property="fNewTrademodeid" column="f_new_trademodeid"/>
  68. <result property="fLoadportid" column="f_loadportid"/>
  69. <result property="fDestportid" column="f_destportid"/>
  70. <result property="fServiceitems" column="f_serviceitems"/>
  71. <result property="fInvoceobj" column="f_invoceobj"/>
  72. <result property="fSign" column="f_sign"/>
  73. <result property="fDetentioncargo" column="f_detentioncargo"/>
  74. <result property="fBooksmarks" column="f_booksmarks"/>
  75. <result property="fShippername" column="f_shippername"/>
  76. <result property="fShipperattn" column="f_shipperattn"/>
  77. <result property="fShippertel" column="f_shippertel"/>
  78. <result property="fConsigneername" column="f_consigneername"/>
  79. <result property="fConsigneeattn" column="f_consigneeattn"/>
  80. <result property="fConsigneetel" column="f_consigneetel"/>
  81. <result property="fInsurance" column="f_insurance"/>
  82. <result property="fInsuranceamt" column="f_insuranceamt"/>
  83. <result property="fClosedate" column="f_closedate"/>
  84. <result property="fDocmentdate" column="f_docmentdate"/>
  85. <result property="fVslid" column="f_vslid"/>
  86. <result property="fVoyid" column="f_voyid"/>
  87. <result property="fTypeid" column="f_typeid"/>
  88. <result property="fPaymode" column="f_paymode"/>
  89. <result property="fLaneid" column="f_laneid"/>
  90. <result property="fCntval" column="f_cntval"/>
  91. <result property="fDateChanged" column="f_date_changed"/>
  92. <result property="fMarketNumber" column="f_market_number"/>
  93. <result property="fMoney" column="f_money"/>
  94. <result property="fStudentsWeight" column="f_students_weight"/>
  95. <result property="fTeachersWeight" column="f_teachers_weight"/>
  96. <result property="fMarketTypid" column="f_market_typid"/>
  97. <result property="fPurchase" column="f_purchase"/>
  98. <result property="fCreateLog" column="f_create_log" />
  99. <result property="fPrintLog" column="f_print_log" />
  100. <result property="fPrint" column="f_print" />
  101. <result property="fTakeOrders" column="f_take_orders" />
  102. <result property="fReason" column="f_reason" />
  103. <result property="fAllotWarehouseid" column="f_allot_warehouseid" />
  104. <result property="fProject" column="f_project" />
  105. </resultMap>
  106. <sql id="selectTWarehousebillsVo">
  107. select f_id,
  108. f_billno,
  109. f_customsdeclartion,
  110. f_originalbillno,
  111. f_deptid,
  112. f_bsdeptid,
  113. f_contacts,
  114. f_tel,
  115. f_corpid,
  116. f_tocorpid,
  117. f_stltypeid,
  118. f_bscorpno,
  119. f_warehouseid,
  120. f_storekeeper,
  121. f_chargedate,
  122. f_bsdate,
  123. f_planqty,
  124. f_plangrossweight,
  125. f_plannetweight,
  126. f_planvolumn,
  127. f_qty,
  128. f_grossweight,
  129. f_netweight,
  130. f_volumn,
  131. f_billingway,
  132. f_trademodeid,
  133. f_sbu,
  134. f_feetunit,
  135. f_mblno,
  136. f_marks,
  137. f_vslvoy,
  138. f_eta,
  139. f_customno,
  140. f_ifweigh,
  141. f_ifpledge,
  142. f_ifdamage,
  143. f_bankcorpid,
  144. f_billtype,
  145. f_billstatus,
  146. f_items_status,
  147. del_flag,
  148. create_by,
  149. create_time,
  150. update_by,
  151. update_time,
  152. remark,
  153. f_billing_deadline,
  154. f_product_name,
  155. f_review_date,
  156. f_truckno,
  157. f_driver_name,
  158. f_driver_tel,
  159. f_driver_id_car,
  160. f_business_type,
  161. f_labour,
  162. f_fleet,
  163. f_inwarehouseid,
  164. f_bstime,
  165. f_cartype,
  166. f_goodsid,
  167. f_new_trademodeid,
  168. f_loadportid,
  169. f_destportid,
  170. f_serviceitems,
  171. f_invoceobj,
  172. f_sign,
  173. f_detentioncargo,
  174. f_booksmarks,
  175. f_shippername,
  176. f_shipperattn,
  177. f_shippertel,
  178. f_consigneername,
  179. f_consigneeattn,
  180. f_consigneetel,
  181. f_insurance,
  182. f_insuranceamt,
  183. f_closedate,
  184. f_docmentdate,
  185. f_vslid,
  186. f_voyid,
  187. f_typeid,
  188. f_paymode,
  189. f_laneid,
  190. f_cntval,
  191. f_date_changed,
  192. f_market_number,
  193. f_market_typid,
  194. f_money,
  195. f_teachers_weight,
  196. f_students_weight,
  197. f_purchase,
  198. f_create_log,
  199. f_print_log,
  200. f_print,
  201. f_take_orders,
  202. f_reason,
  203. f_allot_warehouseid,
  204. f_project
  205. from t_warehousebills
  206. </sql>
  207. <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  208. select
  209. ware.*
  210. from
  211. t_warehousebills ware
  212. left join sys_user u on ware.create_by = u.user_name
  213. left join sys_dept d on ware.f_bsdeptid = d.dept_id
  214. <where>
  215. ware.f_typeid IS NULL
  216. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  217. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and f_customsdeclartion =
  218. #{fCustomsdeclartion}
  219. </if>
  220. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  221. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  222. <if test="fBsdeptid != null ">and f_bsdeptid = #{fBsdeptid}</if>
  223. <if test="fInwarehouseid != null ">and f_inwarehouseid = #{fInwarehouseid}</if>
  224. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  225. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  226. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  227. <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
  228. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  229. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  230. and f_bsdate &gt;= #{timeInterval[0]}
  231. </if>
  232. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  233. and f_bsdate &lt;= #{timeInterval[1]}
  234. </if>
  235. <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
  236. <if test="fBscorpno != null and fBscorpno != ''">and f_bscorpno = #{fBscorpno}</if>
  237. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  238. <if test="fStorekeeper != null and fStorekeeper != ''">and f_storekeeper = #{fStorekeeper}</if>
  239. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  240. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  241. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  242. '%')
  243. </if>
  244. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  245. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  246. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  247. <if test="fQty != null ">and f_qty = #{fQty}</if>
  248. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  249. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  250. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  251. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  252. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  253. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  254. <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
  255. <if test="fFeetunit != null and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
  256. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  257. <if test="fVslvoy != null and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
  258. <if test="fEta != null ">and f_eta = #{fEta}</if>
  259. <if test="fCustomno != null and fCustomno != ''">and f_customno = #{fCustomno}</if>
  260. <if test="fIfweigh != null and fIfweigh != ''">and f_ifweigh = #{fIfweigh}</if>
  261. <if test="fIfpledge != null and fIfpledge != ''">and f_ifpledge = #{fIfpledge}</if>
  262. <if test="fIfdamage != null and fIfdamage != ''">and f_ifdamage = #{fIfdamage}</if>
  263. <if test="fBankcorpid != null ">and f_bankcorpid = #{fBankcorpid}</if>
  264. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  265. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  266. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  267. <if test="fNewTrademodeid != null ">and f_new_trademodeid = #{fNewTrademodeid}</if>
  268. </where>
  269. ${params.dataScope}
  270. </select>
  271. <select id="selectWarehouseBusinessList" parameterType="TWarehousebills" resultType="Map">
  272. SELECT
  273. DISTINCT
  274. bill.f_id AS fId,
  275. corp.f_name AS fCorpid,
  276. corpTo.f_name AS fTocorpid,
  277. bill.f_mblno AS fMblno,
  278. corpSub.f_name AS fSbu,
  279. bill.f_marks AS fMarks,
  280. bill.remark AS remark,
  281. bill.f_planqty AS fPlanqty,
  282. bill.f_plangrossweight AS fPlangrossweight,
  283. bill.f_plannetweight AS fPlannetweight,
  284. bill.f_planvolumn AS fPlanvolumn,
  285. bill.f_bsdate AS fBsdate,
  286. bill.f_trademodeid AS fTrademodeid,
  287. bill.f_truckno AS fTruckno,
  288. bill.f_driver_name AS fDriverName,
  289. bill.f_driver_tel AS fDriverTel,
  290. bill.f_driver_id_car AS fDriverIdCar,
  291. dictIn.dict_label AS fBusinessType,
  292. ware.f_name AS fWarehouseid,
  293. bill.f_qty AS fQty,
  294. bill.f_cntval AS fCntval,
  295. bill.f_netweight AS fNetweight,
  296. bill.create_time AS createTime,
  297. ware1.f_name AS fInwarehouseid,
  298. bill.create_by AS createBy,
  299. bill.f_grossweight AS fGrossweight,
  300. bill.f_product_name AS fProductName,
  301. bill.f_billing_deadline AS fBillingDeadline,
  302. CASE WHEN bill.f_billstatus = '1' THEN '录入'
  303. WHEN bill.f_billstatus = '2' THEN '暂存'
  304. WHEN bill.f_billstatus = '3' THEN '驳回'
  305. WHEN bill.f_billstatus = '4' THEN '请核'
  306. WHEN bill.f_billstatus = '5' THEN '审核中'
  307. WHEN bill.f_billstatus = '6' THEN '全部入账'
  308. END
  309. AS fBillstatus,
  310. CASE
  311. WHEN bill.f_billtype = 'SJRK'
  312. AND bill.f_items_status = '1' THEN
  313. '计划'
  314. WHEN bill.f_billtype = 'SJRK'
  315. AND bill.f_items_status = '2' THEN
  316. '待入库'
  317. WHEN bill.f_billtype = 'SJRK'
  318. AND bill.f_items_status = '3' THEN
  319. '入库中'
  320. WHEN bill.f_billtype = 'SJRK'
  321. AND bill.f_items_status = '4' THEN
  322. '已入库'
  323. WHEN bill.f_billtype = 'SJCK'
  324. AND bill.f_items_status = '1' THEN
  325. '计划'
  326. WHEN bill.f_billtype = 'SJCK'
  327. AND bill.f_items_status = '2' THEN
  328. '待出库'
  329. WHEN bill.f_billtype = 'SJCK'
  330. AND bill.f_items_status = '3' THEN
  331. '出库中'
  332. WHEN bill.f_billtype = 'SJCK'
  333. AND bill.f_items_status = '4' THEN
  334. '已出库'
  335. WHEN bill.f_billtype = 'CKDB'
  336. AND bill.f_items_status = '1' THEN
  337. '计划'
  338. WHEN bill.f_billtype = 'CKDB'
  339. AND bill.f_items_status = '2' THEN
  340. '待调拨'
  341. WHEN bill.f_billtype = 'CKDB'
  342. AND bill.f_items_status = '3' THEN
  343. '调拨中'
  344. WHEN bill.f_billtype = 'CKDB'
  345. AND bill.f_items_status = '4' THEN
  346. '已调拨'
  347. WHEN bill.f_billtype = 'HWTG'
  348. AND bill.f_items_status = '1' THEN
  349. '计划'
  350. WHEN bill.f_billtype = 'HWTG'
  351. AND bill.f_items_status = '2' THEN
  352. '待调拨'
  353. WHEN bill.f_billtype = 'HWTG'
  354. AND bill.f_items_status = '3' THEN
  355. '调拨中'
  356. WHEN bill.f_billtype = 'HWTG'
  357. AND bill.f_items_status = '4' THEN
  358. '已调拨'
  359. END AS fItemsStatus,
  360. bill.f_billno AS fBillno,
  361. g.f_name AS fGoodsid,
  362. bill.f_storekeeper AS fStorekeeper
  363. FROM
  364. t_warehousebills bill
  365. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  366. left join sys_user u on bill.create_by = u.user_name
  367. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  368. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  369. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  370. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  371. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  372. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  373. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  374. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  375. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type
  376. <where>
  377. bill.f_typeid IS NULL
  378. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  379. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  380. #{fCustomsdeclartion}
  381. </if>
  382. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  383. #{fOriginalbillno}
  384. </if>
  385. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  386. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  387. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  388. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  389. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  390. and bill.f_bsdate &gt;= #{timeInterval[0]}
  391. </if>
  392. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  393. and bill.f_bsdate &lt;= #{timeInterval[1]}
  394. </if>
  395. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  396. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  397. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  398. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  399. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  400. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  401. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  402. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  403. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  404. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  405. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  406. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  407. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  408. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  409. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  410. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  411. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  412. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  413. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  414. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  415. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  416. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  417. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  418. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  419. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  420. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  421. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  422. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  423. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  424. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  425. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  426. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  427. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  428. <if test="fBilltype != null">and bill.f_billtype = #{fBilltype}</if>
  429. <if test="fBilltype != null and fBilltype == 'SJRK'">
  430. AND dictIn.dict_type = 'st_in_type'
  431. AND dictIn.status = '0'
  432. </if>
  433. <if test="fBilltype != null and fBilltype == 'SJCK'">
  434. AND dictIn.dict_type = 'st_out_type'
  435. AND dictIn.status = '0'
  436. </if>
  437. <if test="fBilltype != null and fBilltype == 'CKDB'">
  438. AND dictIn.dict_type = 'st_trans_type'
  439. AND dictIn.status = '0'
  440. </if>
  441. <if test="fBilltype != null and fBilltype == 'HWTG'">
  442. AND dictIn.dict_type = 'st_trans_type'
  443. AND dictIn.status = '0'
  444. </if>
  445. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  446. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  447. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  448. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  449. </where>
  450. ${params.dataScope}
  451. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  452. </select>
  453. <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
  454. SELECT
  455. DISTINCT
  456. bill.f_id AS fId,
  457. corp.f_name AS fCorpid,
  458. corpTo.f_name AS fTocorpid,
  459. bill.f_mblno AS fMblno,
  460. corpSub.f_name AS fSbu,
  461. bill.f_marks AS fMarks,
  462. bill.remark AS remark,
  463. bill.f_planqty AS fPlanqty,
  464. bill.f_plangrossweight AS fPlangrossweight,
  465. bill.f_plannetweight AS fPlannetweight,
  466. bill.f_planvolumn AS fPlanvolumn,
  467. bill.f_bsdate AS fBsdate,
  468. dict.dict_label AS fTrademodeid,
  469. bill.f_truckno AS fTruckno,
  470. bill.f_driver_name AS fDriverName,
  471. bill.f_driver_tel AS fDriverTel,
  472. bill.f_driver_id_car AS fDriverIdCar,
  473. ware.f_name AS fWarehouseid,
  474. bill.f_qty AS fQty,
  475. bill.f_cntval AS fCntval,
  476. bill.f_netweight AS fNetweight,
  477. bill.create_time AS createTime,
  478. ware1.f_name AS fInwarehouseid,
  479. bill.create_by AS createBy,
  480. bill.f_grossweight AS fGrossweight,
  481. bill.f_product_name AS fProductName,
  482. bill.f_billing_deadline AS fBillingDeadline,
  483. CASE
  484. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
  485. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
  486. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
  487. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
  488. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
  489. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
  490. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
  491. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
  492. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
  493. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
  494. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
  495. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
  496. END
  497. AS fBillstatus,
  498. CASE
  499. WHEN bill.f_billtype = 'HQZY'
  500. AND bill.f_items_status = '1' THEN
  501. '计划'
  502. WHEN bill.f_billtype = 'HQZY'
  503. AND bill.f_items_status = '2' THEN
  504. '待货转'
  505. WHEN bill.f_billtype = 'HQZY'
  506. AND bill.f_items_status = '3' THEN
  507. '货转中'
  508. WHEN bill.f_billtype = 'HQZY'
  509. AND bill.f_items_status = '4' THEN
  510. '已货转'
  511. END
  512. AS fItemsStatus,
  513. bill.f_billno AS fBillno,
  514. g.f_name AS fGoodsid,
  515. bill.f_storekeeper AS fStorekeeper
  516. FROM
  517. t_warehousebills bill
  518. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  519. left join sys_user u on bill.create_by = u.user_name
  520. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  521. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  522. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  523. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  524. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  525. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  526. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  527. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  528. LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
  529. <where>
  530. dict.status = '0'
  531. AND dict.dict_type = 'data_trademodes'
  532. AND bill.f_typeid IS NULL
  533. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  534. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  535. #{fCustomsdeclartion}
  536. </if>
  537. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  538. #{fOriginalbillno}
  539. </if>
  540. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  541. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  542. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  543. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  544. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  545. and bill.f_bsdate &gt;= #{timeInterval[0]}
  546. </if>
  547. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  548. and bill.f_bsdate &lt;= #{timeInterval[1]}
  549. </if>
  550. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  551. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  552. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  553. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  554. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  555. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  556. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  557. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  558. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  559. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  560. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  561. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  562. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  563. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  564. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  565. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  566. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  567. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  568. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  569. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  570. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  571. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  572. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  573. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  574. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  575. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  576. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  577. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  578. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  579. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  580. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  581. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  582. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  583. <if test="fBilltype != null and fBilltype != ''">
  584. and bill.f_billtype = #{fBilltype}
  585. </if>
  586. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  587. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  588. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  589. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  590. </where>
  591. ${params.dataScope}
  592. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  593. </select>
  594. <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
  595. SELECT tw.f_id,
  596. tw.f_billno,
  597. tw.f_customsdeclartion,
  598. tw.f_originalbillno,
  599. tw.f_deptid,
  600. tw.f_bsdeptid,
  601. tw.f_contacts,
  602. tw.f_tel,
  603. tw.f_corpid,
  604. ts.f_name AS corpName,
  605. tw.f_tocorpid,
  606. tw.f_stltypeid,
  607. tw.f_bscorpno,
  608. tw.f_warehouseid,
  609. th.f_name AS fWarehouseidName,
  610. tw.f_storekeeper,
  611. sy.user_name AS fStorekeeperName,
  612. tw.f_chargedate,
  613. tw.f_bsdate,
  614. tw.f_planqty,
  615. tw.f_plangrossweight,
  616. tw.f_plannetweight,
  617. tw.f_planvolumn,
  618. tw.f_qty,
  619. tw.f_grossweight,
  620. tw.f_netweight,
  621. tw.f_volumn,
  622. tw.f_billingway,
  623. tw.f_trademodeid,
  624. tw.f_sbu,
  625. tw.f_feetunit,
  626. tw.f_mblno,
  627. tw.f_marks,
  628. tw.f_vslvoy,
  629. tw.f_eta,
  630. tw.f_customno,
  631. tw.f_ifweigh,
  632. tw.f_ifpledge,
  633. tw.f_ifdamage,
  634. tw.f_bankcorpid,
  635. tw.f_billtype,
  636. tw.f_billstatus,
  637. tw.f_items_status,
  638. tw.del_flag,
  639. tw.create_by,
  640. tw.create_time,
  641. tw.update_by,
  642. tw.update_time,
  643. tw.remark,
  644. tw.f_billing_deadline,
  645. tw.f_product_name,
  646. tw.f_review_date,
  647. tw.f_truckno,
  648. tw.f_driver_name,
  649. tw.f_driver_tel,
  650. tw.f_driver_id_car,
  651. tw.f_business_type,
  652. tw.f_labour,
  653. tw.f_fleet,
  654. tw.f_inwarehouseid,
  655. tw.f_bstime,
  656. tw.f_cartype,
  657. tw.f_goodsid,
  658. tw.f_new_trademodeid,
  659. tw.f_loadportid,
  660. tw.f_destportid,
  661. tw.f_serviceitems,
  662. tw.f_invoceobj,
  663. tw.f_sign,
  664. tw.f_detentioncargo,
  665. tw.f_booksmarks,
  666. tw.f_shippername,
  667. tw.f_shipperattn,
  668. tw.f_shippertel,
  669. tw.f_consigneername,
  670. tw.f_consigneeattn,
  671. tw.f_consigneetel,
  672. tw.f_insurance,
  673. tw.f_insuranceamt,
  674. tw.f_closedate,
  675. tw.f_docmentdate,
  676. tw.f_vslid,
  677. tw.f_voyid,
  678. tw.f_typeid,
  679. tw.f_paymode,
  680. tw.f_laneid,
  681. tw.f_cntval,
  682. tw.f_date_changed,
  683. tw.f_market_number,
  684. tw.f_market_typid,
  685. tw.f_money,
  686. tc.f_name AS corpsName,
  687. tr.f_manage AS manage,
  688. tr.f_no AS corpsNo,
  689. su.user_name AS personNaem,
  690. tp.f_name AS projectName,
  691. tr.f_name AS fsbuName,
  692. tr.f_tel AS fsbuTel,
  693. tw.f_teachers_weight,
  694. tw.f_students_weight,
  695. tw.f_purchase,
  696. sr.user_name AS fpurchaseName,
  697. tw.f_create_log,
  698. tw.f_print_log,
  699. tw.f_print,
  700. tw.f_take_orders,
  701. tw.f_reason,
  702. tw.f_allot_warehouseid,
  703. tw.f_project,
  704. tj.f_name AS fProjectName,
  705. th.f_name AS fAllotWarehouseName
  706. FROM t_warehousebills tw
  707. LEFT JOIN t_project tp ON tw.f_goodsid = tp.f_id
  708. LEFT JOIN t_corps tc ON tp.f_corpid = tc.f_id
  709. LEFT JOIN t_corps ts ON tw.f_corpid = ts.f_id
  710. LEFT JOIN t_corps tr ON tw.f_sbu = tr.f_id
  711. LEFT JOIN sys_user su ON su.user_id = tp.f_person
  712. LEFT JOIN sys_user sr ON sr.user_id = tw.f_purchase
  713. LEFT JOIN sys_user sy ON sy.user_id = tw.f_storekeeper
  714. LEFT JOIN t_project tj ON tw.f_project = tj.f_id
  715. LEFT JOIN t_warehouse th ON tw.f_allot_warehouseid = th.f_id
  716. LEFT JOIN t_warehouse te ON tw.f_warehouseid = te.f_id
  717. where tw.f_id = #{fId}
  718. ORDER BY f_bsdate desc
  719. </select>
  720. <select id="selectTWarehousebillsItemsList"
  721. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems">
  722. SELECT (@ii := @ii + 1) AS fId,
  723. CASE
  724. wi.f_billtype
  725. WHEN 'SJRK' THEN
  726. '入库'
  727. WHEN 'SJCK' THEN
  728. '出库'
  729. WHEN 'KCZZ' THEN
  730. '库存总账'
  731. END AS fBilltype,
  732. wi.f_mblno AS fMblno,
  733. wi.f_product_name AS fGoodsid,
  734. wi.f_marks AS fMarks,
  735. wi.f_bsdate AS fBsdate,
  736. dict.dict_label AS fFeeUnitid,
  737. wi.f_billing_qty AS fBillingQty,
  738. wi.f_chargedate AS fChargedate,
  739. wi.f_billing_deadline AS fBillingDeadline,
  740. wi.f_billing_days AS fBillingDays,
  741. wi.f_inventory_days AS fInventoryDays,
  742. wi.f_amt AS fAmt,
  743. wi.remark AS remark
  744. FROM t_warehousebills w
  745. LEFT JOIN t_warehousebillsfees wi ON w.f_id = wi.f_pid
  746. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  747. , (
  748. SELECT @ii := 0
  749. ) AS ii
  750. WHERE w.f_id = #{fId}
  751. AND w.f_typeid IS NULL
  752. AND dict.status = '0'
  753. AND dict.dict_type = 'data_unitfees'
  754. </select>
  755. <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
  756. SELECT
  757. co.f_name AS fName,
  758. it.f_bsdate AS fBsdate,
  759. leg.f_mblno AS fMblno,
  760. it.f_business_type AS fBusinessType,
  761. dict.dict_label AS fBusinessTypes,
  762. it.f_marks AS fMarks ,
  763. goo.f_name AS fGoodsName,
  764. it.f_warehouse_information AS fWarehouseLocationids,
  765. dicttr.dict_label AS fTrademodeid,
  766. it.f_qty AS fQty,
  767. it.f_grossweight AS fGrossweight,
  768. it.f_netweight AS fNetweight,
  769. CASE
  770. it.f_billtype
  771. WHEN 'SJRK' THEN
  772. '入库'
  773. WHEN 'SJCK' THEN
  774. '出库'
  775. WHEN 'CKDB' THEN
  776. '调拨'
  777. END AS fBilltype
  778. FROM
  779. t_warehousebills leg
  780. left join sys_user u on leg.create_by = u.user_name
  781. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  782. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  783. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  784. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  785. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  786. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  787. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  788. <where>
  789. dict.status = '0'
  790. AND leg.f_typeid IS NULL
  791. AND dict.dict_type = 'storage_type'
  792. AND dicttr.STATUS = '0'
  793. AND dicttr.dict_type = 'data_trademodes'
  794. AND leg.f_billtype in ('SJRK','CKDB')
  795. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  796. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  797. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  798. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  799. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  800. <if test="fLocation != null and fLocation ==1 ">
  801. and it.f_warehouselocid = #{fWarehouseid}
  802. </if>
  803. <if test="fLocation != null and fLocation ==0 ">
  804. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  805. </if>
  806. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  807. and it.f_bsdate &gt;= #{timeInterval[0]}
  808. </if>
  809. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  810. and it.f_bsdate &lt;= #{timeInterval[1]}
  811. </if>
  812. </where>
  813. ${params.dataScope}
  814. </select>
  815. <select id="selectInventorySJCKList" parameterType="TWarehousebills" resultType="java.util.Map">
  816. SELECT
  817. co.f_name AS fName,
  818. it.f_bsdate AS fBsdate,
  819. leg.f_mblno AS fMblno,
  820. it.f_business_type AS fBusinessType,
  821. dict.dict_label AS fBusinessTypes,
  822. it.f_marks AS fMarks ,
  823. goo.f_name AS fGoodsName,
  824. dicttr.dict_label AS fTrademodeid,
  825. it.f_qty AS fQty,
  826. it.f_grossweight AS fGrossweight,
  827. it.f_netweight AS fNetweight,
  828. CASE
  829. it.f_billtype
  830. WHEN 'SJRK' THEN
  831. '入库'
  832. WHEN 'SJCK' THEN
  833. '出库'
  834. WHEN 'CKDB' THEN
  835. '调拨'
  836. END AS fBilltype ,
  837. CASE
  838. it.f_billtype
  839. WHEN 'SJRK' THEN
  840. it.f_warehouse_information
  841. WHEN 'SJCK' THEN
  842. it.f_warehouse_information
  843. WHEN 'CKDB' THEN
  844. it.f_orgwarehouse_information
  845. END AS fWarehouseLocationids
  846. FROM
  847. t_warehousebills leg
  848. left join sys_user u on leg.create_by = u.user_name
  849. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  850. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  851. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  852. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  853. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  854. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  855. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  856. <where>
  857. dict.status = '0'
  858. AND leg.f_typeid IS NULL
  859. AND dict.dict_type = 'storage_type'
  860. AND dicttr.STATUS = '0'
  861. AND dicttr.dict_type = 'data_trademodes'
  862. AND leg.f_billtype in ('SJCK','CKDB')
  863. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  864. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  865. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  866. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  867. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  868. <if test="fLocation != null and fLocation ==1 ">
  869. and it.f_warehouselocid = #{fWarehouseid}
  870. </if>
  871. <if test="fLocation != null and fLocation ==0 ">
  872. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  873. </if>
  874. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  875. and it.f_bsdate &gt;= #{timeInterval[0]}
  876. </if>
  877. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  878. and it.f_bsdate &lt;= #{timeInterval[1]}
  879. </if>
  880. </where>
  881. ${params.dataScope}
  882. </select>
  883. <select id="selectTWarehousebillsItemList"
  884. resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
  885. SELECT
  886. ( @ii := @ii + 1 ) AS fId,
  887. co.f_name AS fCorpid,
  888. it.f_bsdate AS fBsdate,
  889. leg.f_mblno AS fMblno,
  890. dict.dict_label AS fBusinessType,
  891. it.f_marks AS fMarks,
  892. go.f_name AS fGoodsid,
  893. it.f_warehouse_information AS fWarehouseInformation,
  894. dicttr.dict_label AS fTrademodeid,
  895. it.f_qty AS fQty,
  896. it.f_grossweight AS fGrossweight,
  897. it.f_netweight AS fNetweight
  898. FROM
  899. t_warehousebills leg
  900. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  901. LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
  902. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  903. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  904. LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
  905. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
  906. SELECT
  907. @ii := 0
  908. ) AS ii
  909. WHERE
  910. dict.STATUS = '0'
  911. AND leg.f_typeid IS NULL
  912. AND dict.dict_type = 'storage_type'
  913. AND dicttr.STATUS = '0'
  914. AND dicttr.dict_type = 'data_trademodes'
  915. AND leg.f_billtype IN (
  916. 'SJRk',
  917. 'SJCK'
  918. )
  919. <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
  920. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  921. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  922. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  923. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  924. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  925. <if test="fLocation != null and fLocation ==1 ">
  926. and it.f_warehouselocid = #{fWarehouseid}
  927. </if>
  928. <if test="fLocation != null and fLocation ==0 ">
  929. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  930. </if>
  931. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  932. and it.f_bsdate &gt;= #{timeInterval[0]}
  933. </if>
  934. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  935. and it.f_bsdate &lt;= #{timeInterval[1]}
  936. </if>
  937. </select>
  938. <select id="selectContainMblno" parameterType="TWarehousebills" resultType="int">
  939. SELECT count(f_id)
  940. FROM t_warehousebills
  941. where f_mblno = #{fMblno}
  942. AND f_bsdate = #{fBsdate}
  943. AND f_billtype = #{fBilltype}
  944. </select>
  945. <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
  946. insert into t_warehousebills
  947. <trim prefix="(" suffix=")" suffixOverrides=",">
  948. <if test="fBillno != null">f_billno,</if>
  949. <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
  950. <if test="fOriginalbillno != null">f_originalbillno,</if>
  951. <if test="fDeptid != null">f_deptid,</if>
  952. <if test="fBsdeptid != null">f_bsdeptid,</if>
  953. <if test="fContacts != null">f_contacts,</if>
  954. <if test="fTel != null">f_tel,</if>
  955. <if test="fCorpid != null">f_corpid,</if>
  956. <if test="fTocorpid != null">f_tocorpid,</if>
  957. <if test="fStltypeid != null">f_stltypeid,</if>
  958. <if test="fBscorpno != null">f_bscorpno,</if>
  959. <if test="fWarehouseid != null">f_warehouseid,</if>
  960. <if test="fStorekeeper != null">f_storekeeper,</if>
  961. <if test="fChargedate != null">f_chargedate,</if>
  962. <if test="fBsdate != null">f_bsdate,</if>
  963. <if test="fPlanqty != null">f_planqty,</if>
  964. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  965. <if test="fPlannetweight != null">f_plannetweight,</if>
  966. <if test="fPlanvolumn != null">f_planvolumn,</if>
  967. <if test="fQty != null">f_qty,</if>
  968. <if test="fGrossweight != null">f_grossweight,</if>
  969. <if test="fNetweight != null">f_netweight,</if>
  970. <if test="fVolumn != null">f_volumn,</if>
  971. <if test="fBillingway != null">f_billingway,</if>
  972. <if test="fTrademodeid != null">f_trademodeid,</if>
  973. <if test="fSbu != null">f_sbu,</if>
  974. <if test="fFeetunit != null">f_feetunit,</if>
  975. <if test="fMblno != null">f_mblno,</if>
  976. <if test="fMarks != null">f_marks,</if>
  977. <if test="fVslvoy != null">f_vslvoy,</if>
  978. <if test="fEta != null">f_eta,</if>
  979. <if test="fCustomno != null">f_customno,</if>
  980. <if test="fIfweigh != null">f_ifweigh,</if>
  981. <if test="fIfpledge != null">f_ifpledge,</if>
  982. <if test="fIfdamage != null">f_ifdamage,</if>
  983. <if test="fBankcorpid != null">f_bankcorpid,</if>
  984. <if test="fBilltype != null">f_billtype,</if>
  985. <if test="fBillstatus != null">f_billstatus,</if>
  986. <if test="fItemsStatus != null">f_items_status,</if>
  987. <if test="delFlag != null">del_flag,</if>
  988. <if test="createBy != null">create_by,</if>
  989. <if test="createTime != null">create_time,</if>
  990. <if test="updateBy != null">update_by,</if>
  991. <if test="updateTime != null">update_time,</if>
  992. <if test="remark != null">remark,</if>
  993. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  994. <if test="fProductName != null">f_product_name,</if>
  995. <if test="fReviewDate != null">f_review_date,</if>
  996. <if test="fTruckno != null">f_truckno,</if>
  997. <if test="fDriverName != null">f_driver_name,</if>
  998. <if test="fDriverTel != null">f_driver_tel,</if>
  999. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  1000. <if test="fBusinessType != null">f_business_type,</if>
  1001. <if test="fLabour != null">f_labour,</if>
  1002. <if test="fFleet != null">f_fleet,</if>
  1003. <if test="fInwarehouseid != null">f_inwarehouseid,</if>
  1004. <if test="fBstime != null">f_bstime,</if>
  1005. <if test="fCartype != null">f_cartype,</if>
  1006. <if test="fGoodsid != null">f_goodsid,</if>
  1007. <if test="fNewTrademodeid != null">f_new_trademodeid,</if>
  1008. <if test="fLoadportid != null">f_loadportid,</if>
  1009. <if test="fDestportid != null">f_destportid,</if>
  1010. <if test="fServiceitems != null">f_serviceitems,</if>
  1011. <if test="fInvoceobj != null">f_invoceobj,</if>
  1012. <if test="fSign != null">f_sign,</if>
  1013. <if test="fDetentioncargo != null">f_detentioncargo,</if>
  1014. <if test="fBooksmarks != null">f_booksmarks,</if>
  1015. <if test="fShippername != null">f_shippername,</if>
  1016. <if test="fShipperattn != null">f_shipperattn,</if>
  1017. <if test="fShippertel != null">f_shippertel,</if>
  1018. <if test="fConsigneername != null">f_consigneername,</if>
  1019. <if test="fConsigneeattn != null">f_consigneeattn,</if>
  1020. <if test="fConsigneetel != null">f_consigneetel,</if>
  1021. <if test="fInsurance != null">f_insurance,</if>
  1022. <if test="fInsuranceamt != null">f_insuranceamt,</if>
  1023. <if test="fClosedate != null">f_closedate,</if>
  1024. <if test="fDocmentdate != null">f_docmentdate,</if>
  1025. <if test="fVslid != null">f_vslid,</if>
  1026. <if test="fVoyid != null">f_voyid,</if>
  1027. <if test="fTypeid != null">f_typeid,</if>
  1028. <if test="fPaymode != null">f_paymode,</if>
  1029. <if test="fLaneid != null">f_laneid,</if>
  1030. <if test="fCntval != null">f_cntval,</if>
  1031. <if test="fDateChanged != null">f_date_changed,</if>
  1032. <if test="fStudentsWeight != null">f_students_weight,</if>
  1033. <if test="fTeachersWeight != null">f_teachers_weight,</if>
  1034. <if test="fMarketTypid != null">f_market_typid,</if>
  1035. <if test="fMarketNumber != null">f_market_number,</if>
  1036. <if test="fMoney != null">f_money,</if>
  1037. <if test="fPurchase != null">f_purchase,</if>
  1038. <if test="freeContainerDate != null">free_container_date,</if>
  1039. <if test="fCreateLog != null">f_create_log,</if>
  1040. <if test="fPrintLog != null">f_print_log,</if>
  1041. <if test="fPrint != null">f_print,</if>
  1042. <if test="fTakeOrders != null">f_take_orders,</if>
  1043. <if test="fReason != null">f_reason,</if>
  1044. <if test="fAllotWarehouseid != null">f_allot_warehouseid,</if>
  1045. <if test="fProject != null">f_project,</if>
  1046. </trim>
  1047. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1048. <if test="fBillno != null">#{fBillno},</if>
  1049. <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
  1050. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  1051. <if test="fDeptid != null">#{fDeptid},</if>
  1052. <if test="fBsdeptid != null">#{fBsdeptid},</if>
  1053. <if test="fContacts != null">#{fContacts},</if>
  1054. <if test="fTel != null">#{fTel},</if>
  1055. <if test="fCorpid != null">#{fCorpid},</if>
  1056. <if test="fTocorpid != null">#{fTocorpid},</if>
  1057. <if test="fStltypeid != null">#{fStltypeid},</if>
  1058. <if test="fBscorpno != null">#{fBscorpno},</if>
  1059. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  1060. <if test="fStorekeeper != null">#{fStorekeeper},</if>
  1061. <if test="fChargedate != null">#{fChargedate},</if>
  1062. <if test="fBsdate != null">#{fBsdate},</if>
  1063. <if test="fPlanqty != null">#{fPlanqty},</if>
  1064. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  1065. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  1066. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  1067. <if test="fQty != null">#{fQty},</if>
  1068. <if test="fGrossweight != null">#{fGrossweight},</if>
  1069. <if test="fNetweight != null">#{fNetweight},</if>
  1070. <if test="fVolumn != null">#{fVolumn},</if>
  1071. <if test="fBillingway != null">#{fBillingway},</if>
  1072. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  1073. <if test="fSbu != null">#{fSbu},</if>
  1074. <if test="fFeetunit != null">#{fFeetunit},</if>
  1075. <if test="fMblno != null">#{fMblno},</if>
  1076. <if test="fMarks != null">#{fMarks},</if>
  1077. <if test="fVslvoy != null">#{fVslvoy},</if>
  1078. <if test="fEta != null">#{fEta},</if>
  1079. <if test="fCustomno != null">#{fCustomno},</if>
  1080. <if test="fIfweigh != null">#{fIfweigh},</if>
  1081. <if test="fIfpledge != null">#{fIfpledge},</if>
  1082. <if test="fIfdamage != null">#{fIfdamage},</if>
  1083. <if test="fBankcorpid != null">#{fBankcorpid},</if>
  1084. <if test="fBilltype != null">#{fBilltype},</if>
  1085. <if test="fBillstatus != null">#{fBillstatus},</if>
  1086. <if test="fItemsStatus != null">#{fItemsStatus},</if>
  1087. <if test="delFlag != null">#{delFlag},</if>
  1088. <if test="createBy != null">#{createBy},</if>
  1089. <if test="createTime != null">#{createTime},</if>
  1090. <if test="updateBy != null">#{updateBy},</if>
  1091. <if test="updateTime != null">#{updateTime},</if>
  1092. <if test="remark != null">#{remark},</if>
  1093. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  1094. <if test="fProductName != null">#{fProductName},</if>
  1095. <if test="fReviewDate != null">#{fReviewDate},</if>
  1096. <if test="fTruckno != null">#{fTruckno},</if>
  1097. <if test="fDriverName != null">#{fDriverName},</if>
  1098. <if test="fDriverTel != null">#{fDriverTel},</if>
  1099. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  1100. <if test="fBusinessType != null">#{fBusinessType},</if>
  1101. <if test="fLabour != null">#{fLabour},</if>
  1102. <if test="fFleet != null">#{fFleet},</if>
  1103. <if test="fInwarehouseid != null">#{fInwarehouseid},</if>
  1104. <if test="fBstime != null">#{fBstime},</if>
  1105. <if test="fCartype != null">#{fCartype},</if>
  1106. <if test="fGoodsid != null">#{fGoodsid},</if>
  1107. <if test="fNewTrademodeid != null">#{fNewTrademodeid},</if>
  1108. <if test="fLoadportid != null">#{fLoadportid},</if>
  1109. <if test="fDestportid != null">#{fDestportid},</if>
  1110. <if test="fServiceitems != null">#{fServiceitems},</if>
  1111. <if test="fInvoceobj != null">#{fInvoceobj},</if>
  1112. <if test="fSign != null">#{fSign},</if>
  1113. <if test="fDetentioncargo != null">#{fDetentioncargo},</if>
  1114. <if test="fBooksmarks != null">#{fBooksmarks},</if>
  1115. <if test="fShippername != null">#{fShippername},</if>
  1116. <if test="fShipperattn != null">#{fShipperattn},</if>
  1117. <if test="fShippertel != null">#{fShippertel},</if>
  1118. <if test="fConsigneername != null">#{fConsigneername},</if>
  1119. <if test="fConsigneeattn != null">#{fConsigneeattn},</if>
  1120. <if test="fConsigneetel != null">#{fConsigneetel},</if>
  1121. <if test="fInsurance != null">#{fInsurance},</if>
  1122. <if test="fInsuranceamt != null">#{fInsuranceamt},</if>
  1123. <if test="fClosedate != null">#{fClosedate},</if>
  1124. <if test="fDocmentdate != null">#{fDocmentdate},</if>
  1125. <if test="fVslid != null">#{fVslid},</if>
  1126. <if test="fVoyid != null">#{fVoyid},</if>
  1127. <if test="fTypeid != null">#{fTypeid},</if>
  1128. <if test="fPaymode != null">#{fPaymode},</if>
  1129. <if test="fLaneid != null">#{fLaneid},</if>
  1130. <if test="fCntval != null">#{fCntval},</if>
  1131. <if test="fDateChanged != null">#{fDateChanged},</if>
  1132. <if test="fStudentsWeight != null">#{fStudentsWeight},</if>
  1133. <if test="fTeachersWeight != null">#{fTeachersWeight},</if>
  1134. <if test="fMarketTypid != null">#{fMarketTypid},</if>
  1135. <if test="fMarketNumber != null">#{fMarketNumber},</if>
  1136. <if test="fMoney != null">#{fMoney},</if>
  1137. <if test="fPurchase != null">#{fPurchase},</if>
  1138. <if test="freeContainerDate != null">#{freeContainerDate},</if>
  1139. <if test="fCreateLog != null">#{fCreateLog},</if>
  1140. <if test="fPrintLog != null">#{fPrintLog},</if>
  1141. <if test="fPrint != null">#{fPrint},</if>
  1142. <if test="fTakeOrders != null">#{fTakeOrders},</if>
  1143. <if test="fReason != null">#{fReason},</if>
  1144. <if test="fAllotWarehouseid != null">#{fAllotWarehouseid},</if>
  1145. <if test="fProject != null">#{fProject},</if>
  1146. </trim>
  1147. </insert>
  1148. <update id="updateTWarehousebills" parameterType="TWarehousebills">
  1149. update t_warehousebills
  1150. <trim prefix="SET" suffixOverrides=",">
  1151. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1152. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1153. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1154. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1155. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1156. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1157. <if test="fTel != null">f_tel = #{fTel},</if>
  1158. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1159. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1160. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1161. <if test="fBscorpno != null">f_bscorpno = #{fBscorpno},</if>
  1162. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1163. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1164. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1165. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1166. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1167. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1168. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1169. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1170. <if test="fQty != null">f_qty = #{fQty},</if>
  1171. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1172. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1173. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1174. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1175. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1176. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1177. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1178. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1179. <if test="fMarks != null">f_marks = #{fMarks},</if>
  1180. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1181. <if test="fEta != null">f_eta = #{fEta},</if>
  1182. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1183. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1184. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1185. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1186. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1187. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1188. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1189. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1190. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1191. <if test="createBy != null">create_by = #{createBy},</if>
  1192. <if test="createTime != null">create_time = #{createTime},</if>
  1193. <if test="updateBy != null">update_by = #{updateBy},</if>
  1194. <if test="updateTime != null">update_time = #{updateTime},</if>
  1195. <if test="remark != null">remark = #{remark},</if>
  1196. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1197. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1198. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  1199. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1200. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1201. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1202. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1203. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1204. <if test="fLabour != null">f_labour = #{fLabour},</if>
  1205. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1206. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1207. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1208. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1209. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1210. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1211. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1212. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1213. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1214. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1215. <if test="fSign != null">f_sign = #{fSign},</if>
  1216. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1217. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1218. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1219. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1220. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1221. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1222. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1223. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1224. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1225. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1226. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1227. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1228. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1229. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1230. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1231. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1232. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1233. <if test="fCntval != null">f_cntval = #{fCntval},</if>
  1234. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  1235. <if test="fStudentsWeight != null">f_students_weight = #{fStudentsWeight},</if>
  1236. <if test="fTeachersWeight != null">f_teachers_weight = #{fTeachersWeight},</if>
  1237. <if test="fMarketTypid != null">f_market_typid = #{fMarketTypid},</if>
  1238. <if test="fMarketNumber != null">f_market_number = #{fMarketNumber},</if>
  1239. <if test="fMoney != null">f_money = #{fMoney},</if>
  1240. <if test="fPurchase != null">f_purchase = #{fPurchase},</if>
  1241. <if test="fCreateLog != null">f_create_log = #{fCreateLog},</if>
  1242. <if test="fPrintLog != null">f_print_log = #{fPrintLog},</if>
  1243. <if test="fPrint != null">f_print = #{fPrint},</if>
  1244. <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
  1245. <if test="fReason != null">f_reason = #{fReason},</if>
  1246. <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
  1247. <if test="fProject != null">f_project = #{fProject},</if>
  1248. </trim>
  1249. where f_id = #{fId}
  1250. </update>
  1251. <update id="updateKaHeOrder" parameterType="TWarehousebills">
  1252. update t_warehousebills
  1253. <trim prefix="SET" suffixOverrides=",">
  1254. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1255. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1256. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1257. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1258. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1259. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1260. <if test="fTel != null">f_tel = #{fTel},</if>
  1261. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1262. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1263. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1264. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
  1265. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1266. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1267. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1268. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1269. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1270. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1271. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1272. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1273. <if test="fQty != null">f_qty = #{fQty},</if>
  1274. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1275. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1276. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1277. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1278. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1279. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1280. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1281. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1282. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1283. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  1284. <if test="fEta != null">f_eta = #{fEta},</if>
  1285. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1286. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1287. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1288. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1289. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1290. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1291. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1292. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1293. <if test="createBy != null">create_by = #{createBy},</if>
  1294. <if test="createTime != null">create_time = #{createTime},</if>
  1295. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1296. <if test="updateBy != null">update_by = #{updateBy},</if>
  1297. <if test="updateTime != null">update_time = #{updateTime},</if>
  1298. <if test="remark != null">remark = #{remark},</if>
  1299. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1300. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1301. <if test="fReviewDate != null and fBillstatus == 6">f_review_date = #{fReviewDate},</if>
  1302. <if test="fReviewDate != null and fBillstatus != 6">f_review_date = null,</if>
  1303. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1304. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1305. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1306. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1307. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1308. <if test="fReviewDate == null">f_review_date = null,</if>
  1309. <if test="fLabour != null">f_labour = #{fLabour },</if>
  1310. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1311. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1312. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1313. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1314. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1315. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1316. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1317. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1318. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1319. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1320. <if test="fSign != null">f_sign = #{fSign},</if>
  1321. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1322. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1323. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1324. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1325. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1326. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1327. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1328. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1329. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1330. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1331. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1332. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1333. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1334. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1335. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1336. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1337. <if test="fMoney != null">f_money = #{fMoney},</if>
  1338. <if test="fPurchase != null">f_purchase = #{fPurchase},</if>
  1339. <if test="fCreateLog != null">f_create_log = #{fCreateLog},</if>
  1340. <if test="fPrintLog != null">f_print_log = #{fPrintLog},</if>
  1341. <if test="fPrint != null">f_print = #{fPrint},</if>
  1342. <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
  1343. <if test="fReason != null">f_reason = #{fReason},</if>
  1344. <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
  1345. <if test="fProject != null">f_project = #{fProject},</if>
  1346. </trim>
  1347. where f_id = #{fId}
  1348. </update>
  1349. <delete id="deleteTWarehousebillsById" parameterType="Long">
  1350. delete
  1351. from t_warehousebills
  1352. where f_id = #{fId}
  1353. </delete>
  1354. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  1355. delete
  1356. item.*,
  1357. bill.*,
  1358. fess.*,
  1359. enclosure.*
  1360. from
  1361. t_warehousebills bill
  1362. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  1363. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  1364. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1365. where
  1366. bill.f_id in
  1367. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1368. #{fId}
  1369. </foreach>
  1370. </delete>
  1371. <delete id="deleteKHTWarehousebillsByIds" parameterType="String">
  1372. delete
  1373. bill.*,
  1374. fess.*,
  1375. enclosure.*
  1376. from
  1377. t_warehousebills bill
  1378. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1379. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1380. where
  1381. bill.f_id in
  1382. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1383. #{fId}
  1384. </foreach>
  1385. </delete>
  1386. <update id="warehouseFollowUpdate">
  1387. update
  1388. t_warehousebills
  1389. <trim prefix="SET" suffixOverrides=",">
  1390. <if test="fettle != null">f_billstatus = #{fettle},</if>
  1391. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  1392. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  1393. </trim>
  1394. where f_id = #{fPid}
  1395. </update>
  1396. <select id="selectDetailedList" resultType="java.util.Map">
  1397. SELECT t.f_id AS fId,
  1398. item.f_id AS fItemsId,
  1399. C.f_name AS fcorpid,
  1400. t.f_mblno AS fMblno,
  1401. g.f_name AS fGoodsid,
  1402. dict.dict_label AS fBusinessType,
  1403. t.f_marks AS fMarks,
  1404. CASE
  1405. WHEN t.f_billtype = 'SJRK' THEN
  1406. '入库'
  1407. WHEN t.f_billtype = 'SJCK' THEN
  1408. '出库'
  1409. WHEN t.f_billtype = 'CKDB' THEN
  1410. '调拨'
  1411. WHEN t.f_billtype = 'HQZY' THEN
  1412. '货权转移'
  1413. WHEN t.f_billtype = 'HWTG' THEN
  1414. '货物通关'
  1415. END AS fBilltype,
  1416. item.f_bsdate AS fBsdate,
  1417. item.f_warehouse_information AS fWarehouseInformation,
  1418. dictTra.dict_label AS fTrademodeid,
  1419. CASE
  1420. WHEN t.f_billtype = 'SJRK' THEN
  1421. item.f_qty
  1422. else '0'
  1423. END AS fQtyRK,
  1424. CASE
  1425. WHEN t.f_billtype = 'SJRK' THEN
  1426. item.f_grossweight
  1427. else '0'
  1428. END AS fGrossweightRK,
  1429. CASE
  1430. WHEN t.f_billtype = 'SJRK' THEN
  1431. item.f_netweight
  1432. else '0'
  1433. END AS fNetweightRK,
  1434. CASE
  1435. WHEN t.f_billtype = 'SJCK' THEN
  1436. item.f_qty
  1437. else '0'
  1438. END AS fQtyCK,
  1439. CASE
  1440. WHEN t.f_billtype = 'SJCK' THEN
  1441. item.f_grossweight
  1442. else '0'
  1443. END AS fGrossweightCK,
  1444. CASE
  1445. WHEN t.f_billtype = 'SJCK' THEN
  1446. item.f_netweight
  1447. else '0'
  1448. END AS fNetweightCK,
  1449. CASE
  1450. WHEN t.f_billtype = 'CKDB' THEN
  1451. item.f_qty
  1452. else '0'
  1453. END AS fQtyDB,
  1454. CASE
  1455. WHEN t.f_billtype = 'CKDB' THEN
  1456. item.f_grossweight
  1457. else '0'
  1458. END AS fGrossweightDB,
  1459. CASE
  1460. WHEN t.f_billtype = 'CKDB' THEN
  1461. item.f_netweight
  1462. else '0'
  1463. END AS fNetweightDB,
  1464. CASE
  1465. WHEN t.f_billtype = 'HQZY' THEN
  1466. item.f_qty
  1467. else '0'
  1468. END AS fQtyHZ,
  1469. CASE
  1470. WHEN t.f_billtype = 'HQZY' THEN
  1471. item.f_grossweight
  1472. else '0'
  1473. END AS fGrossweightHZ,
  1474. CASE
  1475. WHEN t.f_billtype = 'HQZY' THEN
  1476. item.f_netweight
  1477. else '0'
  1478. END AS fNetweightHZ,
  1479. CASE
  1480. WHEN t.f_billtype = 'HWTG' THEN
  1481. item.f_qty
  1482. else '0'
  1483. END AS fQtyTG,
  1484. CASE
  1485. WHEN t.f_billtype = 'HWTG' THEN
  1486. item.f_grossweight
  1487. else '0'
  1488. END AS fGrossweightTG,
  1489. CASE
  1490. WHEN t.f_billtype = 'HWTG' THEN
  1491. item.f_netweight
  1492. else '0'
  1493. END AS fNetweightTG
  1494. FROM t_warehousebills t
  1495. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1496. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1497. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1498. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1499. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1500. WHERE dict.STATUS = '0'
  1501. AND t.f_typeid IS NULL
  1502. AND dict.dict_type = 'storage_type'
  1503. AND dictTra.STATUS = '0'
  1504. AND dictTra.dict_type = 'data_trademodes'
  1505. AND item.f_billstatus = 40
  1506. AND item.f_mblno = #{fMblno}
  1507. AND (item.f_warehouselocid = #{fWarehouseLocationid} or
  1508. item.f_transfer_warehouselocid = #{fWarehouseLocationid})
  1509. AND t.f_trademodeid = #{fTrademodeids}
  1510. AND item.f_business_type = #{fBusinessType}
  1511. AND item.f_goodsid = #{fGoodsid}
  1512. AND item.f_marks = #{fMarks}
  1513. AND t.f_corpid = #{fCorpIds}
  1514. </select>
  1515. <select id="webVersionOrderList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1516. SELECT tw.f_id,
  1517. tw.f_billno,
  1518. tw.f_customsdeclartion,
  1519. tw.f_originalbillno,
  1520. tw.f_deptid,
  1521. tw.f_bsdeptid,
  1522. tw.f_contacts,
  1523. tw.f_tel,
  1524. tw.f_corpid,
  1525. tc.f_name corpName,
  1526. tw.f_tocorpid,
  1527. tw.f_stltypeid,
  1528. tw.f_bscorpno,
  1529. tw.f_warehouseid,
  1530. tw.f_storekeeper,
  1531. tw.f_chargedate,
  1532. tw.f_bsdate,
  1533. tw.f_planqty,
  1534. tw.f_plangrossweight,
  1535. tw.f_plannetweight,
  1536. tw.f_planvolumn,
  1537. tw.f_qty,
  1538. tw.f_grossweight,
  1539. tw.f_netweight,
  1540. tw.f_volumn,
  1541. tw.f_billingway,
  1542. tw.f_trademodeid,
  1543. tw.f_sbu,
  1544. tw.f_feetunit,
  1545. tw.f_mblno,
  1546. tw.f_marks,
  1547. tw.f_vslvoy,
  1548. tw.f_eta,
  1549. tw.f_customno,
  1550. tw.f_ifweigh,
  1551. tw.f_ifpledge,
  1552. tw.f_ifdamage,
  1553. tw.f_bankcorpid,
  1554. tw.f_billtype,
  1555. tw.f_billstatus,
  1556. tw.f_items_status,
  1557. tw.del_flag,
  1558. tw.create_by,
  1559. tw.create_time,
  1560. tw.update_by,
  1561. tw.update_time,
  1562. tw.remark,
  1563. tw.f_billing_deadline,
  1564. tw.f_product_name,
  1565. tw.f_review_date,
  1566. tw.f_truckno,
  1567. tw.f_driver_name,
  1568. tw.f_driver_tel,
  1569. tw.f_driver_id_car,
  1570. tw.f_business_type,
  1571. tw.f_labour,
  1572. tw.f_fleet,
  1573. tw.f_inwarehouseid,
  1574. tw.f_bstime,
  1575. tw.f_cartype,
  1576. tw.f_goodsid,
  1577. tw.f_new_trademodeid,
  1578. tw.f_loadportid,
  1579. address.f_name loadportidName,
  1580. tw.f_destportid,
  1581. ta.f_name destportidName,
  1582. tw.f_serviceitems,
  1583. sd.dict_label serviceitemsName,
  1584. tw.f_invoceobj,
  1585. sdi.dict_label invoceobjName,
  1586. tw.f_sign,
  1587. sdc.dict_label signName,
  1588. tw.f_detentioncargo,
  1589. sdt.dict_label detentioncargoName,
  1590. tw.f_booksmarks,
  1591. tw.f_shippername,
  1592. tw.f_shipperattn,
  1593. tw.f_shippertel,
  1594. tw.f_consigneername,
  1595. tw.f_consigneeattn,
  1596. tw.f_consigneetel,
  1597. tw.f_insurance,
  1598. sdd.dict_label insuranceName,
  1599. tw.f_insuranceamt,
  1600. tw.f_closedate,
  1601. tw.f_docmentdate,
  1602. tw.f_vslid,
  1603. tv.f_name vslidName,
  1604. tw.f_voyid,
  1605. ty.f_no voyidName,
  1606. tw.f_typeid,
  1607. tw.f_paymode,
  1608. sda.dict_label paymodeName,
  1609. tw.f_laneid,
  1610. tr.f_name laneidName,
  1611. tw.f_take_orders,
  1612. tw.f_reason
  1613. FROM t_warehousebills tw
  1614. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1615. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1616. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1617. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1618. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1619. AND sd.dict_type = 'f_serviceitems'
  1620. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1621. AND sdi.dict_type = 'f_invoceobj'
  1622. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1623. AND sdc.dict_type = 'f_sign'
  1624. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1625. AND sdt.dict_type = 'f_detentioncargo'
  1626. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1627. AND sdd.dict_type = 'f_insurance'
  1628. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1629. AND sda.dict_type = 'f_paymode'
  1630. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1631. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1632. <where>
  1633. tw.f_typeid = '1'
  1634. <if test="fId != null">and tw.f_id = #{fId}</if>
  1635. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1636. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1637. #{fCustomsdeclartion}
  1638. </if>
  1639. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1640. </if>
  1641. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1642. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1643. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1644. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1645. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1646. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1647. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1648. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1649. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1650. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1651. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1652. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1653. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1654. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1655. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1656. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1657. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1658. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1659. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1660. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1661. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1662. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1663. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1664. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1665. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1666. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1667. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1668. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1669. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1670. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1671. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1672. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1673. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1674. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1675. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1676. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1677. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1678. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1679. #{fProductName}, '%')
  1680. </if>
  1681. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1682. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1683. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1684. '%')
  1685. </if>
  1686. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1687. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1688. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1689. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1690. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1691. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1692. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1693. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1694. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1695. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1696. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1697. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1698. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1699. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1700. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1701. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1702. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1703. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1704. #{fShippername}, '%')
  1705. </if>
  1706. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1707. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1708. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1709. #{fConsigneername}, '%')
  1710. </if>
  1711. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1712. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1713. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1714. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1715. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1716. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1717. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1718. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1719. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1720. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1721. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1722. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1723. and tw.create_time &gt;= #{timeInterval[0]}
  1724. </if>
  1725. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1726. and tw.create_time &lt;= #{timeInterval[1]}
  1727. </if>
  1728. </where>
  1729. ORDER BY tw.create_time DESC, tw.f_id DESC
  1730. </select>
  1731. <select id="ruoYiVersionOrderList" parameterType="TWarehousebills" resultType="map">
  1732. SELECT
  1733. tw.f_id fId,
  1734. tw.f_billno fBillno,
  1735. tw.f_mblno fMblno,
  1736. sd.dict_label fServiceitems,
  1737. tw.f_consigneername fConsigneername,
  1738. ta.f_name fName,
  1739. tw.f_bsdate fBsdate,
  1740. tc.f_cntrcount fCntrcount,
  1741. tc.f_no fNo,
  1742. tv.f_name vslName,
  1743. ty.f_no voyNo,
  1744. tw.f_corpid,
  1745. tp.f_name corpName,
  1746. tw.create_by createBy,
  1747. tw.create_time createTime,
  1748. tw.f_loadportid,
  1749. tre.f_name loadportName,
  1750. tw.f_destportid,
  1751. ts.f_name destportName,
  1752. tc.f_name goodsName,
  1753. CASE
  1754. WHEN tw.f_billstatus = '1' THEN
  1755. '下单新建'
  1756. WHEN tw.f_billstatus = '2' THEN
  1757. '下单暂存'
  1758. WHEN tw.f_billstatus = '3' THEN
  1759. '下单驳回'
  1760. WHEN tw.f_billstatus = '4' THEN
  1761. '下单提交'
  1762. WHEN tw.f_billstatus = '5' THEN
  1763. '下单审批中'
  1764. WHEN tw.f_billstatus = '6' THEN
  1765. '下单审批通过'
  1766. WHEN tw.f_billstatus = '7' THEN
  1767. '配船暂存'
  1768. WHEN tw.f_billstatus = '8' THEN
  1769. '配船驳回'
  1770. WHEN tw.f_billstatus = '9' THEN
  1771. '配船提交'
  1772. WHEN tw.f_billstatus = '10' THEN
  1773. '配船审批中'
  1774. WHEN tw.f_billstatus = '11' THEN
  1775. '配船审批通过'
  1776. WHEN tw.f_billstatus = '12' THEN
  1777. '运单变更'
  1778. END AS fBillstatus,
  1779. CASE
  1780. WHEN tf.f_billstatus = '1' THEN
  1781. '新建'
  1782. WHEN tf.f_billstatus = '2' THEN
  1783. '暂存'
  1784. WHEN tf.f_billstatus = '3' THEN
  1785. '驳回'
  1786. WHEN tf.f_billstatus = '4' THEN
  1787. '提交'
  1788. WHEN tf.f_billstatus = '5' THEN
  1789. '审批中'
  1790. WHEN tf.f_billstatus = '6' THEN
  1791. '审批通过'
  1792. END AS moneyStatus,
  1793. tw.f_take_orders,
  1794. tw.f_reason
  1795. FROM
  1796. t_warehousebills tw
  1797. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  1798. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  1799. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  1800. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1801. AND sd.dict_type = 'f_serviceitems'
  1802. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  1803. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  1804. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  1805. LEFT JOIN (
  1806. SELECT
  1807. th.f_pid,
  1808. th.f_cntrcount,
  1809. tr.f_no,
  1810. th.f_cntrid,
  1811. tg.f_name
  1812. FROM
  1813. t_warehousebills_cntr th
  1814. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  1815. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  1816. ) tc ON tc.f_pid = tw.f_id
  1817. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid =
  1818. tw.f_id
  1819. <where>
  1820. tw.f_typeid = '1'
  1821. <if test="fId != null">and tw.f_id = #{fId}</if>
  1822. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1823. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1824. #{fCustomsdeclartion}
  1825. </if>
  1826. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1827. </if>
  1828. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1829. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1830. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1831. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1832. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1833. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1834. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1835. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1836. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1837. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1838. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1839. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1840. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1841. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1842. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1843. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1844. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1845. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1846. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1847. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1848. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1849. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1850. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1851. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1852. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1853. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1854. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1855. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1856. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1857. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1858. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1859. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1860. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1861. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1862. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1863. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1864. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1865. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1866. #{fProductName}, '%')
  1867. </if>
  1868. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1869. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1870. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1871. '%')
  1872. </if>
  1873. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1874. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1875. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1876. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1877. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1878. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1879. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1880. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1881. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1882. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1883. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1884. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1885. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1886. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1887. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1888. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1889. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1890. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1891. #{fShippername}, '%')
  1892. </if>
  1893. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1894. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1895. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1896. #{fConsigneername}, '%')
  1897. </if>
  1898. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1899. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1900. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1901. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1902. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1903. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1904. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1905. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1906. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1907. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1908. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1909. <if test='startTime != null'>
  1910. and tw.create_time &gt;= #{startTime}
  1911. </if>
  1912. <if test='endTime != null'>
  1913. and tw.create_time &lt;= #{endTime}
  1914. </if>
  1915. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  1916. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  1917. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  1918. #{vslidName}, '%')
  1919. </if>
  1920. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  1921. #{voyidName}, '%')
  1922. </if>
  1923. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  1924. #{voyidName}, '%')
  1925. </if>
  1926. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  1927. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  1928. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  1929. </if>
  1930. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  1931. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  1932. </if>
  1933. </where>
  1934. ORDER BY tw.create_time DESC, tw.f_id DESC
  1935. </select>
  1936. <select id="webVersionOrderById" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1937. SELECT tw.f_id,
  1938. tw.f_billno,
  1939. tw.f_customsdeclartion,
  1940. tw.f_originalbillno,
  1941. tw.f_deptid,
  1942. tw.f_bsdeptid,
  1943. tw.f_contacts,
  1944. tw.f_tel,
  1945. tw.f_corpid,
  1946. tc.f_name corpName,
  1947. tw.f_tocorpid,
  1948. tw.f_stltypeid,
  1949. tw.f_bscorpno,
  1950. tw.f_warehouseid,
  1951. tw.f_storekeeper,
  1952. tw.f_chargedate,
  1953. tw.f_bsdate,
  1954. tw.f_planqty,
  1955. tw.f_plangrossweight,
  1956. tw.f_plannetweight,
  1957. tw.f_planvolumn,
  1958. tw.f_qty,
  1959. tw.f_grossweight,
  1960. tw.f_netweight,
  1961. tw.f_volumn,
  1962. tw.f_billingway,
  1963. tw.f_trademodeid,
  1964. tw.f_sbu,
  1965. tw.f_feetunit,
  1966. tw.f_mblno,
  1967. tw.f_marks,
  1968. tw.f_vslvoy,
  1969. tw.f_eta,
  1970. tw.f_customno,
  1971. tw.f_ifweigh,
  1972. tw.f_ifpledge,
  1973. tw.f_ifdamage,
  1974. tw.f_bankcorpid,
  1975. tw.f_billtype,
  1976. tw.f_billstatus,
  1977. tw.f_items_status,
  1978. tw.del_flag,
  1979. tw.create_by,
  1980. tw.create_time,
  1981. tw.update_by,
  1982. tw.update_time,
  1983. tw.remark,
  1984. tw.f_billing_deadline,
  1985. tw.f_product_name,
  1986. tw.f_review_date,
  1987. tw.f_truckno,
  1988. tw.f_driver_name,
  1989. tw.f_driver_tel,
  1990. tw.f_driver_id_car,
  1991. tw.f_business_type,
  1992. tw.f_labour,
  1993. tw.f_fleet,
  1994. tw.f_inwarehouseid,
  1995. tw.f_bstime,
  1996. tw.f_cartype,
  1997. tw.f_goodsid,
  1998. tw.f_new_trademodeid,
  1999. tw.f_loadportid,
  2000. address.f_name loadportidName,
  2001. tw.f_destportid,
  2002. ta.f_name destportidName,
  2003. tw.f_serviceitems,
  2004. sd.dict_label serviceitemsName,
  2005. tw.f_invoceobj,
  2006. sdi.dict_label invoceobjName,
  2007. tw.f_sign,
  2008. sdc.dict_label signName,
  2009. tw.f_detentioncargo,
  2010. sdt.dict_label detentioncargoName,
  2011. tw.f_booksmarks,
  2012. tw.f_shippername,
  2013. tw.f_shipperattn,
  2014. tw.f_shippertel,
  2015. tw.f_consigneername,
  2016. tw.f_consigneeattn,
  2017. tw.f_consigneetel,
  2018. tw.f_insurance,
  2019. sdd.dict_label insuranceName,
  2020. tw.f_insuranceamt,
  2021. tw.f_closedate,
  2022. tw.f_docmentdate,
  2023. tw.f_vslid,
  2024. tv.f_name vslidName,
  2025. tw.f_voyid,
  2026. ty.f_no voyidName,
  2027. tw.f_typeid,
  2028. tw.f_paymode,
  2029. sda.dict_label paymodeName,
  2030. tw.f_laneid,
  2031. tr.f_name laneidName,
  2032. tw.f_take_orders,
  2033. tw.f_reason
  2034. FROM t_warehousebills tw
  2035. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  2036. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2037. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  2038. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  2039. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2040. AND sd.dict_type = 'f_serviceitems'
  2041. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  2042. AND sdi.dict_type = 'f_invoceobj'
  2043. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  2044. AND sdc.dict_type = 'f_sign'
  2045. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  2046. AND sdt.dict_type = 'f_detentioncargo'
  2047. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  2048. AND sdd.dict_type = 'f_insurance'
  2049. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  2050. AND sda.dict_type = 'f_paymode'
  2051. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  2052. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  2053. where tw.f_id = #{fId}
  2054. </select>
  2055. <select id="selectTWarehousebillsfMblno" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2056. SELECT f_id,
  2057. f_mblno
  2058. FROM t_warehousebills
  2059. WHERE f_typeid = '1'
  2060. and f_mblno = #{fMblno}
  2061. </select>
  2062. <select id="selectAppStockList" parameterType="TWarehousebills" resultType="Map">
  2063. SELECT
  2064. w.f_id fId,
  2065. w.f_corpid fCorpid,
  2066. c.f_name corpName,
  2067. w.f_bsdate fBsdate,
  2068. g.f_name goodsName,
  2069. w.f_mblno fMblno,
  2070. w.f_qty fQty,
  2071. w.f_cntval fCntval,
  2072. w.f_planqty fPlanqty,
  2073. t.f_name fWarehouseName,
  2074. w.f_planvolumn fPlanvolumn,
  2075. w.f_plannetweight fPlannetweight,
  2076. w.f_plangrossweight fPlangrossweight,
  2077. w.f_grossweight fGrossweight,
  2078. w.f_storekeeper fStorekeeper,
  2079. w.create_by createBy,
  2080. w.f_warehouseid fWarehouseid,
  2081. w.f_driver_tel fDriverTel,
  2082. w.f_trademodeid fTrademodeid,
  2083. CASE WHEN w.f_billstatus = '1' THEN '录入'
  2084. WHEN w.f_billstatus = '2' THEN '暂存'
  2085. WHEN w.f_billstatus = '3' THEN '驳回'
  2086. WHEN w.f_billstatus = '4' THEN '请核'
  2087. WHEN w.f_billstatus = '5' THEN '审核中'
  2088. WHEN w.f_billstatus = '6' THEN '全部入账'
  2089. END fBillstatus
  2090. FROM
  2091. t_warehousebills w
  2092. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2093. LEFT JOIN t_goods g ON g.f_id = w.f_goodsid
  2094. LEFT JOIN t_warehouse t ON t.f_id = w.f_warehouseid
  2095. left join sys_user u on w.create_by = u.user_name
  2096. left join sys_dept d on w.f_bsdeptid = d.dept_id
  2097. where
  2098. w.f_id != ''
  2099. and w.f_billtype = #{fBilltype}
  2100. or w.f_storekeeper = u.user_name
  2101. <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
  2102. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2103. and w.f_bsdate &gt;= #{timeInterval[0]}
  2104. </if>
  2105. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2106. and w.f_bsdate &lt;= #{timeInterval[1]}
  2107. </if>
  2108. ${params.dataScope}
  2109. order by w.f_bsdate desc
  2110. </select>
  2111. <select id="selectWarehouseItemListById" resultType="java.util.Map">
  2112. SELECT t.f_id fId,
  2113. t.f_pid fPid,
  2114. c.f_name corpName,
  2115. w.f_bsdate fBsdate,
  2116. g.f_name goodsName,
  2117. t.f_mblno fMblno,
  2118. t.f_warehouse_information fWarehouseInformation,
  2119. t.f_truckno fTruckno,
  2120. t.f_cntrno fCntrno,
  2121. t.f_cntrtype fCntrtype,
  2122. t.f_qty fQty,
  2123. t.f_grossweight fGrossweight,
  2124. t.f_cntqty fCntqty,
  2125. CASE
  2126. WHEN t.f_billstatus = '10' THEN
  2127. '计划'
  2128. WHEN t.f_billstatus = '20' THEN
  2129. IF(w.f_billtype = 'SJRK', '待入库', IF(w.f_billtype = 'SJCK', '待出库',
  2130. IF(w.f_billtype = 'CKDB', '待调拨',
  2131. IF(w.f_billtype = 'HWTG', '待通关',
  2132. IF(w.f_billtype = 'HQZY', '待转移', '无')))))
  2133. WHEN t.f_billstatus = '30' THEN
  2134. IF(w.f_billtype = 'SJRK', '入库中', IF(w.f_billtype = 'SJCK', '出库中',
  2135. IF(w.f_billtype = 'CKDB', '调拨中',
  2136. IF(w.f_billtype = 'HWTG', '通关中',
  2137. IF(w.f_billtype = 'HQZY', '转移中', '无')))))
  2138. WHEN t.f_billstatus = '40' THEN
  2139. IF(w.f_billtype = 'SJRK', '已入库', IF(w.f_billtype = 'SJCK', '已出库',
  2140. IF(w.f_billtype = 'CKDB', '已调拨',
  2141. IF(w.f_billtype = 'HWTG', '已通关',
  2142. IF(w.f_billtype = 'HQZY', '已转移', '无')))))
  2143. END fBillstatus
  2144. FROM t_warehousebills w
  2145. LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  2146. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2147. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  2148. where t.f_pid = #{fId}
  2149. </select>
  2150. <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel"
  2151. resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
  2152. SELECT
  2153. DISTINCT
  2154. c.f_name corpName,
  2155. #{fMblno} fMblno,
  2156. w.f_product_name goodsName,
  2157. d.dict_label fBusinessType,
  2158. w.f_cntval fCntval,
  2159. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_tocorpid = #{fCorpid} || item.f_billtype =
  2160. 'CKDB', date_format( item.f_bsdate, '%Y-%m-%d' ), NULL) inBsdate,
  2161. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_tocorpid = #{fCorpid} || item.f_billtype =
  2162. 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_qty, 0) inQty,
  2163. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid} || item.f_billtype = 'CKDB'
  2164. AND ware.f_id = item.f_transfer_warehouselocid, item.f_grossweight, 0.00) inGrossweight,
  2165. IF(item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, date_format( item.f_bsdate,
  2166. '%Y-%m-%d' ), NULL ) outBsdate,
  2167. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_qty, 0 ) outQty,
  2168. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_grossweight, 0.00 )
  2169. outGrossweight,
  2170. CASE
  2171. WHEN item.f_billtype = 'SJRK' THEN
  2172. '入库'
  2173. WHEN item.f_billtype = 'SJCK' THEN
  2174. '出库'
  2175. WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
  2176. '调拨'
  2177. WHEN item.f_billtype = 'HQZY' THEN
  2178. '货权转移'
  2179. WHEN item.f_billtype = 'HWTG' THEN
  2180. '货物通关'
  2181. END AS fBilltype,
  2182. 0 fQtyblc,
  2183. 0 fGrossweightblc,
  2184. item.remark
  2185. FROM
  2186. t_warehousebills w
  2187. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  2188. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2189. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id
  2190. = item.f_warehouselocid)
  2191. LEFT JOIN sys_dict_data d ON d.dict_value = item.f_business_type
  2192. WHERE
  2193. w.f_corpid = #{fCorpid}
  2194. AND item.f_mblno = #{fMblno}
  2195. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  2196. AND IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type =
  2197. 'st_out_type', d.dict_type = 'st_trans_type'))
  2198. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  2199. AND item.f_bsdate &gt;= #{bsdateList[0]}
  2200. </if>
  2201. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  2202. AND item.f_bsdate &lt;= #{bsdateList[1]}
  2203. </if>
  2204. order by item.f_bsdate asc
  2205. </select>
  2206. <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel"
  2207. resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
  2208. SELECT
  2209. DISTINCT
  2210. f.f_id,
  2211. date_format( f.create_time, '%Y-%m-%d' ) createTime,
  2212. d.dict_label fBusinessType,
  2213. fee.f_name fFeeid,
  2214. f.f_qty fQty,
  2215. f.f_unitprice fUnitprice,
  2216. f.f_amount fAmount,
  2217. f.remark
  2218. FROM
  2219. t_warehousebills w
  2220. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  2221. LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
  2222. LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
  2223. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id
  2224. = item.f_warehouselocid)
  2225. LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type
  2226. WHERE
  2227. item.f_mblno = #{fMblno}
  2228. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  2229. AND IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type =
  2230. 'st_out_type', d.dict_type = 'st_trans_type'))
  2231. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  2232. AND item.f_bsdate &gt;= #{bsdateList[0]}
  2233. </if>
  2234. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  2235. AND item.f_bsdate &lt;= #{bsdateList[1]}
  2236. </if>
  2237. order by f.create_time asc
  2238. </select>
  2239. <select id="selectAnPinById" parameterType="Long" resultMap="TWarehousebillsResult">
  2240. SELECT tw.f_id,
  2241. tw.f_billno,
  2242. tw.f_customsdeclartion,
  2243. tw.f_originalbillno,
  2244. tw.f_deptid,
  2245. tw.f_bsdeptid,
  2246. tw.f_contacts,
  2247. tw.f_tel,
  2248. tw.f_corpid,
  2249. tc.f_name AS corpName,
  2250. tw.f_tocorpid,
  2251. tw.f_stltypeid,
  2252. tw.f_bscorpno,
  2253. tw.f_warehouseid,
  2254. tw.f_storekeeper,
  2255. tw.f_chargedate,
  2256. tw.f_bsdate,
  2257. tw.f_planqty,
  2258. tw.f_plangrossweight,
  2259. tw.f_plannetweight,
  2260. tw.f_planvolumn,
  2261. tw.f_qty,
  2262. tw.f_grossweight,
  2263. tw.f_netweight,
  2264. tw.f_volumn,
  2265. tw.f_billingway,
  2266. tw.f_trademodeid,
  2267. tw.f_sbu,
  2268. tw.f_feetunit,
  2269. tw.f_mblno,
  2270. tw.f_marks,
  2271. tw.f_vslvoy,
  2272. tw.f_eta,
  2273. tw.f_customno,
  2274. tw.f_ifweigh,
  2275. tw.f_ifpledge,
  2276. tw.f_ifdamage,
  2277. tw.f_bankcorpid,
  2278. tw.f_billtype,
  2279. tw.f_billstatus,
  2280. tw.f_items_status,
  2281. tw.del_flag,
  2282. tw.create_by,
  2283. tw.create_time,
  2284. tw.update_by,
  2285. tw.update_time,
  2286. tw.remark,
  2287. tw.f_billing_deadline,
  2288. tw.f_product_name,
  2289. tw.f_review_date,
  2290. tw.f_truckno,
  2291. tw.f_driver_name,
  2292. tw.f_driver_tel,
  2293. tw.f_driver_id_car,
  2294. tw.f_business_type,
  2295. tw.f_labour,
  2296. tw.f_fleet,
  2297. tw.f_inwarehouseid,
  2298. tw.f_bstime,
  2299. tw.f_cartype,
  2300. tw.f_goodsid,
  2301. tp.f_name AS projectName,
  2302. tw.f_new_trademodeid,
  2303. tw.f_loadportid,
  2304. tw.f_destportid,
  2305. tw.f_serviceitems,
  2306. tw.f_invoceobj,
  2307. tw.f_sign,
  2308. tw.f_detentioncargo,
  2309. tw.f_booksmarks,
  2310. tw.f_shippername,
  2311. tw.f_shipperattn,
  2312. tw.f_shippertel,
  2313. tw.f_consigneername,
  2314. tw.f_consigneeattn,
  2315. tw.f_consigneetel,
  2316. tw.f_insurance,
  2317. tw.f_insuranceamt,
  2318. tw.f_closedate,
  2319. tw.f_docmentdate,
  2320. tw.f_vslid,
  2321. tw.f_voyid,
  2322. tw.f_typeid,
  2323. tw.f_paymode,
  2324. tw.f_laneid,
  2325. tw.f_cntval,
  2326. tw.f_date_changed,
  2327. tw.f_market_number,
  2328. tw.f_money,
  2329. tw.f_take_orders,
  2330. tw.f_reason
  2331. FROM t_warehousebills tw
  2332. LEFT JOIN t_project tp
  2333. ON tw.f_goodsid = tp.f_id
  2334. LEFT JOIN t_corps tc
  2335. ON tw.f_corpid = tc.f_id
  2336. where tw.f_id = #{fId}
  2337. ORDER BY f_bsdate desc
  2338. </select>
  2339. <select id="selectAnPinList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2340. SELECT
  2341. DISTINCT
  2342. tw.f_id,
  2343. tw.f_billno,
  2344. tw.f_customsdeclartion,
  2345. tw.f_originalbillno,
  2346. tw.f_deptid,
  2347. tw.f_bsdeptid,
  2348. tw.f_contacts,
  2349. tw.f_tel,
  2350. tw.f_corpid,
  2351. tc.f_name AS corpName,
  2352. tw.f_tocorpid,
  2353. tw.f_stltypeid,
  2354. tw.f_bscorpno,
  2355. tw.f_warehouseid,
  2356. tw.f_storekeeper,
  2357. tw.f_chargedate,
  2358. tw.f_bsdate,
  2359. tw.f_planqty,
  2360. tw.f_plangrossweight,
  2361. tw.f_plannetweight,
  2362. tw.f_planvolumn,
  2363. tw.f_qty,
  2364. tw.f_grossweight,
  2365. tw.f_netweight,
  2366. tw.f_volumn,
  2367. tw.f_billingway,
  2368. tw.f_trademodeid,
  2369. tw.f_sbu,
  2370. tw.f_feetunit,
  2371. tw.f_mblno,
  2372. tw.f_marks,
  2373. tw.f_vslvoy,
  2374. tw.f_eta,
  2375. tw.f_customno,
  2376. tw.f_ifweigh,
  2377. tw.f_ifpledge,
  2378. tw.f_ifdamage,
  2379. tw.f_bankcorpid,
  2380. tw.f_billtype,
  2381. tw.f_billstatus,
  2382. CASE
  2383. WHEN tw.f_billstatus = '1' THEN
  2384. '保存'
  2385. WHEN tw.f_billstatus = '2' THEN
  2386. '暂存'
  2387. WHEN tw.f_billstatus = '3' THEN
  2388. '审批驳回'
  2389. WHEN tw.f_billstatus = '4' THEN
  2390. '提交审核'
  2391. WHEN tw.f_billstatus = '5' THEN
  2392. '审核中'
  2393. WHEN tw.f_billstatus = '6' THEN
  2394. '审核完成'
  2395. END AS fBillstatusName,
  2396. tw.f_items_status,
  2397. tw.del_flag,
  2398. tw.create_by,
  2399. tw.create_time,
  2400. tw.update_by,
  2401. tw.update_time,
  2402. tw.remark,
  2403. tw.f_billing_deadline,
  2404. tw.f_product_name,
  2405. tw.f_review_date,
  2406. tw.f_truckno,
  2407. tw.f_driver_name,
  2408. tw.f_driver_tel,
  2409. tw.f_driver_id_car,
  2410. tw.f_business_type,
  2411. tw.f_labour,
  2412. tw.f_fleet,
  2413. tw.f_inwarehouseid,
  2414. tw.f_bstime,
  2415. tw.f_cartype,
  2416. tw.f_goodsid,
  2417. tp.f_name AS projectName,
  2418. tw.f_new_trademodeid,
  2419. tw.f_loadportid,
  2420. tw.f_destportid,
  2421. tw.f_serviceitems,
  2422. tw.f_invoceobj,
  2423. tw.f_sign,
  2424. tw.f_detentioncargo,
  2425. tw.f_booksmarks,
  2426. tw.f_shippername,
  2427. tw.f_shipperattn,
  2428. tw.f_shippertel,
  2429. tw.f_consigneername,
  2430. tw.f_consigneeattn,
  2431. tw.f_consigneetel,
  2432. tw.f_insurance,
  2433. tw.f_insuranceamt,
  2434. tw.f_closedate,
  2435. tw.f_docmentdate,
  2436. tw.f_vslid,
  2437. tw.f_voyid,
  2438. tw.f_typeid,
  2439. tw.f_paymode,
  2440. tw.f_laneid,
  2441. tw.f_cntval,
  2442. tw.f_date_changed,
  2443. tw.f_market_number,
  2444. tw.f_money,
  2445. tw.f_teachers_weight,
  2446. tw.f_students_weight,
  2447. th.f_name AS fWarehouseName,
  2448. tw.f_market_typid,
  2449. tw.f_purchase,
  2450. tr.f_name AS fsbuName,
  2451. tw.f_create_log,
  2452. tw.f_print_log,
  2453. tw.f_print,
  2454. tw.f_take_orders,
  2455. tw.f_reason,
  2456. CASE
  2457. WHEN f_take_orders = '0' THEN
  2458. '待接单'
  2459. WHEN f_take_orders = '1' THEN
  2460. '已接单'
  2461. WHEN f_take_orders = '2' THEN
  2462. '拒绝'
  2463. END AS fTakeOrdersName
  2464. FROM
  2465. t_warehousebills tw
  2466. LEFT JOIN t_project tp
  2467. ON tw.f_goodsid = tp.f_id
  2468. LEFT JOIN t_corps tc
  2469. ON tw.f_corpid = tc.f_id
  2470. LEFT JOIN t_corps tr
  2471. ON tr.f_id = tw.f_sbu
  2472. LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
  2473. LEFT JOIN t_warehousebillsfees tb ON tb.f_pid = tw.f_id
  2474. <where>
  2475. tw.del_flag = '0'
  2476. and tb.del_flag = '0'
  2477. <if test="fFeeid != null ">and tb.f_feeid = #{fFeeid}</if>
  2478. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2479. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2480. #{fCustomsdeclartion}
  2481. </if>
  2482. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2483. </if>
  2484. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2485. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2486. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2487. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2488. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2489. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2490. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2491. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2492. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2493. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2494. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2495. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2496. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2497. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2498. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2499. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2500. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2501. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2502. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2503. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2504. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2505. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2506. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2507. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2508. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2509. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2510. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2511. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2512. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2513. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2514. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2515. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2516. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2517. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2518. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  2519. <if test="fBillstatus != null and fBillstatus == 7">and tw.f_billstatus != '6'</if>
  2520. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2521. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2522. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2523. #{fProductName},
  2524. '%')
  2525. </if>
  2526. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2527. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2528. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2529. '%')
  2530. </if>
  2531. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2532. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2533. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2534. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2535. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2536. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2537. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2538. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2539. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2540. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2541. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2542. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2543. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2544. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2545. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2546. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2547. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2548. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2549. #{fShippername},
  2550. '%')
  2551. </if>
  2552. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2553. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2554. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2555. #{fConsigneername}, '%')
  2556. </if>
  2557. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2558. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2559. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2560. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2561. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2562. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2563. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2564. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2565. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2566. <if test="fPaymode != null ">and tw.f_paymode = #{fPaymode}</if>
  2567. <if test="fLaneid != null ">and tw.f_laneid = #{fLaneid}</if>
  2568. <if test="fCntval != null and fCntval != ''">and tw.f_cntval = #{fCntval}</if>
  2569. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  2570. <if test="remark != null and remark != ''">and tw.remark = #{remark}</if>
  2571. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2572. and tw.create_time &gt;= #{cLoadDate[0]}
  2573. </if>
  2574. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2575. and tw.create_time &lt;= #{cLoadDate[1]}
  2576. </if>
  2577. <if test='moneys != null and moneys[0] != null and moneys[0]!= ""'>
  2578. and tw.f_money &gt;= #{moneys[0]}
  2579. </if>
  2580. <if test='moneys != null and moneys[1] != null and moneys[1]!= ""'>
  2581. and tw.f_money &lt;= #{moneys[1]}
  2582. </if>
  2583. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2584. and tw.f_bsdate &gt;= #{timeInterval[0]}
  2585. </if>
  2586. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2587. and tw.f_bsdate &lt;= #{timeInterval[1]}
  2588. </if>
  2589. <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
  2590. <if test="fReason != null and fReason != ''"> and tw.f_reason = #{fReason}</if>
  2591. </where>
  2592. ORDER BY tw.f_bsdate DESC,tw.f_id DESC
  2593. </select>
  2594. <update id="anPinDeleteUpdate">
  2595. update
  2596. t_warehousebills
  2597. <trim prefix="SET" suffixOverrides=",">
  2598. <if test="delFlag != null">del_flag = #{delFlag},</if>
  2599. <if test="updateBy != null">update_by = #{updateBy},</if>
  2600. <if test="updateTime != null">update_time = #{updateTime},</if>
  2601. </trim>
  2602. where f_id in
  2603. <foreach item="fId" collection="fIds" open="(" separator="," close=")">
  2604. #{fId}
  2605. </foreach>
  2606. </update>
  2607. <update id="updateTProjectAudit" parameterType="String">
  2608. update t_project
  2609. set f_billstatus = #{fBillstatus}
  2610. <if test="fBillstatus != null and fBillstatus == 6">,f_audit_time = #{fAuditTime}</if>
  2611. <if test="fBillstatus != null and fBillstatus != 6">,f_audit_time = null</if>
  2612. where f_id = #{fId}
  2613. </update>
  2614. <update id="updateCostMessage">
  2615. update t_cost_management
  2616. set f_status = #{status},f_billstatus = #{fBillstatus},f_review_date = #{fAuditTime}
  2617. where f_id = #{fId}
  2618. </update>
  2619. <update id="updateTProjectItemsAudit" parameterType="String">
  2620. update t_project_items
  2621. set f_billstatus = #{fBillstatus}
  2622. <if test="fBillstatus != null and fBillstatus == 6">,f_audit_time = #{fAuditTime}</if>
  2623. <if test="fBillstatus != null and fBillstatus != 6">,f_audit_time = null</if>
  2624. where f_pid = #{fPid}
  2625. </update>
  2626. <select id="cannibalizeList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2627. SELECT
  2628. DISTINCT
  2629. tw.f_id,
  2630. tw.f_billno,
  2631. tw.f_customsdeclartion,
  2632. tw.f_originalbillno,
  2633. tw.f_deptid,
  2634. tw.f_bsdeptid,
  2635. tw.f_contacts,
  2636. tw.f_tel,
  2637. tw.f_corpid,
  2638. tc.f_name AS corpName,
  2639. tw.f_tocorpid,
  2640. tw.f_stltypeid,
  2641. tw.f_bscorpno,
  2642. tw.f_warehouseid,
  2643. tw.f_storekeeper,
  2644. tw.f_chargedate,
  2645. tw.f_bsdate,
  2646. tw.f_planqty,
  2647. tw.f_plangrossweight,
  2648. tw.f_plannetweight,
  2649. tw.f_planvolumn,
  2650. tw.f_qty,
  2651. tw.f_grossweight,
  2652. tw.f_netweight,
  2653. tw.f_volumn,
  2654. tw.f_billingway,
  2655. tw.f_trademodeid,
  2656. tw.f_sbu,
  2657. tw.f_feetunit,
  2658. tw.f_mblno,
  2659. tw.f_marks,
  2660. tw.f_vslvoy,
  2661. tw.f_eta,
  2662. tw.f_customno,
  2663. tw.f_ifweigh,
  2664. tw.f_ifpledge,
  2665. tw.f_ifdamage,
  2666. tw.f_bankcorpid,
  2667. tw.f_billtype,
  2668. tw.f_billstatus,
  2669. CASE
  2670. WHEN tw.f_billstatus = '1' THEN
  2671. '保存'
  2672. WHEN tw.f_billstatus = '2' THEN
  2673. '暂存'
  2674. WHEN tw.f_billstatus = '3' THEN
  2675. '审批驳回'
  2676. WHEN tw.f_billstatus = '4' THEN
  2677. '提交审核'
  2678. WHEN tw.f_billstatus = '5' THEN
  2679. '审核中'
  2680. WHEN tw.f_billstatus = '6' THEN
  2681. '审核完成'
  2682. END AS fBillstatusName,
  2683. tw.f_items_status,
  2684. tw.del_flag,
  2685. tw.create_by,
  2686. tw.create_time,
  2687. tw.update_by,
  2688. tw.update_time,
  2689. tw.remark,
  2690. tw.f_billing_deadline,
  2691. tw.f_product_name,
  2692. tw.f_review_date,
  2693. tw.f_truckno,
  2694. tw.f_driver_name,
  2695. tw.f_driver_tel,
  2696. tw.f_driver_id_car,
  2697. tw.f_business_type,
  2698. tw.f_labour,
  2699. tw.f_fleet,
  2700. tw.f_inwarehouseid,
  2701. tw.f_bstime,
  2702. tw.f_cartype,
  2703. tw.f_goodsid,
  2704. tp.f_name AS projectName,
  2705. tw.f_new_trademodeid,
  2706. tw.f_loadportid,
  2707. tw.f_destportid,
  2708. tw.f_serviceitems,
  2709. tw.f_invoceobj,
  2710. tw.f_sign,
  2711. tw.f_detentioncargo,
  2712. tw.f_booksmarks,
  2713. tw.f_shippername,
  2714. tw.f_shipperattn,
  2715. tw.f_shippertel,
  2716. tw.f_consigneername,
  2717. tw.f_consigneeattn,
  2718. tw.f_consigneetel,
  2719. tw.f_insurance,
  2720. tw.f_insuranceamt,
  2721. tw.f_closedate,
  2722. tw.f_docmentdate,
  2723. tw.f_vslid,
  2724. tw.f_voyid,
  2725. tw.f_typeid,
  2726. tw.f_paymode,
  2727. tw.f_laneid,
  2728. tw.f_cntval,
  2729. tw.f_date_changed,
  2730. tw.f_market_number,
  2731. tw.f_money,
  2732. tw.f_teachers_weight,
  2733. tw.f_students_weight,
  2734. th.f_name AS fWarehouseName,
  2735. tw.f_market_typid,
  2736. tw.f_purchase,
  2737. tr.f_name AS fsbuName,
  2738. tw.f_create_log,
  2739. tw.f_print_log,
  2740. tw.f_print,
  2741. tw.f_take_orders,
  2742. tw.f_reason,
  2743. CASE
  2744. WHEN f_take_orders = '0' THEN
  2745. '待接单'
  2746. WHEN f_take_orders = '1' THEN
  2747. '已接单'
  2748. WHEN f_take_orders = '2' THEN
  2749. '拒绝'
  2750. END AS fTakeOrdersName,
  2751. tw.f_allot_warehouseid,
  2752. tw.f_project,
  2753. tj.f_name AS fProjectName,
  2754. ts.f_name AS fAllotWarehouseName
  2755. FROM
  2756. t_warehousebills tw
  2757. LEFT JOIN t_project tp
  2758. ON tw.f_goodsid = tp.f_id
  2759. LEFT JOIN t_corps tc
  2760. ON tw.f_corpid = tc.f_id
  2761. LEFT JOIN t_corps tr
  2762. ON tr.f_id = tw.f_sbu
  2763. LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
  2764. LEFT JOIN t_warehousebillsfees tb ON tb.f_pid = tw.f_id
  2765. LEFT JOIN t_project tj ON tw.f_project = tj.f_id
  2766. LEFT JOIN t_warehouse ts ON tw.f_allot_warehouseid = ts.f_id
  2767. <where>
  2768. tw.del_flag = '0'
  2769. and tb.del_flag = '0'
  2770. <if test="fFeeid != null ">and tb.f_feeid = #{fFeeid}</if>
  2771. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2772. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2773. #{fCustomsdeclartion}
  2774. </if>
  2775. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2776. </if>
  2777. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2778. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2779. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2780. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2781. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2782. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2783. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2784. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2785. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2786. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2787. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2788. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2789. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2790. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2791. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2792. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2793. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2794. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2795. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2796. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2797. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2798. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2799. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2800. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2801. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2802. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2803. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2804. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2805. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2806. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2807. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2808. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2809. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2810. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2811. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  2812. <if test="fBillstatus != null and fBillstatus == 7">and tw.f_billstatus != '6'</if>
  2813. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2814. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2815. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2816. #{fProductName},
  2817. '%')
  2818. </if>
  2819. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2820. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2821. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2822. '%')
  2823. </if>
  2824. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2825. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2826. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2827. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2828. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2829. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2830. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2831. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2832. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2833. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2834. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2835. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2836. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2837. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2838. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2839. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2840. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2841. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2842. #{fShippername},
  2843. '%')
  2844. </if>
  2845. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2846. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2847. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2848. #{fConsigneername}, '%')
  2849. </if>
  2850. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2851. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2852. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2853. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2854. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2855. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2856. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2857. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2858. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2859. <if test="fPaymode != null ">and tw.f_paymode = #{fPaymode}</if>
  2860. <if test="fLaneid != null ">and tw.f_laneid = #{fLaneid}</if>
  2861. <if test="fCntval != null and fCntval != ''">and tw.f_cntval = #{fCntval}</if>
  2862. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  2863. <if test="remark != null and remark != ''">and tw.remark = #{remark}</if>
  2864. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2865. and tw.create_time &gt;= #{cLoadDate[0]}
  2866. </if>
  2867. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2868. and tw.create_time &lt;= #{cLoadDate[1]}
  2869. </if>
  2870. <if test='moneys != null and moneys[0] != null and moneys[0]!= ""'>
  2871. and tw.f_money &gt;= #{moneys[0]}
  2872. </if>
  2873. <if test='moneys != null and moneys[1] != null and moneys[1]!= ""'>
  2874. and tw.f_money &lt;= #{moneys[1]}
  2875. </if>
  2876. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2877. and tw.f_bsdate &gt;= #{timeInterval[0]}
  2878. </if>
  2879. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2880. and tw.f_bsdate &lt;= #{timeInterval[1]}
  2881. </if>
  2882. <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
  2883. <if test="fReason != null and fReason != ''"> and tw.f_reason = #{fReason}</if>
  2884. <if test="fAllotWarehouseid != null "> and tw.f_allot_warehouseid = #{fAllotWarehouseid}</if>
  2885. <if test="fProject != null "> and tw.f_project = #{fProject}</if>
  2886. </where>
  2887. ORDER BY tw.f_bsdate DESC,tw.f_id DESC
  2888. </select>
  2889. <select id="warehouseIn" parameterType="TWarehousebills" resultType="com.ruoyi.anpin.WarehouseIn">
  2890. SELECT
  2891. DISTINCT
  2892. tw.f_billno AS fBillno,
  2893. th.f_name AS fWarehouseName,
  2894. tc.f_name AS corpName,
  2895. tw.f_money AS fMoney,
  2896. tw.create_time AS createTime,
  2897. tw.f_bsdate AS fBsdate,
  2898. tw.create_by AS createBy,
  2899. CASE
  2900. WHEN tw.f_billstatus = '1' THEN
  2901. '保存'
  2902. WHEN tw.f_billstatus = '2' THEN
  2903. '暂存'
  2904. WHEN tw.f_billstatus = '3' THEN
  2905. '审批驳回'
  2906. WHEN tw.f_billstatus = '4' THEN
  2907. '提交审核'
  2908. WHEN tw.f_billstatus = '5' THEN
  2909. '审核中'
  2910. WHEN tw.f_billstatus = '6' THEN
  2911. '审核完成'
  2912. END AS fBillstatusName,
  2913. tw.f_review_date AS fReviewDate,
  2914. tp.f_name AS projectName,
  2915. tw.remark AS remark,
  2916. tw.f_create_log AS fCreateLog
  2917. FROM
  2918. t_warehousebills tw
  2919. LEFT JOIN t_project tp
  2920. ON tw.f_goodsid = tp.f_id
  2921. LEFT JOIN t_corps tc
  2922. ON tw.f_corpid = tc.f_id
  2923. LEFT JOIN t_corps tr
  2924. ON tr.f_id = tw.f_sbu
  2925. LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
  2926. LEFT JOIN t_warehousebillsfees tb ON tb.f_pid = tw.f_id
  2927. <where>
  2928. tw.del_flag = '0'
  2929. and tb.del_flag = '0'
  2930. and tw.f_billtype = 'RK'
  2931. <if test="fFeeid != null ">and tb.f_feeid = #{fFeeid}</if>
  2932. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2933. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2934. #{fCustomsdeclartion}
  2935. </if>
  2936. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2937. </if>
  2938. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2939. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2940. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2941. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2942. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2943. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2944. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2945. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2946. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2947. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2948. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2949. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2950. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2951. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2952. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2953. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2954. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2955. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2956. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2957. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2958. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2959. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2960. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2961. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2962. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2963. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2964. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2965. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2966. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2967. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2968. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2969. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2970. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2971. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2972. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  2973. <if test="fBillstatus != null and fBillstatus == 7">and tw.f_billstatus != '6'</if>
  2974. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2975. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2976. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2977. #{fProductName},
  2978. '%')
  2979. </if>
  2980. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2981. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2982. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2983. '%')
  2984. </if>
  2985. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2986. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2987. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2988. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2989. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2990. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2991. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2992. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2993. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2994. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2995. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2996. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2997. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2998. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2999. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  3000. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  3001. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  3002. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  3003. #{fShippername},
  3004. '%')
  3005. </if>
  3006. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  3007. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  3008. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  3009. #{fConsigneername}, '%')
  3010. </if>
  3011. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  3012. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  3013. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  3014. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  3015. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  3016. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  3017. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  3018. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  3019. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  3020. <if test="fPaymode != null ">and tw.f_paymode = #{fPaymode}</if>
  3021. <if test="fLaneid != null ">and tw.f_laneid = #{fLaneid}</if>
  3022. <if test="fCntval != null and fCntval != ''">and tw.f_cntval = #{fCntval}</if>
  3023. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  3024. <if test="remark != null and remark != ''">and tw.remark = #{remark}</if>
  3025. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  3026. and tw.create_time &gt;= #{cLoadDate[0]}
  3027. </if>
  3028. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  3029. and tw.create_time &lt;= #{cLoadDate[1]}
  3030. </if>
  3031. <if test='moneys != null and moneys[0] != null and moneys[0]!= ""'>
  3032. and tw.f_money &gt;= #{moneys[0]}
  3033. </if>
  3034. <if test='moneys != null and moneys[1] != null and moneys[1]!= ""'>
  3035. and tw.f_money &lt;= #{moneys[1]}
  3036. </if>
  3037. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3038. and tw.f_bsdate &gt;= #{timeInterval[0]}
  3039. </if>
  3040. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3041. and tw.f_bsdate &lt;= #{timeInterval[1]}
  3042. </if>
  3043. <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
  3044. <if test="fReason != null and fReason != ''"> and tw.f_reason = #{fReason}</if>
  3045. </where>
  3046. ORDER BY tw.f_bsdate DESC,tw.f_id DESC
  3047. </select>
  3048. <select id="marketOut" parameterType="TWarehousebills" resultType="com.ruoyi.anpin.MarketOut">
  3049. SELECT
  3050. DISTINCT
  3051. tw.f_billno AS fBillno,
  3052. tp.f_name AS projectName,
  3053. tc.f_name AS corpName,
  3054. tw.f_money AS fMoney,
  3055. th.f_name AS thfName,
  3056. tw.create_by AS createBy,
  3057. tw.create_time AS createTime,
  3058. CASE
  3059. WHEN tw.f_billstatus = '1' THEN
  3060. '保存'
  3061. WHEN tw.f_billstatus = '2' THEN
  3062. '暂存'
  3063. WHEN tw.f_billstatus = '3' THEN
  3064. '审批驳回'
  3065. WHEN tw.f_billstatus = '4' THEN
  3066. '提交审核'
  3067. WHEN tw.f_billstatus = '5' THEN
  3068. '审核中'
  3069. WHEN tw.f_billstatus = '6' THEN
  3070. '审核完成'
  3071. END AS fBillstatusName,
  3072. tw.f_review_date AS fReviewDate,
  3073. tw.f_bsdate AS fBsdate,
  3074. tw.remark AS remark,
  3075. tr.f_name AS fsbuName,
  3076. tw.f_print_log AS fPrintLog
  3077. FROM
  3078. t_warehousebills tw
  3079. LEFT JOIN t_project tp
  3080. ON tw.f_goodsid = tp.f_id
  3081. LEFT JOIN t_corps tc
  3082. ON tw.f_corpid = tc.f_id
  3083. LEFT JOIN t_corps tr
  3084. ON tr.f_id = tw.f_sbu
  3085. LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
  3086. LEFT JOIN t_warehousebillsfees tb ON tb.f_pid = tw.f_id
  3087. <where>
  3088. tw.del_flag = '0'
  3089. and tb.del_flag = '0'
  3090. and tw.f_billtype = 'XS'
  3091. <if test="fFeeid != null ">and tb.f_feeid = #{fFeeid}</if>
  3092. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  3093. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  3094. #{fCustomsdeclartion}
  3095. </if>
  3096. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  3097. </if>
  3098. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  3099. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  3100. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  3101. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  3102. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  3103. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  3104. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  3105. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  3106. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  3107. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  3108. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  3109. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  3110. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  3111. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  3112. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  3113. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  3114. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  3115. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  3116. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  3117. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  3118. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  3119. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  3120. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  3121. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  3122. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  3123. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  3124. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  3125. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  3126. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  3127. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  3128. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  3129. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  3130. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  3131. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  3132. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  3133. <if test="fBillstatus != null and fBillstatus == 7">and tw.f_billstatus != '6'</if>
  3134. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  3135. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  3136. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  3137. #{fProductName},
  3138. '%')
  3139. </if>
  3140. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  3141. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  3142. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  3143. '%')
  3144. </if>
  3145. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  3146. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  3147. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  3148. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  3149. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  3150. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  3151. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  3152. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  3153. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  3154. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  3155. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  3156. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  3157. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  3158. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  3159. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  3160. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  3161. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  3162. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  3163. #{fShippername},
  3164. '%')
  3165. </if>
  3166. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  3167. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  3168. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  3169. #{fConsigneername}, '%')
  3170. </if>
  3171. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  3172. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  3173. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  3174. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  3175. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  3176. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  3177. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  3178. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  3179. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  3180. <if test="fPaymode != null ">and tw.f_paymode = #{fPaymode}</if>
  3181. <if test="fLaneid != null ">and tw.f_laneid = #{fLaneid}</if>
  3182. <if test="fCntval != null and fCntval != ''">and tw.f_cntval = #{fCntval}</if>
  3183. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  3184. <if test="remark != null and remark != ''">and tw.remark = #{remark}</if>
  3185. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  3186. and tw.create_time &gt;= #{cLoadDate[0]}
  3187. </if>
  3188. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  3189. and tw.create_time &lt;= #{cLoadDate[1]}
  3190. </if>
  3191. <if test='moneys != null and moneys[0] != null and moneys[0]!= ""'>
  3192. and tw.f_money &gt;= #{moneys[0]}
  3193. </if>
  3194. <if test='moneys != null and moneys[1] != null and moneys[1]!= ""'>
  3195. and tw.f_money &lt;= #{moneys[1]}
  3196. </if>
  3197. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3198. and tw.f_bsdate &gt;= #{timeInterval[0]}
  3199. </if>
  3200. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3201. and tw.f_bsdate &lt;= #{timeInterval[1]}
  3202. </if>
  3203. <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
  3204. <if test="fReason != null and fReason != ''"> and tw.f_reason = #{fReason}</if>
  3205. </where>
  3206. ORDER BY tw.f_bsdate DESC,tw.f_id DESC
  3207. </select>
  3208. <select id="statistics" resultType="map">
  3209. SELECT
  3210. temp.billType,
  3211. CASE
  3212. WHEN temp.billType = 'CK' THEN
  3213. '出库'
  3214. WHEN temp.billType = 'RK' THEN
  3215. '入库'
  3216. WHEN temp.billType = 'SQ' THEN
  3217. '采购'
  3218. WHEN temp.billType = 'XS' THEN
  3219. '销售'
  3220. END AS billTypeName,
  3221. IFNULL( temp.num, 0 ) AS allNum,
  3222. IFNULL( temp.money, 0 ) AS allMoney,
  3223. IFNULL( success.num, 0 ) AS entryNum,
  3224. IFNULL( success.money, 0 ) AS entryMoney,
  3225. IFNULL( fail.num, 0 ) AS notNum,
  3226. IFNULL( fail.money, 0 ) AS notMoney
  3227. FROM
  3228. (
  3229. SELECT
  3230. f_billstatus AS billStatus,
  3231. f_billtype AS billType,
  3232. COUNT( 1 ) AS num,
  3233. IFNULL( SUM( f_money ), 0 ) AS money
  3234. FROM
  3235. t_warehousebills
  3236. WHERE
  3237. del_flag = 0
  3238. AND f_billtype IN ('CK','RK')
  3239. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3240. and f_bsdate &gt;= #{timeInterval[0]}
  3241. </if>
  3242. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3243. and f_bsdate &lt;= #{timeInterval[1]}
  3244. </if>
  3245. GROUP BY
  3246. f_billtype
  3247. ) temp
  3248. LEFT JOIN (
  3249. SELECT
  3250. f_billstatus AS billStatus,
  3251. f_billtype AS billType,
  3252. COUNT( 1 ) AS num,
  3253. IFNULL( SUM( f_money ), 0 ) AS money
  3254. FROM
  3255. t_warehousebills
  3256. WHERE
  3257. del_flag = 0
  3258. AND f_billtype IN ('CK','RK')
  3259. AND f_billstatus = 6
  3260. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3261. and f_bsdate &gt;= #{timeInterval[0]}
  3262. </if>
  3263. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3264. and f_bsdate &lt;= #{timeInterval[1]}
  3265. </if>
  3266. GROUP BY
  3267. f_billtype
  3268. ) success ON temp.billType = success.billType
  3269. LEFT JOIN (
  3270. SELECT
  3271. f_billstatus AS billStatus,
  3272. f_billtype AS billType,
  3273. COUNT( 1 ) AS num,
  3274. IFNULL( SUM( f_money ), 0 ) AS money
  3275. FROM
  3276. t_warehousebills
  3277. WHERE
  3278. del_flag = 0
  3279. AND f_billtype IN ('CK','RK')
  3280. AND f_billstatus != 6
  3281. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3282. and f_bsdate &gt;= #{timeInterval[0]}
  3283. </if>
  3284. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3285. and f_bsdate &lt;= #{timeInterval[1]}
  3286. </if>
  3287. GROUP BY
  3288. f_billtype
  3289. ) fail ON temp.billType = fail.billType
  3290. union
  3291. SELECT
  3292. temp.billType,
  3293. CASE
  3294. WHEN temp.billType = 'CK' THEN
  3295. '出库'
  3296. WHEN temp.billType = 'RK' THEN
  3297. '入库'
  3298. WHEN temp.billType = 'SQ' THEN
  3299. '采购'
  3300. WHEN temp.billType = 'XS' THEN
  3301. '销售'
  3302. END AS billTypeName,
  3303. IFNULL( temp.num, 0 ) AS allNum,
  3304. IFNULL( temp.money, 0 ) AS allMoney,
  3305. IFNULL( success.num, 0 ) AS entryNum,
  3306. IFNULL( success.money, 0 ) AS entryMoney,
  3307. IFNULL( fail.num, 0 ) AS notNum,
  3308. IFNULL( fail.money, 0 ) AS notMoney
  3309. FROM
  3310. (
  3311. SELECT
  3312. f_billstatus AS billStatus,
  3313. f_billtype AS billType,
  3314. COUNT( 1 ) AS num,
  3315. IFNULL( SUM( f_money ), 0 ) AS money
  3316. FROM
  3317. t_warehousebills
  3318. WHERE
  3319. del_flag = 0
  3320. AND f_billtype IN ('SQ','XS')
  3321. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3322. and f_bsdate &gt;= #{timeInterval[0]}
  3323. </if>
  3324. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3325. and f_bsdate &lt;= #{timeInterval[1]}
  3326. </if>
  3327. GROUP BY
  3328. f_billtype
  3329. ) temp
  3330. LEFT JOIN (
  3331. SELECT
  3332. f_billstatus AS billStatus,
  3333. f_billtype AS billType,
  3334. COUNT( 1 ) AS num,
  3335. IFNULL( SUM( f_money ), 0 ) AS money
  3336. FROM
  3337. t_warehousebills
  3338. WHERE
  3339. del_flag = 0
  3340. AND f_billtype IN ('SQ','XS')
  3341. AND f_print != 0
  3342. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3343. and f_bsdate &gt;= #{timeInterval[0]}
  3344. </if>
  3345. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3346. and f_bsdate &lt;= #{timeInterval[1]}
  3347. </if>
  3348. GROUP BY
  3349. f_billtype
  3350. ) success ON temp.billType = success.billType
  3351. LEFT JOIN (
  3352. SELECT
  3353. f_billstatus AS billStatus,
  3354. f_billtype AS billType,
  3355. COUNT( 1 ) AS num,
  3356. IFNULL( SUM( f_money ), 0 ) AS money
  3357. FROM
  3358. t_warehousebills
  3359. WHERE
  3360. del_flag = 0
  3361. AND f_billtype IN ('SQ','XS')
  3362. AND f_print = 0
  3363. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3364. and f_bsdate &gt;= #{timeInterval[0]}
  3365. </if>
  3366. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3367. and f_bsdate &lt;= #{timeInterval[1]}
  3368. </if>
  3369. GROUP BY
  3370. f_billtype
  3371. ) fail ON temp.billType = fail.billType
  3372. </select>
  3373. <select id="statisticsNew" resultType="map">
  3374. SELECT
  3375. temp.billType,
  3376. CASE
  3377. WHEN temp.billType = 'CK' THEN
  3378. '出库'
  3379. WHEN temp.billType = 'RK' THEN
  3380. '入库'
  3381. WHEN temp.billType = 'SQ' THEN
  3382. '采购'
  3383. WHEN temp.billType = 'XS' THEN
  3384. '销售'
  3385. END AS billTypeName,
  3386. IFNULL( temp.num, 0 ) AS allNum,
  3387. IFNULL( temp.money, 0 ) AS allMoney,
  3388. IFNULL( success.num, 0 ) AS entryNum,
  3389. IFNULL( success.money, 0 ) AS entryMoney,
  3390. IFNULL( fail.num, 0 ) AS notNum,
  3391. IFNULL( fail.money, 0 ) AS notMoney
  3392. FROM
  3393. (
  3394. SELECT
  3395. f_billstatus AS billStatus,
  3396. f_billtype AS billType,
  3397. COUNT( 1 ) AS num,
  3398. IFNULL( SUM( f_money ), 0 ) AS money
  3399. FROM
  3400. t_warehousebills
  3401. WHERE
  3402. del_flag = 0
  3403. AND f_billtype IN ('CK','RK')
  3404. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3405. and f_bsdate &gt;= #{timeInterval[0]}
  3406. </if>
  3407. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3408. and f_bsdate &lt;= #{timeInterval[1]}
  3409. </if>
  3410. GROUP BY
  3411. f_billtype
  3412. ) temp
  3413. LEFT JOIN (
  3414. SELECT
  3415. f_billstatus AS billStatus,
  3416. f_billtype AS billType,
  3417. COUNT( 1 ) AS num,
  3418. IFNULL( SUM( f_money ), 0 ) AS money
  3419. FROM
  3420. t_warehousebills
  3421. WHERE
  3422. del_flag = 0
  3423. AND f_billtype IN ('CK','RK')
  3424. AND f_billstatus = 6
  3425. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3426. and f_bsdate &gt;= #{timeInterval[0]}
  3427. </if>
  3428. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3429. and f_bsdate &lt;= #{timeInterval[1]}
  3430. </if>
  3431. GROUP BY
  3432. f_billtype
  3433. ) success ON temp.billType = success.billType
  3434. LEFT JOIN (
  3435. SELECT
  3436. f_billstatus AS billStatus,
  3437. f_billtype AS billType,
  3438. COUNT( 1 ) AS num,
  3439. IFNULL( SUM( f_money ), 0 ) AS money
  3440. FROM
  3441. t_warehousebills
  3442. WHERE
  3443. del_flag = 0
  3444. AND f_billtype IN ('CK','RK')
  3445. AND f_billstatus != 6
  3446. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3447. and f_bsdate &gt;= #{timeInterval[0]}
  3448. </if>
  3449. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3450. and f_bsdate &lt;= #{timeInterval[1]}
  3451. </if>
  3452. GROUP BY
  3453. f_billtype
  3454. ) fail ON temp.billType = fail.billType
  3455. </select>
  3456. </mapper>