TWarehousebillsMapper.xml 149 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672
  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="fTrademodeid" column="f_trademodeid" />
  32. <result property="fBillingway" column="f_billingway" />
  33. <result property="fSbu" column="f_sbu" />
  34. <result property="fFeetunit" column="f_feetunit" />
  35. <result property="fMblno" column="f_mblno" />
  36. <result property="fVslvoy" column="f_vslvoy" />
  37. <result property="fEta" column="f_eta" />
  38. <result property="fMarks" column="f_marks" />
  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="delFlag" column="del_flag" />
  47. <result property="createBy" column="create_by" />
  48. <result property="createTime" column="create_time" />
  49. <result property="fItemsStatus" column="f_items_status" />
  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="freeContainerDate" column="free_container_date" />
  92. <result property="fBusinessAttribution" column="f_business_attribution" />
  93. <result property="fSupervisionUnit" column="f_supervision_unit" />
  94. <result property="fDeclarationElements" column="f_declaration_elements" />
  95. <result property="fPartNumber" column="f_part_number" />
  96. <result property="fIfinspection" column="f_ifinspection" />
  97. <result property="fValue" column="f_value" />
  98. <result property="fWeighingDate" column="f_weighing_date" />
  99. <result property="fIfsampling" column="f_ifsampling" />
  100. <result property="sendSampleDate" column="send_sample_date" />
  101. <result property="fIfweightRecovery" column="f_ifweight_recovery" />
  102. <result property="weightRecoveryDate" column="weight_recovery_date" />
  103. <result property="warehouseStatus" column="warehouse_status" />
  104. <result property="fTimes" column="f_times" />
  105. <result property="fDateChanged" column="f_date_changed"/>
  106. <result property="fChargetype" column="f_chargetype"/>
  107. <result property="fWeighWeight" column="f_weigh_weight" />
  108. <result property="fPredictBranch" column="f_predict_branch" />
  109. <result property="fGrade" column="f_grade" />
  110. <result property="fDeliveryDetails" column="f_delivery_details" />
  111. <result property="fSalesmanId" column="f_salesman_id" />
  112. <result property="fItemstatus" column="f_itemstatus" />
  113. <result property="fUpdeteStatus" column="f_updete_status"/>
  114. <result property="fSubmitUpdate" column="f_submit_update"/>
  115. <result property="fDeleteStatus" column="f_delete_status"/>
  116. <result property="fRemarksFees" column="f_remarks_fees" />
  117. <result property="fCargoPlanning" column="f_cargo_planning" />
  118. <result property="fArrivalStatus" column="f_arrival_status" />
  119. <result property="fDismountStatus" column="f_dismount_status" />
  120. </resultMap>
  121. <sql id="selectTWarehousebillsVo">
  122. select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno,
  123. f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
  124. f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_marks, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
  125. f_billtype, f_billstatus, f_items_status, del_flag, create_by, create_time, update_by, update_time, remark, f_billing_deadline, f_product_name, f_review_date,
  126. f_truckno, f_driver_name, f_driver_tel, f_driver_id_car, f_business_type, f_labour, f_fleet, f_inwarehouseid, f_bstime, f_cartype, f_goodsid, f_new_trademodeid,
  127. f_loadportid, f_destportid, f_serviceitems, f_invoceobj, f_sign, f_detentioncargo, f_booksmarks, f_shippername, f_shipperattn, f_shippertel, f_consigneername,
  128. f_consigneeattn, f_consigneetel, f_insurance, f_insuranceamt, f_closedate, f_docmentdate, f_vslid, f_voyid, f_typeid, f_paymode, f_laneid, f_cntval,
  129. free_container_date, f_business_attribution, f_supervision_unit, f_declaration_elements, f_part_number, f_ifinspection, f_value, f_weighing_date,
  130. f_ifsampling, send_sample_date, f_ifweight_recovery, weight_recovery_date, warehouse_status, f_times ,f_date_changed, f_chargetype,f_weigh_weight,
  131. f_predict_branch,f_grade,f_delivery_details,f_salesman_id,f_itemstatus,f_updete_status, f_submit_update, f_delete_status,f_remarks_fees,f_cargo_planning,f_arrival_status,f_dismount_status from t_warehousebills
  132. </sql>
  133. <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  134. select
  135. ware.*
  136. from
  137. t_warehousebills ware
  138. left join sys_user u on ware.create_by = u.user_name
  139. left join sys_dept d on ware.f_bsdeptid = d.dept_id
  140. <where>
  141. ware.f_typeid IS NULL
  142. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  143. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and f_customsdeclartion =
  144. #{fCustomsdeclartion}
  145. </if>
  146. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  147. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  148. <if test="fBsdeptid != null ">and f_bsdeptid = #{fBsdeptid}</if>
  149. <if test="fInwarehouseid != null ">and f_inwarehouseid = #{fInwarehouseid}</if>
  150. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  151. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  152. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  153. <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
  154. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  155. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  156. and f_bsdate &gt;= #{timeInterval[0]}
  157. </if>
  158. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  159. and f_bsdate &lt;= #{timeInterval[1]}
  160. </if>
  161. <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
  162. <if test="fBscorpno != null and fBscorpno != ''">and f_bscorpno = #{fBscorpno}</if>
  163. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  164. <if test="fStorekeeper != null and fStorekeeper != ''">and f_storekeeper = #{fStorekeeper}</if>
  165. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  166. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  167. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  168. '%')
  169. </if>
  170. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  171. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  172. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  173. <if test="fQty != null ">and f_qty = #{fQty}</if>
  174. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  175. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  176. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  177. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  178. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  179. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  180. <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
  181. <if test="fFeetunit != null and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
  182. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  183. <if test="fVslvoy != null and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
  184. <if test="fEta != null ">and f_eta = #{fEta}</if>
  185. <if test="fCustomno != null and fCustomno != ''">and f_customno = #{fCustomno}</if>
  186. <if test="fIfweigh != null and fIfweigh != ''">and f_ifweigh = #{fIfweigh}</if>
  187. <if test="fIfpledge != null and fIfpledge != ''">and f_ifpledge = #{fIfpledge}</if>
  188. <if test="fIfdamage != null and fIfdamage != ''">and f_ifdamage = #{fIfdamage}</if>
  189. <if test="fBankcorpid != null ">and f_bankcorpid = #{fBankcorpid}</if>
  190. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  191. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  192. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  193. <if test="fNewTrademodeid != null ">and f_new_trademodeid = #{fNewTrademodeid}</if>
  194. </where>
  195. ${params.dataScope}
  196. </select>
  197. <select id="selectWarehouseBusinessList" parameterType="TWarehousebills" resultType="Map">
  198. SELECT
  199. DISTINCT
  200. bill.f_id AS fId,
  201. corp.f_name AS fCorpid,
  202. corpTo.f_name AS fTocorpid,
  203. bill.f_mblno AS fMblno,
  204. corpSub.f_name AS fSbu,
  205. bill.f_marks AS fMarks,
  206. bill.remark AS remark,
  207. bill.f_planqty AS fPlanqty,
  208. bill.f_plangrossweight AS fPlangrossweight,
  209. bill.f_plannetweight AS fPlannetweight,
  210. bill.f_planvolumn AS fPlanvolumn,
  211. bill.f_bsdate AS fBsdate,
  212. bill.f_trademodeid AS fTrademodeid,
  213. bill.f_truckno AS fTruckno,
  214. bill.f_driver_name AS fDriverName,
  215. bill.f_driver_tel AS fDriverTel,
  216. bill.f_driver_id_car AS fDriverIdCar,
  217. dictIn.dict_label AS fBusinessType,
  218. ware.f_name AS fWarehouseid,
  219. bill.f_qty AS fQty,
  220. bill.f_cntval AS fCntval,
  221. bill.f_netweight AS fNetweight,
  222. bill.create_time AS createTime,
  223. ware1.f_name AS fInwarehouseid,
  224. bill.f_chargetype AS fChargetype,
  225. bill.create_by AS createBy,
  226. bill.f_grossweight AS fGrossweight,
  227. bill.f_product_name AS fProductName,
  228. bill.f_billing_deadline AS fBillingDeadline,
  229. bill.free_container_date AS freeContainerDate,
  230. CASE WHEN bill.f_billstatus = '1' THEN '录入'
  231. WHEN bill.f_billstatus = '2' THEN '暂存'
  232. WHEN bill.f_billstatus = '3' THEN '驳回'
  233. WHEN bill.f_billstatus = '4' THEN '请核'
  234. WHEN bill.f_billstatus = '5' THEN '审核中'
  235. WHEN bill.f_billstatus = '6' THEN '全部入账'
  236. END
  237. AS fBillstatus,
  238. CASE
  239. WHEN bill.f_billtype = 'SJRK'
  240. AND bill.f_items_status = '1' THEN
  241. '计划'
  242. WHEN bill.f_billtype = 'SJRK'
  243. AND bill.f_items_status = '2' THEN
  244. '待入库'
  245. WHEN bill.f_billtype = 'SJRK'
  246. AND bill.f_items_status = '3' THEN
  247. '入库中'
  248. WHEN bill.f_billtype = 'SJRK'
  249. AND bill.f_items_status = '4' THEN
  250. '已入库'
  251. WHEN bill.f_billtype = 'SJCK'
  252. AND bill.f_items_status = '1' THEN
  253. '计划'
  254. WHEN bill.f_billtype = 'SJCK'
  255. AND bill.f_items_status = '2' THEN
  256. '待出库'
  257. WHEN bill.f_billtype = 'SJCK'
  258. AND bill.f_items_status = '3' THEN
  259. '出库中'
  260. WHEN bill.f_billtype = 'SJCK'
  261. AND bill.f_items_status = '4' THEN
  262. '已出库'
  263. WHEN bill.f_billtype = 'CKDB'
  264. AND bill.f_items_status = '1' THEN
  265. '计划'
  266. WHEN bill.f_billtype = 'CKDB'
  267. AND bill.f_items_status = '2' THEN
  268. '待调拨'
  269. WHEN bill.f_billtype = 'CKDB'
  270. AND bill.f_items_status = '3' THEN
  271. '调拨中'
  272. WHEN bill.f_billtype = 'CKDB'
  273. AND bill.f_items_status = '4' THEN
  274. '已调拨'
  275. WHEN bill.f_billtype = 'HWTG'
  276. AND bill.f_items_status = '1' THEN
  277. '计划'
  278. WHEN bill.f_billtype = 'HWTG'
  279. AND bill.f_items_status = '2' THEN
  280. '待调拨'
  281. WHEN bill.f_billtype = 'HWTG'
  282. AND bill.f_items_status = '3' THEN
  283. '调拨中'
  284. WHEN bill.f_billtype = 'HWTG'
  285. AND bill.f_items_status = '4' THEN
  286. '已调拨'
  287. END AS fItemsStatus,
  288. bill.f_billno AS fBillno,
  289. g.f_name AS fGoodsid,
  290. bill.f_storekeeper AS fStorekeeper,
  291. bill.f_remarks_fees AS fRemarksFees
  292. FROM
  293. t_warehousebills bill
  294. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  295. left join sys_user u on bill.create_by = u.user_name
  296. left join sys_user u1 on bill.f_storekeeper = u1.user_name
  297. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  298. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  299. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  300. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  301. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  302. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  303. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  304. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  305. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type
  306. <where>
  307. bill.f_typeid IS NULL
  308. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  309. <if test="fTruckno != null and fTruckno != ''">and item.f_truckno like concat('%', #{fTruckno}, '%')</if>
  310. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  311. #{fCustomsdeclartion}
  312. </if>
  313. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  314. #{fOriginalbillno}
  315. </if>
  316. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  317. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  318. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  319. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  320. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  321. and bill.f_bsdate &gt;= #{timeInterval[0]}
  322. </if>
  323. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  324. and bill.f_bsdate &lt;= #{timeInterval[1]}
  325. </if>
  326. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  327. and bill.free_container_date &gt;= #{freeContainerList[0]}
  328. </if>
  329. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  330. and bill.free_container_date &lt;= #{freeContainerList[1]}
  331. </if>
  332. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  333. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  334. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  335. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  336. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  337. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  338. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  339. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  340. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  341. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  342. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  343. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  344. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  345. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  346. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  347. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  348. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  349. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  350. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  351. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  352. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  353. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  354. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  355. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  356. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  357. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  358. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  359. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  360. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  361. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  362. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  363. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  364. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  365. <if test="fBilltype != null">and bill.f_billtype = #{fBilltype}</if>
  366. <if test="fBilltype != null and fBilltype == 'SJRK'">
  367. AND dictIn.dict_type = 'st_in_type'
  368. AND dictIn.status = '0'
  369. </if>
  370. <if test="fBilltype != null and fBilltype == 'SJCK'">
  371. AND dictIn.dict_type = 'st_out_type'
  372. AND dictIn.status = '0'
  373. </if>
  374. <if test="fBilltype != null and fBilltype == 'CKDB'">
  375. AND dictIn.dict_type = 'st_trans_type'
  376. AND dictIn.status = '0'
  377. </if>
  378. <if test="fBilltype != null and fBilltype == 'HWTG'">
  379. AND dictIn.dict_type = 'st_trans_type'
  380. AND dictIn.status = '0'
  381. </if>
  382. <if test="fBilltype != null and fBilltype == 'CDZZ'"><!-- 场地直装 仿出库 -->
  383. AND dictIn.dict_type = 'st_out_type'
  384. AND dictIn.status = '0'
  385. </if>
  386. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  387. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  388. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  389. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  390. </where>
  391. ${params.dataScope}
  392. ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
  393. </select>
  394. <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
  395. SELECT
  396. DISTINCT
  397. bill.f_id AS fId,
  398. corp.f_name AS fCorpid,
  399. corpTo.f_name AS fTocorpid,
  400. bill.f_mblno AS fMblno,
  401. corpSub.f_name AS fSbu,
  402. bill.f_marks AS fMarks,
  403. bill.remark AS remark,
  404. bill.f_planqty AS fPlanqty,
  405. bill.f_plangrossweight AS fPlangrossweight,
  406. bill.f_plannetweight AS fPlannetweight,
  407. bill.f_planvolumn AS fPlanvolumn,
  408. bill.f_bsdate AS fBsdate,
  409. dict.dict_label AS fTrademodeid,
  410. bill.f_truckno AS fTruckno,
  411. bill.f_driver_name AS fDriverName,
  412. bill.f_driver_tel AS fDriverTel,
  413. bill.f_driver_id_car AS fDriverIdCar,
  414. ware.f_name AS fWarehouseid,
  415. bill.f_qty AS fQty,
  416. bill.f_cntval AS fCntval,
  417. bill.f_chargetype AS fChargetype,
  418. bill.f_netweight AS fNetweight,
  419. bill.create_time AS createTime,
  420. ware1.f_name AS fInwarehouseid,
  421. bill.create_by AS createBy,
  422. bill.f_grossweight AS fGrossweight,
  423. bill.f_product_name AS fProductName,
  424. bill.f_billing_deadline AS fBillingDeadline,
  425. bill.free_container_date AS freeContainerDate,
  426. CASE
  427. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
  428. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
  429. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
  430. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
  431. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
  432. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
  433. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
  434. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
  435. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
  436. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
  437. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
  438. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
  439. END
  440. AS fBillstatus,
  441. CASE
  442. WHEN bill.f_billtype = 'HQZY'
  443. AND bill.f_items_status = '1' THEN
  444. '计划'
  445. WHEN bill.f_billtype = 'HQZY'
  446. AND bill.f_items_status = '2' THEN
  447. '待货转'
  448. WHEN bill.f_billtype = 'HQZY'
  449. AND bill.f_items_status = '3' THEN
  450. '货转中'
  451. WHEN bill.f_billtype = 'HQZY'
  452. AND bill.f_items_status = '4' THEN
  453. '已货转'
  454. END
  455. AS fItemsStatus,
  456. bill.f_billno AS fBillno,
  457. g.f_name AS fGoodsid,
  458. bill.f_storekeeper AS fStorekeeper,
  459. bill.f_remarks_fees AS fRemarksFees
  460. FROM
  461. t_warehousebills bill
  462. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  463. left join sys_user u on bill.create_by = u.user_name
  464. left join sys_user u1 on bill.f_storekeeper = u1.user_name
  465. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  466. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  467. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  468. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  469. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  470. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  471. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  472. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  473. LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
  474. <where>
  475. dict.status = '0'
  476. AND dict.dict_type = 'data_trademodes'
  477. AND bill.f_typeid IS NULL
  478. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  479. <if test="fTruckno != null and fTruckno != ''">and item.f_truckno like concat('%', #{fTruckno}, '%')</if>
  480. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  481. #{fCustomsdeclartion}
  482. </if>
  483. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  484. #{fOriginalbillno}
  485. </if>
  486. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  487. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  488. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  489. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  490. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  491. and bill.f_bsdate &gt;= #{timeInterval[0]}
  492. </if>
  493. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  494. and bill.f_bsdate &lt;= #{timeInterval[1]}
  495. </if>
  496. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  497. and bill.free_container_date &gt;= #{freeContainerList[0]}
  498. </if>
  499. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  500. and bill.free_container_date &lt;= #{freeContainerList[1]}
  501. </if>
  502. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  503. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  504. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  505. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  506. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  507. <if test='timeInterval2 != null and timeInterval2[0] != null and timeInterval2[0]!= ""'><!-- 仓储费增加计费截止日期区间查询 -->
  508. and bill.f_billing_deadline &gt;= #{timeInterval2[0]}
  509. </if>
  510. <if test='timeInterval2 != null and timeInterval2[1] != null and timeInterval2[1]!= ""'>
  511. and bill.f_billing_deadline &lt;= #{timeInterval2[1]}
  512. </if>
  513. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  514. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  515. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  516. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  517. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  518. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  519. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  520. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  521. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  522. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  523. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  524. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  525. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  526. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  527. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  528. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  529. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  530. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  531. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  532. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  533. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  534. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  535. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  536. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  537. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  538. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  539. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  540. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  541. <if test="fBilltype != null and fBilltype != ''">
  542. and bill.f_billtype = #{fBilltype}
  543. </if>
  544. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  545. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  546. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  547. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  548. </where>
  549. ${params.dataScope}
  550. ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
  551. </select>
  552. <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
  553. <include refid="selectTWarehousebillsVo"/>
  554. where f_id = #{fId}
  555. ORDER BY f_bsdate desc
  556. </select>
  557. <select id="selectTWarehousebillsItemsList"
  558. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems">
  559. SELECT (@ii := @ii + 1) AS fId,
  560. CASE
  561. wi.f_billtype
  562. WHEN 'SJRK' THEN
  563. '入库'
  564. WHEN 'SJCK' THEN
  565. '出库'
  566. WHEN 'KCZZ' THEN
  567. '库存总账'
  568. END AS fBilltype,
  569. wi.f_mblno AS fMblno,
  570. wi.f_product_name AS fGoodsid,
  571. wi.f_marks AS fMarks,
  572. wi.f_bsdate AS fBsdate,
  573. dict.dict_label AS fFeeUnitid,
  574. wi.f_billing_qty AS fBillingQty,
  575. wi.f_chargedate AS fChargedate,
  576. wi.f_billing_deadline AS fBillingDeadline,
  577. wi.f_billing_days AS fBillingDays,
  578. wi.f_inventory_days AS fInventoryDays,
  579. wi.f_amt AS fAmt,
  580. wi.remark AS remark
  581. FROM t_warehousebills w
  582. LEFT JOIN t_warehousebillsfees wi ON w.f_id = wi.f_pid
  583. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  584. , (
  585. SELECT @ii := 0
  586. ) AS ii
  587. WHERE w.f_id = #{fId}
  588. AND w.f_typeid IS NULL
  589. AND dict.status = '0'
  590. AND dict.dict_type = 'data_unitfees'
  591. </select>
  592. <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
  593. SELECT
  594. co.f_name AS fName,
  595. it.f_bsdate AS fBsdate,
  596. leg.f_mblno AS fMblno,
  597. it.f_business_type AS fBusinessType,
  598. dict.dict_label AS fBusinessTypes,
  599. it.f_marks AS fMarks ,
  600. goo.f_name AS fGoodsName,
  601. it.f_warehouse_information AS fWarehouseLocationids,
  602. dicttr.dict_label AS fTrademodeid,
  603. it.f_qty AS fQty,
  604. it.f_grossweight AS fGrossweight,
  605. it.f_netweight AS fNetweight,
  606. CASE
  607. it.f_billtype
  608. WHEN 'SJRK' THEN
  609. '入库'
  610. WHEN 'SJCK' THEN
  611. '出库'
  612. WHEN 'CKDB' THEN
  613. '调拨'
  614. END AS fBilltype
  615. FROM
  616. t_warehousebills leg
  617. left join sys_user u on leg.create_by = u.user_name
  618. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  619. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  620. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  621. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  622. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  623. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  624. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  625. <where>
  626. dict.status = '0'
  627. AND leg.f_typeid IS NULL
  628. AND dict.dict_type = 'storage_type'
  629. AND dicttr.STATUS = '0'
  630. AND dicttr.dict_type = 'data_trademodes'
  631. AND leg.f_billtype in ('SJRK','CKDB')
  632. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  633. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  634. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  635. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  636. <if test="fMblno != null ">and leg.f_mblno like concat('%',#{fMblno},'%')</if>
  637. <if test="fLocation != null and fLocation ==1 ">
  638. and it.f_warehouselocid = #{fWarehouseid}
  639. </if>
  640. <if test="fLocation != null and fLocation ==0 ">
  641. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  642. </if>
  643. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  644. and it.f_bsdate &gt;= #{timeInterval[0]}
  645. </if>
  646. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  647. and it.f_bsdate &lt;= #{timeInterval[1]}
  648. </if>
  649. </where>
  650. ${params.dataScope}
  651. </select>
  652. <select id="selectInventorySJCKList" parameterType="TWarehousebills" resultType="java.util.Map">
  653. SELECT
  654. co.f_name AS fName,
  655. it.f_bsdate AS fBsdate,
  656. leg.f_mblno AS fMblno,
  657. it.f_business_type AS fBusinessType,
  658. dict.dict_label AS fBusinessTypes,
  659. it.f_marks AS fMarks ,
  660. goo.f_name AS fGoodsName,
  661. dicttr.dict_label AS fTrademodeid,
  662. it.f_qty AS fQty,
  663. it.f_grossweight AS fGrossweight,
  664. it.f_netweight AS fNetweight,
  665. CASE
  666. it.f_billtype
  667. WHEN 'SJRK' THEN
  668. '入库'
  669. WHEN 'SJCK' THEN
  670. '出库'
  671. WHEN 'CKDB' THEN
  672. '调拨'
  673. END AS fBilltype ,
  674. CASE
  675. it.f_billtype
  676. WHEN 'SJRK' THEN
  677. it.f_warehouse_information
  678. WHEN 'SJCK' THEN
  679. it.f_warehouse_information
  680. WHEN 'CKDB' THEN
  681. it.f_orgwarehouse_information
  682. END AS fWarehouseLocationids
  683. FROM
  684. t_warehousebills leg
  685. left join sys_user u on leg.create_by = u.user_name
  686. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  687. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  688. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  689. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  690. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  691. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  692. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  693. <where>
  694. dict.status = '0'
  695. AND leg.f_typeid IS NULL
  696. AND dict.dict_type = 'storage_type'
  697. AND dicttr.STATUS = '0'
  698. AND dicttr.dict_type = 'data_trademodes'
  699. AND leg.f_billtype in ('SJCK','CKDB')
  700. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  701. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  702. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  703. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  704. <if test="fMblno != null ">and leg.f_mblno like concat('%',#{fMblno},'%')</if>
  705. <if test="fLocation != null and fLocation ==1 ">
  706. and it.f_warehouselocid = #{fWarehouseid}
  707. </if>
  708. <if test="fLocation != null and fLocation ==0 ">
  709. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  710. </if>
  711. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  712. and it.f_bsdate &gt;= #{timeInterval[0]}
  713. </if>
  714. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  715. and it.f_bsdate &lt;= #{timeInterval[1]}
  716. </if>
  717. </where>
  718. ${params.dataScope}
  719. </select>
  720. <select id="selectTWarehousebillsItemList"
  721. resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
  722. SELECT
  723. ( @ii := @ii + 1 ) AS fId,
  724. co.f_name AS fCorpid,
  725. it.f_bsdate AS fBsdate,
  726. leg.f_mblno AS fMblno,
  727. dict.dict_label AS fBusinessType,
  728. it.f_marks AS fMarks,
  729. go.f_name AS fGoodsid,
  730. it.f_warehouse_information AS fWarehouseInformation,
  731. dicttr.dict_label AS fTrademodeid,
  732. it.f_qty AS fQty,
  733. it.f_grossweight AS fGrossweight,
  734. it.f_netweight AS fNetweight
  735. FROM
  736. t_warehousebills leg
  737. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  738. LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
  739. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  740. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  741. LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
  742. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
  743. SELECT
  744. @ii := 0
  745. ) AS ii
  746. WHERE
  747. dict.STATUS = '0'
  748. AND leg.f_typeid IS NULL
  749. AND dict.dict_type = 'storage_type'
  750. AND dicttr.STATUS = '0'
  751. AND dicttr.dict_type = 'data_trademodes'
  752. AND leg.f_billtype IN (
  753. 'SJRk',
  754. 'SJCK'
  755. )
  756. <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
  757. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  758. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  759. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  760. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  761. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  762. <if test="fLocation != null and fLocation ==1 ">
  763. and it.f_warehouselocid = #{fWarehouseid}
  764. </if>
  765. <if test="fLocation != null and fLocation ==0 ">
  766. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  767. </if>
  768. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  769. and it.f_bsdate &gt;= #{timeInterval[0]}
  770. </if>
  771. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  772. and it.f_bsdate &lt;= #{timeInterval[1]}
  773. </if>
  774. </select>
  775. <select id="selectContainMblno" parameterType="TWarehousebills" resultType="int">
  776. SELECT
  777. count( f_id )
  778. FROM
  779. t_warehousebills
  780. where
  781. f_mblno = #{fMblno}
  782. AND f_bsdate = #{fBsdate}
  783. AND f_billtype = #{fBilltype}
  784. </select>
  785. <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
  786. insert into t_warehousebills
  787. <trim prefix="(" suffix=")" suffixOverrides=",">
  788. <if test="fBillno != null">f_billno,</if>
  789. <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
  790. <if test="fOriginalbillno != null">f_originalbillno,</if>
  791. <if test="fDeptid != null">f_deptid,</if>
  792. <if test="fBsdeptid != null">f_bsdeptid,</if>
  793. <if test="fContacts != null">f_contacts,</if>
  794. <if test="fTel != null">f_tel,</if>
  795. <if test="fCorpid != null">f_corpid,</if>
  796. <if test="fTocorpid != null">f_tocorpid,</if>
  797. <if test="fStltypeid != null">f_stltypeid,</if>
  798. <if test="fBscorpno != null">f_bscorpno,</if>
  799. <if test="fWarehouseid != null">f_warehouseid,</if>
  800. <if test="fStorekeeper != null">f_storekeeper,</if>
  801. <if test="fChargedate != null">f_chargedate,</if>
  802. <if test="fBsdate != null">f_bsdate,</if>
  803. <if test="fPlanqty != null">f_planqty,</if>
  804. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  805. <if test="fPlannetweight != null">f_plannetweight,</if>
  806. <if test="fPlanvolumn != null">f_planvolumn,</if>
  807. <if test="fQty != null">f_qty,</if>
  808. <if test="fGrossweight != null">f_grossweight,</if>
  809. <if test="fNetweight != null">f_netweight,</if>
  810. <if test="fVolumn != null">f_volumn,</if>
  811. <if test="fTrademodeid != null">f_trademodeid,</if>
  812. <if test="fBillingway != null">f_billingway,</if>
  813. <if test="fSbu != null">f_sbu,</if>
  814. <if test="fFeetunit != null">f_feetunit,</if>
  815. <if test="fMblno != null">f_mblno,</if>
  816. <if test="fVslvoy != null">f_vslvoy,</if>
  817. <if test="fEta != null">f_eta,</if>
  818. <if test="fMarks != null">f_marks,</if>
  819. <if test="fCustomno != null">f_customno,</if>
  820. <if test="fIfweigh != null">f_ifweigh,</if>
  821. <if test="fIfpledge != null">f_ifpledge,</if>
  822. <if test="fIfdamage != null">f_ifdamage,</if>
  823. <if test="fBankcorpid != null">f_bankcorpid,</if>
  824. <if test="fBilltype != null">f_billtype,</if>
  825. <if test="fBillstatus != null">f_billstatus,</if>
  826. <if test="delFlag != null">del_flag,</if>
  827. <if test="createBy != null">create_by,</if>
  828. <if test="createTime != null">create_time,</if>
  829. <if test="fItemsStatus != null">f_items_status,</if>
  830. <if test="updateBy != null">update_by,</if>
  831. <if test="updateTime != null">update_time,</if>
  832. <if test="remark != null">remark,</if>
  833. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  834. <if test="fProductName != null">f_product_name,</if>
  835. <if test="fReviewDate != null">f_review_date,</if>
  836. <if test="fTruckno != null">f_truckno,</if>
  837. <if test="fDriverName != null">f_driver_name,</if>
  838. <if test="fDriverTel != null">f_driver_tel,</if>
  839. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  840. <if test="fBusinessType != null">f_business_type,</if>
  841. <if test="fLabour != null">f_labour,</if>
  842. <if test="fFleet != null">f_fleet,</if>
  843. <if test="fInwarehouseid != null">f_inwarehouseid,</if>
  844. <if test="fBstime != null">f_bstime,</if>
  845. <if test="fCartype != null">f_cartype,</if>
  846. <if test="fGoodsid != null">f_goodsid,</if>
  847. <if test="fNewTrademodeid != null">f_new_trademodeid,</if>
  848. <if test="fLoadportid != null">f_loadportid,</if>
  849. <if test="fDestportid != null">f_destportid,</if>
  850. <if test="fServiceitems != null">f_serviceitems,</if>
  851. <if test="fInvoceobj != null">f_invoceobj,</if>
  852. <if test="fSign != null">f_sign,</if>
  853. <if test="fDetentioncargo != null">f_detentioncargo,</if>
  854. <if test="fBooksmarks != null">f_booksmarks,</if>
  855. <if test="fShippername != null">f_shippername,</if>
  856. <if test="fShipperattn != null">f_shipperattn,</if>
  857. <if test="fShippertel != null">f_shippertel,</if>
  858. <if test="fConsigneername != null">f_consigneername,</if>
  859. <if test="fConsigneeattn != null">f_consigneeattn,</if>
  860. <if test="fConsigneetel != null">f_consigneetel,</if>
  861. <if test="fInsurance != null">f_insurance,</if>
  862. <if test="fInsuranceamt != null">f_insuranceamt,</if>
  863. <if test="fClosedate != null">f_closedate,</if>
  864. <if test="fDocmentdate != null">f_docmentdate,</if>
  865. <if test="fVslid != null">f_vslid,</if>
  866. <if test="fVoyid != null">f_voyid,</if>
  867. <if test="fTypeid != null">f_typeid,</if>
  868. <if test="fPaymode != null">f_paymode,</if>
  869. <if test="fLaneid != null">f_laneid,</if>
  870. <if test="fCntval != null">f_cntval,</if>
  871. <if test="freeContainerDate != null">free_container_date,</if>
  872. <if test="fBusinessAttribution != null">f_business_attribution,</if>
  873. <if test="fSupervisionUnit != null">f_supervision_unit,</if>
  874. <if test="fDeclarationElements != null">f_declaration_elements,</if>
  875. <if test="fPartNumber != null">f_part_number,</if>
  876. <if test="fIfinspection != null">f_ifinspection,</if>
  877. <if test="fValue != null">f_value,</if>
  878. <if test="fWeighingDate != null">f_weighing_date,</if>
  879. <if test="fIfsampling != null">f_ifsampling,</if>
  880. <if test="sendSampleDate != null">send_sample_date,</if>
  881. <if test="fIfweightRecovery != null">f_ifweight_recovery,</if>
  882. <if test="weightRecoveryDate != null">weight_recovery_date,</if>
  883. <if test="warehouseStatus != null">warehouse_status,</if>
  884. <if test="fTimes != null">f_times,</if>
  885. <if test="fDateChanged != null">f_date_changed,</if>
  886. <if test="fChargetype != null">f_chargetype,</if>
  887. <if test="fWeighWeight != null">f_weigh_weight,</if>
  888. <if test="fPredictBranch != null">f_predict_branch,</if>
  889. <if test="fGrade != null">f_grade,</if>
  890. <if test="fDeliveryDetails != null">f_delivery_details,</if>
  891. <if test="fSalesmanId != null">f_salesman_id,</if>
  892. <if test="fItemstatus != null">f_itemstatus,</if>
  893. <if test="fUpdeteStatus != null">f_updete_status,</if>
  894. <if test="fSubmitUpdate != null">f_submit_update,</if>
  895. <if test="fDeleteStatus != null">f_delete_status,</if>
  896. <if test="fRemarksFees != null">f_remarks_fees,</if>
  897. <if test="fCargoPlanning != null">f_cargo_planning,</if>
  898. <if test="fArrivalStatus != null">f_arrival_status,</if>
  899. <if test="fDismountStatus != null">f_dismount_status,</if>
  900. </trim>
  901. <trim prefix="values (" suffix=")" suffixOverrides=",">
  902. <if test="fBillno != null">#{fBillno},</if>
  903. <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
  904. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  905. <if test="fDeptid != null">#{fDeptid},</if>
  906. <if test="fBsdeptid != null">#{fBsdeptid},</if>
  907. <if test="fContacts != null">#{fContacts},</if>
  908. <if test="fTel != null">#{fTel},</if>
  909. <if test="fCorpid != null">#{fCorpid},</if>
  910. <if test="fTocorpid != null">#{fTocorpid},</if>
  911. <if test="fStltypeid != null">#{fStltypeid},</if>
  912. <if test="fBscorpno != null">#{fBscorpno},</if>
  913. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  914. <if test="fStorekeeper != null">#{fStorekeeper},</if>
  915. <if test="fChargedate != null">#{fChargedate},</if>
  916. <if test="fBsdate != null">#{fBsdate},</if>
  917. <if test="fPlanqty != null">#{fPlanqty},</if>
  918. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  919. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  920. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  921. <if test="fQty != null">#{fQty},</if>
  922. <if test="fGrossweight != null">#{fGrossweight},</if>
  923. <if test="fNetweight != null">#{fNetweight},</if>
  924. <if test="fVolumn != null">#{fVolumn},</if>
  925. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  926. <if test="fBillingway != null">#{fBillingway},</if>
  927. <if test="fSbu != null">#{fSbu},</if>
  928. <if test="fFeetunit != null">#{fFeetunit},</if>
  929. <if test="fMblno != null">#{fMblno},</if>
  930. <if test="fVslvoy != null">#{fVslvoy},</if>
  931. <if test="fEta != null">#{fEta},</if>
  932. <if test="fMarks != null">#{fMarks},</if>
  933. <if test="fCustomno != null">#{fCustomno},</if>
  934. <if test="fIfweigh != null">#{fIfweigh},</if>
  935. <if test="fIfpledge != null">#{fIfpledge},</if>
  936. <if test="fIfdamage != null">#{fIfdamage},</if>
  937. <if test="fBankcorpid != null">#{fBankcorpid},</if>
  938. <if test="fBilltype != null">#{fBilltype},</if>
  939. <if test="fBillstatus != null">#{fBillstatus},</if>
  940. <if test="delFlag != null">#{delFlag},</if>
  941. <if test="createBy != null">#{createBy},</if>
  942. <if test="createTime != null">#{createTime},</if>
  943. <if test="fItemsStatus != null">#{fItemsStatus},</if>
  944. <if test="updateBy != null">#{updateBy},</if>
  945. <if test="updateTime != null">#{updateTime},</if>
  946. <if test="remark != null">#{remark},</if>
  947. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  948. <if test="fProductName != null">#{fProductName},</if>
  949. <if test="fReviewDate != null">#{fReviewDate},</if>
  950. <if test="fTruckno != null">#{fTruckno},</if>
  951. <if test="fDriverName != null">#{fDriverName},</if>
  952. <if test="fDriverTel != null">#{fDriverTel},</if>
  953. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  954. <if test="fBusinessType != null">#{fBusinessType},</if>
  955. <if test="fLabour != null">#{fLabour},</if>
  956. <if test="fFleet != null">#{fFleet},</if>
  957. <if test="fInwarehouseid != null">#{fInwarehouseid},</if>
  958. <if test="fBstime != null">#{fBstime},</if>
  959. <if test="fCartype != null">#{fCartype},</if>
  960. <if test="fGoodsid != null">#{fGoodsid},</if>
  961. <if test="fNewTrademodeid != null">#{fNewTrademodeid},</if>
  962. <if test="fLoadportid != null">#{fLoadportid},</if>
  963. <if test="fDestportid != null">#{fDestportid},</if>
  964. <if test="fServiceitems != null">#{fServiceitems},</if>
  965. <if test="fInvoceobj != null">#{fInvoceobj},</if>
  966. <if test="fSign != null">#{fSign},</if>
  967. <if test="fDetentioncargo != null">#{fDetentioncargo},</if>
  968. <if test="fBooksmarks != null">#{fBooksmarks},</if>
  969. <if test="fShippername != null">#{fShippername},</if>
  970. <if test="fShipperattn != null">#{fShipperattn},</if>
  971. <if test="fShippertel != null">#{fShippertel},</if>
  972. <if test="fConsigneername != null">#{fConsigneername},</if>
  973. <if test="fConsigneeattn != null">#{fConsigneeattn},</if>
  974. <if test="fConsigneetel != null">#{fConsigneetel},</if>
  975. <if test="fInsurance != null">#{fInsurance},</if>
  976. <if test="fInsuranceamt != null">#{fInsuranceamt},</if>
  977. <if test="fClosedate != null">#{fClosedate},</if>
  978. <if test="fDocmentdate != null">#{fDocmentdate},</if>
  979. <if test="fVslid != null">#{fVslid},</if>
  980. <if test="fVoyid != null">#{fVoyid},</if>
  981. <if test="fTypeid != null">#{fTypeid},</if>
  982. <if test="fPaymode != null">#{fPaymode},</if>
  983. <if test="fLaneid != null">#{fLaneid},</if>
  984. <if test="fCntval != null">#{fCntval},</if>
  985. <if test="freeContainerDate != null">#{freeContainerDate},</if>
  986. <if test="fBusinessAttribution != null">#{fBusinessAttribution},</if>
  987. <if test="fSupervisionUnit != null">#{fSupervisionUnit},</if>
  988. <if test="fDeclarationElements != null">#{fDeclarationElements},</if>
  989. <if test="fPartNumber != null">#{fPartNumber},</if>
  990. <if test="fIfinspection != null">#{fIfinspection},</if>
  991. <if test="fValue != null">#{fValue},</if>
  992. <if test="fWeighingDate != null">#{fWeighingDate},</if>
  993. <if test="fIfsampling != null">#{fIfsampling},</if>
  994. <if test="sendSampleDate != null">#{sendSampleDate},</if>
  995. <if test="fIfweightRecovery != null">#{fIfweightRecovery},</if>
  996. <if test="weightRecoveryDate != null">#{weightRecoveryDate},</if>
  997. <if test="warehouseStatus != null">#{warehouseStatus},</if>
  998. <if test="fTimes != null">#{fTimes},</if>
  999. <if test="fDateChanged != null">#{fDateChanged},</if>
  1000. <if test="fChargetype != null">#{fChargetype},</if>
  1001. <if test="fWeighWeight != null">#{fWeighWeight},</if>
  1002. <if test="fPredictBranch != null">#{fPredictBranch},</if>
  1003. <if test="fGrade != null">#{fGrade},</if>
  1004. <if test="fDeliveryDetails != null">#{fDeliveryDetails},</if>
  1005. <if test="fSalesmanId != null">#{fSalesmanId},</if>
  1006. <if test="fItemstatus != null">#{fItemstatus},</if>
  1007. <if test="fUpdeteStatus != null">#{fUpdeteStatus},</if>
  1008. <if test="fSubmitUpdate != null">#{fSubmitUpdate},</if>
  1009. <if test="fDeleteStatus != null">#{fDeleteStatus},</if>
  1010. <if test="fRemarksFees != null">#{fRemarksFees},</if>
  1011. <if test="fCargoPlanning != null">#{fCargoPlanning},</if>
  1012. <if test="fArrivalStatus != null">#{fArrivalStatus},</if>
  1013. <if test="fDismountStatus != null">#{fDismountStatus},</if>
  1014. </trim>
  1015. </insert>
  1016. <update id="updateTWarehousebills" parameterType="TWarehousebills">
  1017. update t_warehousebills
  1018. <trim prefix="SET" suffixOverrides=",">
  1019. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1020. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1021. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1022. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1023. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1024. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1025. <if test="fTel != null">f_tel = #{fTel},</if>
  1026. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1027. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1028. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1029. <if test="fBscorpno != null">f_bscorpno = #{fBscorpno},</if>
  1030. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1031. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1032. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1033. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1034. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1035. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1036. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1037. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1038. <if test="fQty != null">f_qty = #{fQty},</if>
  1039. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1040. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1041. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1042. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1043. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1044. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1045. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1046. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1047. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1048. <if test="fEta != null">f_eta = #{fEta},</if>
  1049. <if test="fMarks != null">f_marks = #{fMarks},</if>
  1050. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1051. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1052. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1053. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1054. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1055. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1056. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1057. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1058. <if test="createBy != null">create_by = #{createBy},</if>
  1059. <if test="createTime != null">create_time = #{createTime},</if>
  1060. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1061. <if test="updateBy != null">update_by = #{updateBy},</if>
  1062. <if test="updateTime != null">update_time = #{updateTime},</if>
  1063. <if test="remark != null">remark = #{remark},</if>
  1064. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1065. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1066. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  1067. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1068. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1069. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1070. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1071. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1072. <if test="fLabour != null">f_labour = #{fLabour},</if>
  1073. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1074. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1075. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1076. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1077. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1078. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1079. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1080. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1081. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1082. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1083. <if test="fSign != null">f_sign = #{fSign},</if>
  1084. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1085. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1086. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1087. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1088. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1089. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1090. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1091. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1092. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1093. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1094. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1095. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1096. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1097. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1098. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1099. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1100. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1101. <if test="fCntval != null">f_cntval = #{fCntval},</if>
  1102. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  1103. <if test="fBusinessAttribution != null">f_business_attribution = #{fBusinessAttribution},</if>
  1104. <if test="fSupervisionUnit != null">f_supervision_unit = #{fSupervisionUnit},</if>
  1105. <if test="fDeclarationElements != null">f_declaration_elements = #{fDeclarationElements},</if>
  1106. <if test="fPartNumber != null">f_part_number = #{fPartNumber},</if>
  1107. <if test="fIfinspection != null">f_ifinspection = #{fIfinspection},</if>
  1108. <if test="fValue != null">f_value = #{fValue},</if>
  1109. <if test="fWeighingDate != null">f_weighing_date = #{fWeighingDate},</if>
  1110. <if test="fIfsampling != null">f_ifsampling = #{fIfsampling},</if>
  1111. <if test="sendSampleDate != null">send_sample_date = #{sendSampleDate},</if>
  1112. <if test="fIfweightRecovery != null">f_ifweight_recovery = #{fIfweightRecovery},</if>
  1113. <if test="weightRecoveryDate != null">weight_recovery_date = #{weightRecoveryDate},</if>
  1114. <if test="warehouseStatus != null">warehouse_status = #{warehouseStatus},</if>
  1115. <if test="fTimes != null">f_times = #{fTimes},</if>
  1116. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  1117. <if test="fChargetype != null">f_chargetype = #{fChargetype},</if>
  1118. <if test="fWeighWeight != null">f_weigh_weight = #{fWeighWeight},</if>
  1119. <if test="fPredictBranch != null">f_predict_branch = #{fPredictBranch},</if>
  1120. <if test="fGrade != null">f_grade = #{fGrade},</if>
  1121. <if test="fDeliveryDetails != null">f_delivery_details = #{fDeliveryDetails},</if>
  1122. <if test="fSalesmanId != null">f_salesman_id = #{fSalesmanId},</if>
  1123. <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
  1124. <if test="fUpdeteStatus != null">f_updete_status = #{fUpdeteStatus},</if>
  1125. <if test="fSubmitUpdate != null">f_submit_update = #{fSubmitUpdate},</if>
  1126. <if test="fDeleteStatus != null">f_delete_status = #{fDeleteStatus},</if>
  1127. <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
  1128. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  1129. <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
  1130. <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
  1131. </trim>
  1132. where f_id = #{fId}
  1133. </update>
  1134. <update id="updateKaHeOrder" parameterType="TWarehousebills">
  1135. update t_warehousebills
  1136. <trim prefix="SET" suffixOverrides=",">
  1137. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1138. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1139. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1140. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1141. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1142. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1143. <if test="fTel != null">f_tel = #{fTel},</if>
  1144. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1145. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1146. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1147. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
  1148. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1149. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1150. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1151. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1152. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1153. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1154. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1155. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1156. <if test="fQty != null">f_qty = #{fQty},</if>
  1157. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1158. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1159. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1160. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1161. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1162. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1163. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1164. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1165. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1166. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  1167. <if test="fEta != null">f_eta = #{fEta},</if>
  1168. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1169. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1170. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1171. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1172. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1173. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1174. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1175. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1176. <if test="createBy != null">create_by = #{createBy},</if>
  1177. <if test="createTime != null">create_time = #{createTime},</if>
  1178. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1179. <if test="updateBy != null">update_by = #{updateBy},</if>
  1180. <if test="updateTime != null">update_time = #{updateTime},</if>
  1181. <if test="remark != null">remark = #{remark},</if>
  1182. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1183. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1184. <if test="fReviewDate != null and fBillstatus == 11" >f_review_date = #{fReviewDate},</if>
  1185. <if test="fReviewDate != null and fBillstatus != 11">f_review_date = null,</if>
  1186. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1187. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1188. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1189. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1190. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1191. <if test="fReviewDate == null">f_review_date = null,</if>
  1192. <if test="fLabour != null">f_labour = #{fLabour },</if>
  1193. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1194. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1195. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1196. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1197. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1198. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1199. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1200. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1201. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1202. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1203. <if test="fSign != null">f_sign = #{fSign},</if>
  1204. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1205. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1206. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1207. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1208. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1209. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1210. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1211. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1212. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1213. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1214. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1215. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1216. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1217. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1218. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1219. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1220. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1221. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  1222. <if test="fBusinessAttribution != null">f_business_attribution = #{fBusinessAttribution},</if>
  1223. <if test="fSupervisionUnit != null">f_supervision_unit = #{fSupervisionUnit},</if>
  1224. <if test="fDeclarationElements != null">f_declaration_elements = #{fDeclarationElements},</if>
  1225. <if test="fPartNumber != null">f_part_number = #{fPartNumber},</if>
  1226. <if test="fIfinspection != null">f_ifinspection = #{fIfinspection},</if>
  1227. <if test="fValue != null">f_value = #{fValue},</if>
  1228. <if test="fWeighingDate != null">f_weighing_date = #{fWeighingDate},</if>
  1229. <if test="fIfsampling != null">f_ifsampling = #{fIfsampling},</if>
  1230. <if test="sendSampleDate != null">send_sample_date = #{sendSampleDate},</if>
  1231. <if test="fIfweightRecovery != null">f_ifweight_recovery = #{fIfweightRecovery},</if>
  1232. <if test="weightRecoveryDate != null">weight_recovery_date = #{weightRecoveryDate},</if>
  1233. <if test="warehouseStatus != null">warehouse_status = #{warehouseStatus},</if>
  1234. <if test="fTimes != null">f_times = #{fTimes},</if>
  1235. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  1236. <if test="fChargetype != null">f_chargetype = #{fChargetype},</if>
  1237. <if test="fWeighWeight != null">f_weigh_weight = #{fWeighWeight},</if>
  1238. <if test="fPredictBranch != null">f_predict_branch = #{fPredictBranch},</if>
  1239. <if test="fGrade != null">f_grade = #{fGrade},</if>
  1240. <if test="fDeliveryDetails != null">f_delivery_details = #{fDeliveryDetails},</if>
  1241. <if test="fSalesmanId != null">f_salesman_id = #{fSalesmanId},</if>
  1242. <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
  1243. <if test="fUpdeteStatus != null">f_updete_status = #{fUpdeteStatus},</if>
  1244. <if test="fSubmitUpdate != null">f_submit_update = #{fSubmitUpdate},</if>
  1245. <if test="fDeleteStatus != null">f_delete_status = #{fDeleteStatus},</if>
  1246. <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
  1247. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  1248. <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
  1249. <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
  1250. </trim>
  1251. where f_id = #{fId}
  1252. </update>
  1253. <delete id="deleteTWarehousebillsById" parameterType="Long">
  1254. delete
  1255. from t_warehousebills
  1256. where f_id = #{fId}
  1257. </delete>
  1258. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  1259. delete
  1260. item.*,
  1261. bill.*,
  1262. fess.*,
  1263. enclosure.*
  1264. from
  1265. t_warehousebills bill
  1266. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  1267. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  1268. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1269. where
  1270. bill.f_id in
  1271. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1272. #{fId}
  1273. </foreach>
  1274. </delete>
  1275. <delete id="deleteKHTWarehousebillsByIds" parameterType="String">
  1276. delete
  1277. bill.*,
  1278. fess.*,
  1279. enclosure.*
  1280. from
  1281. t_warehousebills bill
  1282. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1283. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1284. where
  1285. bill.f_id in
  1286. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1287. #{fId}
  1288. </foreach>
  1289. </delete>
  1290. <update id="warehouseFollowUpdate">
  1291. update
  1292. t_warehousebills
  1293. <trim prefix="SET" suffixOverrides=",">
  1294. <if test="fettle != null">f_billstatus = #{fettle},</if>
  1295. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  1296. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  1297. </trim>
  1298. where f_id = #{fPid}
  1299. </update>
  1300. <update id="warehouseApprovalUpdate">
  1301. update
  1302. t_warehousebills
  1303. SET ${auditItem.fidStatus} = #{fettle}
  1304. where f_id = #{auditItem.billId}
  1305. </update>
  1306. <select id="selectDetailedList" resultType="java.util.Map">
  1307. SELECT
  1308. t.f_id AS fId,
  1309. item.f_id AS fItemsId,
  1310. C.f_name AS fcorpid,
  1311. t.f_mblno AS fMblno,
  1312. g.f_name AS fGoodsid,
  1313. dict.dict_label AS fBusinessType,
  1314. t.f_marks AS fMarks,
  1315. CASE
  1316. WHEN t.f_billtype = 'SJRK' THEN
  1317. '入库'
  1318. WHEN t.f_billtype = 'SJCK' THEN
  1319. '出库'
  1320. WHEN t.f_billtype = 'CKDB' THEN
  1321. '调拨'
  1322. WHEN t.f_billtype = 'HQZY' THEN
  1323. '货权转移'
  1324. WHEN t.f_billtype = 'HWTG' THEN
  1325. '货物通关'
  1326. END AS fBilltype,
  1327. item.f_bsdate AS fBsdate,
  1328. item.f_warehouse_information AS fWarehouseInformation,
  1329. dictTra.dict_label AS fTrademodeid,
  1330. CASE
  1331. WHEN t.f_billtype = 'SJRK' THEN
  1332. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1333. END AS fQtyRK,
  1334. CASE
  1335. WHEN t.f_billtype = 'SJRK' THEN
  1336. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1337. END AS fGrossweightRK,
  1338. CASE
  1339. WHEN t.f_billtype = 'SJRK' THEN
  1340. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1341. END AS fNetweightRK,
  1342. CASE
  1343. WHEN t.f_billtype = 'SJCK' THEN
  1344. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1345. END AS fQtyCK,
  1346. CASE
  1347. WHEN t.f_billtype = 'SJCK' THEN
  1348. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1349. END AS fGrossweightCK,
  1350. CASE
  1351. WHEN t.f_billtype = 'SJCK' THEN
  1352. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1353. END AS fNetweightCK,
  1354. CASE
  1355. WHEN t.f_billtype = 'CKDB' THEN
  1356. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1357. END AS fQtyDB,
  1358. CASE
  1359. WHEN t.f_billtype = 'CKDB' THEN
  1360. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1361. END AS fGrossweightDB,
  1362. CASE
  1363. WHEN t.f_billtype = 'CKDB' THEN
  1364. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1365. END AS fNetweightDB,
  1366. CASE
  1367. WHEN t.f_billtype = 'HQZY' THEN
  1368. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1369. END AS fQtyHZ,
  1370. CASE
  1371. WHEN t.f_billtype = 'HQZY' THEN
  1372. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1373. END AS fGrossweightHZ,
  1374. CASE
  1375. WHEN t.f_billtype = 'HQZY' THEN
  1376. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1377. END AS fNetweightHZ,
  1378. CASE
  1379. WHEN t.f_billtype = 'HWTG' THEN
  1380. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1381. END AS fQtyTG,
  1382. CASE
  1383. WHEN t.f_billtype = 'HWTG' THEN
  1384. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1385. END AS fGrossweightTG,
  1386. CASE
  1387. WHEN t.f_billtype = 'HWTG' THEN
  1388. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1389. END AS fNetweightTG
  1390. FROM t_warehousebills t
  1391. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1392. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1393. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1394. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1395. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1396. WHERE dict.STATUS = '0'
  1397. AND t.f_typeid IS NULL
  1398. AND dict.dict_type = 'storage_type'
  1399. AND dictTra.STATUS = '0'
  1400. AND dictTra.dict_type = 'data_trademodes'
  1401. AND item.f_billstatus = 40
  1402. AND item.f_mblno = #{fMblno}
  1403. AND (item.f_warehouselocid = #{fWarehouseLocationid} or
  1404. item.f_transfer_warehouselocid = #{fWarehouseLocationid})
  1405. AND t.f_trademodeid = #{fTrademodeids}
  1406. AND item.f_business_type = #{fBusinessType}
  1407. AND item.f_goodsid = #{fGoodsid}
  1408. AND item.f_marks = #{fMarks}
  1409. AND t.f_corpid = #{fCorpIds}
  1410. GROUP BY t.f_id
  1411. </select>
  1412. <select id="webVersionOrderList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1413. SELECT
  1414. tw.f_id,
  1415. tw.f_billno,
  1416. tw.f_customsdeclartion,
  1417. tw.f_originalbillno,
  1418. tw.f_deptid,
  1419. tw.f_bsdeptid,
  1420. tw.f_contacts,
  1421. tw.f_tel,
  1422. tw.f_corpid,
  1423. tc.f_name corpName,
  1424. tw.f_tocorpid,
  1425. tw.f_stltypeid,
  1426. tw.f_bscorpno,
  1427. tw.f_warehouseid,
  1428. tw.f_storekeeper,
  1429. tw.f_chargedate,
  1430. tw.f_bsdate,
  1431. tw.f_planqty,
  1432. tw.f_plangrossweight,
  1433. tw.f_plannetweight,
  1434. tw.f_planvolumn,
  1435. tw.f_qty,
  1436. tw.f_grossweight,
  1437. tw.f_netweight,
  1438. tw.f_volumn,
  1439. tw.f_billingway,
  1440. tw.f_trademodeid,
  1441. tw.f_sbu,
  1442. tw.f_feetunit,
  1443. tw.f_mblno,
  1444. tw.f_marks,
  1445. tw.f_vslvoy,
  1446. tw.f_eta,
  1447. tw.f_customno,
  1448. tw.f_ifweigh,
  1449. tw.f_ifpledge,
  1450. tw.f_ifdamage,
  1451. tw.f_bankcorpid,
  1452. tw.f_billtype,
  1453. tw.f_billstatus,
  1454. tw.f_items_status,
  1455. tw.del_flag,
  1456. tw.create_by,
  1457. tw.create_time,
  1458. tw.update_by,
  1459. tw.update_time,
  1460. tw.remark,
  1461. tw.f_billing_deadline,
  1462. tw.f_product_name,
  1463. tw.f_review_date,
  1464. tw.f_truckno,
  1465. tw.f_driver_name,
  1466. tw.f_driver_tel,
  1467. tw.f_driver_id_car,
  1468. tw.f_business_type,
  1469. tw.f_labour,
  1470. tw.f_fleet,
  1471. tw.f_inwarehouseid,
  1472. tw.f_bstime,
  1473. tw.f_cartype,
  1474. tw.f_goodsid,
  1475. tw.f_new_trademodeid,
  1476. tw.f_loadportid,
  1477. address.f_name loadportidName,
  1478. tw.f_destportid,
  1479. ta.f_name destportidName,
  1480. tw.f_serviceitems,
  1481. sd.dict_label serviceitemsName,
  1482. tw.f_invoceobj,
  1483. sdi.dict_label invoceobjName,
  1484. tw.f_sign,
  1485. sdc.dict_label signName,
  1486. tw.f_detentioncargo,
  1487. sdt.dict_label detentioncargoName,
  1488. tw.f_booksmarks,
  1489. tw.f_shippername,
  1490. tw.f_shipperattn,
  1491. tw.f_shippertel,
  1492. tw.f_consigneername,
  1493. tw.f_consigneeattn,
  1494. tw.f_consigneetel,
  1495. tw.f_insurance,
  1496. sdd.dict_label insuranceName,
  1497. tw.f_insuranceamt,
  1498. tw.f_closedate,
  1499. tw.f_docmentdate,
  1500. tw.f_vslid,
  1501. tv.f_name vslidName,
  1502. tw.f_voyid,
  1503. ty.f_no voyidName,
  1504. tw.f_typeid,
  1505. tw.f_paymode,
  1506. sda.dict_label paymodeName,
  1507. tw.f_laneid,
  1508. tr.f_name laneidName,
  1509. tw.f_updete_status,
  1510. tw.f_submit_update,
  1511. tw.f_delete_status,
  1512. tw.f_cargo_planning,
  1513. tw.f_arrival_status,
  1514. tw.f_dismount_status
  1515. FROM t_warehousebills tw
  1516. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1517. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1518. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1519. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1520. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1521. AND sd.dict_type = 'f_serviceitems'
  1522. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1523. AND sdi.dict_type = 'f_invoceobj'
  1524. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1525. AND sdc.dict_type = 'f_sign'
  1526. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1527. AND sdt.dict_type = 'f_detentioncargo'
  1528. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1529. AND sdd.dict_type = 'f_insurance'
  1530. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1531. AND sda.dict_type = 'f_paymode'
  1532. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1533. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1534. <where>
  1535. tw.f_typeid = '1'
  1536. and tw.del_flag = '0'
  1537. <if test="fId != null">and tw.f_id = #{fId}</if>
  1538. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1539. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =#{fCustomsdeclartion}</if>
  1540. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}</if>
  1541. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1542. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1543. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1544. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1545. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1546. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1547. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1548. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1549. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1550. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1551. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1552. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1553. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1554. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1555. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1556. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1557. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1558. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1559. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1560. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1561. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1562. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1563. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1564. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1565. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1566. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1567. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1568. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1569. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1570. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1571. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1572. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1573. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1574. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1575. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1576. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1577. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1578. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1579. #{fProductName}, '%')
  1580. </if>
  1581. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1582. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1583. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1584. '%')
  1585. </if>
  1586. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1587. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1588. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1589. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1590. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1591. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1592. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1593. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1594. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1595. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1596. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1597. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1598. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1599. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1600. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1601. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1602. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1603. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1604. #{fShippername}, '%')
  1605. </if>
  1606. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1607. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1608. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1609. #{fConsigneername}, '%')
  1610. </if>
  1611. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1612. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1613. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1614. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1615. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1616. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1617. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1618. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1619. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1620. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1621. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1622. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1623. and tw.create_time &gt;= #{timeInterval[0]}
  1624. </if>
  1625. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1626. and tw.create_time &lt;= #{timeInterval[1]}
  1627. </if>
  1628. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  1629. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  1630. </where>
  1631. ORDER BY tw.create_time DESC, tw.f_id DESC
  1632. </select>
  1633. <select id="ruoYiVersionOrderList" parameterType="TWarehousebills" resultType="map">
  1634. SELECT
  1635. DISTINCT
  1636. tw.f_id fId,
  1637. tw.f_billno fBillno,
  1638. tw.f_originalbillno fOriginalbillno,
  1639. tw.f_mblno fMblno,
  1640. sd.dict_label fServiceitems,
  1641. tw.f_consigneername fConsigneername,
  1642. ta.f_name fName,
  1643. tw.f_bsdate fBsdate,
  1644. tc.f_cntrcount fCntrcount,
  1645. tc.f_no fNo,
  1646. tv.f_name vslName,
  1647. ty.f_no voyNo,
  1648. tw.f_corpid fCorpid,
  1649. tp.f_name corpName,
  1650. tw.create_by createBy,
  1651. tw.create_time createTime,
  1652. tw.f_loadportid fLoadportid,
  1653. tre.f_name loadportName,
  1654. tw.f_destportid fDestportid,
  1655. ts.f_name destportName,
  1656. tc.f_name goodsName,
  1657. CASE
  1658. WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1659. '下单新建'
  1660. WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1661. '下单暂存'
  1662. WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1663. '下单驳回'
  1664. WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1665. '下单提交'
  1666. WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1667. '下单审批中'
  1668. WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1669. '下单审批通过'
  1670. WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1671. '配船暂存'
  1672. WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1673. '配船驳回'
  1674. WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1675. '配船提交'
  1676. WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1677. '配船审批中'
  1678. WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1679. '配船审批通过'
  1680. WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1681. '运单变更'
  1682. WHEN tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1683. '申请变更驳回'
  1684. WHEN tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1685. '申请变更提交'
  1686. WHEN tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1687. '申请变更审批中'
  1688. WHEN tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1689. '申请变更通过'
  1690. WHEN tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1691. '提交变更驳回'
  1692. WHEN tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1693. '提交变更审批'
  1694. WHEN tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1695. '提交变更审批中'
  1696. WHEN tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1697. '提交变更通过'
  1698. WHEN tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
  1699. '申请删单驳回'
  1700. WHEN tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
  1701. '申请删单提交'
  1702. WHEN tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
  1703. '申请删单审批中'
  1704. WHEN tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
  1705. '申请删单通过'
  1706. WHEN tw.f_dismount_status = '3' THEN
  1707. '拆单审批驳回'
  1708. WHEN tw.f_dismount_status = '4' THEN
  1709. '拆单审批提交'
  1710. WHEN tw.f_dismount_status = '5' THEN
  1711. '拆单审批中'
  1712. WHEN tw.f_dismount_status = '6' THEN
  1713. '拆单审批通过'
  1714. END AS fBillstatus,
  1715. CASE
  1716. WHEN tf.f_billstatus = '1' THEN
  1717. '新建'
  1718. WHEN tf.f_billstatus = '2' THEN
  1719. '暂存'
  1720. WHEN tf.f_billstatus = '3' THEN
  1721. '驳回'
  1722. WHEN tf.f_billstatus = '4' THEN
  1723. '提交'
  1724. WHEN tf.f_billstatus = '5' THEN
  1725. '审批中'
  1726. WHEN tf.f_billstatus = '6' THEN
  1727. '审批通过'
  1728. END AS moneyStatus,
  1729. tw.f_updete_status fUpdeteStatus,
  1730. tw.f_submit_update fSubmitUpdate,
  1731. tw.f_delete_status fDeleteStatus,
  1732. tw.f_cargo_planning fCargoPlanning,
  1733. tw.f_arrival_status fArrivalStatus,
  1734. tw.f_vslid fVslid,
  1735. tw.f_voyid fVoyid
  1736. FROM
  1737. t_warehousebills tw
  1738. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  1739. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  1740. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  1741. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  1742. LEFT JOIN t_warehousebills_cntritems items ON tw.f_id = items.f_pid
  1743. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  1744. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  1745. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  1746. LEFT JOIN (
  1747. SELECT
  1748. th.f_pid,
  1749. th.f_cntrcount,
  1750. tr.f_no,
  1751. th.f_cntrid,
  1752. tg.f_name
  1753. FROM
  1754. t_warehousebills_cntr th
  1755. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  1756. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  1757. ) tc ON tc.f_pid = tw.f_id
  1758. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
  1759. <where>
  1760. tw.f_typeid = '1'
  1761. and tw.del_flag = '0'
  1762. <if test="fId != null">and tw.f_id = #{fId}</if>
  1763. <if test="fCntrno != null and fCntrno != ''">and items.f_cntrno like concat('%', #{fCntrno}, '%')</if>
  1764. <if test="fBillno != null and fBillno != ''">and tw.f_billno like concat('%',#{fBillno}, '%')</if>
  1765. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1766. #{fCustomsdeclartion}
  1767. </if>
  1768. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1769. </if>
  1770. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1771. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1772. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1773. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1774. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1775. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1776. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1777. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1778. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1779. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1780. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1781. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1782. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1783. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1784. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1785. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1786. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1787. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1788. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1789. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1790. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1791. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1792. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1793. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1794. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%',
  1795. #{fMblno}, '%')</if>
  1796. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1797. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1798. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1799. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1800. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1801. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1802. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1803. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1804. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1805. <if test="fBillstatus != null and (fBillstatus == 4 or fBillstatus == 6 or fBillstatus == 9 or fBillstatus == 11)">
  1806. and tw.f_billstatus = #{fBillstatus}
  1807. and tw.f_updete_status = 2
  1808. and tw.f_submit_update = 2
  1809. and tw.f_delete_status = 2
  1810. </if>
  1811. <if test="fBillstatus != null and fBillstatus == 10">
  1812. and tw.f_billstatus in ('3','8')
  1813. and tw.f_updete_status in ('2','3')
  1814. and tw.f_submit_update in ('2','3')
  1815. and tw.f_delete_status in ('2','3')
  1816. </if>
  1817. <if test="fBillstatus != null and fBillstatus == 12">
  1818. AND (tw.f_updete_status != 2
  1819. OR tw.f_submit_update != 2
  1820. OR tw.f_delete_status != 2 )
  1821. </if>
  1822. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1823. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1824. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1825. #{fProductName}, '%')
  1826. </if>
  1827. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1828. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1829. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1830. '%')
  1831. </if>
  1832. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1833. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1834. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1835. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1836. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1837. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1838. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1839. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1840. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1841. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1842. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1843. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1844. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1845. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1846. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1847. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1848. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1849. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1850. #{fShippername}, '%')
  1851. </if>
  1852. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1853. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1854. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1855. #{fConsigneername}, '%')
  1856. </if>
  1857. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1858. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1859. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1860. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1861. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1862. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1863. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1864. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1865. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1866. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1867. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1868. <if test='startTime != null'>
  1869. and tw.create_time &gt;= #{startTime}
  1870. </if>
  1871. <if test='endTime != null'>
  1872. and tw.create_time &lt;= #{endTime}
  1873. </if>
  1874. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  1875. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  1876. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  1877. #{vslidName}, '%')
  1878. </if>
  1879. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  1880. #{voyidName}, '%')
  1881. </if>
  1882. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  1883. #{voyidName}, '%')
  1884. </if>
  1885. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  1886. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  1887. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  1888. </if>
  1889. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  1890. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  1891. </if>
  1892. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1893. and ty.f_ATD &gt;= #{timeInterval[0]}
  1894. </if>
  1895. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1896. and ty.f_ATD &lt;= #{timeInterval[1]}
  1897. </if>
  1898. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  1899. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  1900. </where>
  1901. ORDER BY tw.create_time DESC, tw.f_id DESC
  1902. </select>
  1903. <select id="ruoYiVersionOrderList1" parameterType="TWarehousebills" resultType="map">
  1904. SELECT
  1905. tw.f_id fId,
  1906. tw.f_billno fBillno,
  1907. tw.f_originalbillno fOriginalbillno,
  1908. tw.f_mblno fMblno,
  1909. sd.dict_label fServiceitems,
  1910. tw.f_consigneername fConsigneername,
  1911. ta.f_name fName,
  1912. tw.f_bsdate fBsdate,
  1913. tc.f_cntrcount fCntrcount,
  1914. tc.f_no fNo,
  1915. tv.f_name vslName,
  1916. ty.f_no voyNo,
  1917. tw.f_corpid fCorpid,
  1918. tp.f_name corpName,
  1919. tw.create_by createBy,
  1920. tw.create_time createTime,
  1921. tw.f_loadportid fLoadportid,
  1922. tre.f_name loadportName,
  1923. tw.f_destportid fDestportid,
  1924. ts.f_name destportName,
  1925. tc.f_name goodsName,
  1926. tw.f_billstatus fBillstatus,
  1927. CASE
  1928. WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1929. '下单新建'
  1930. WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1931. '下单暂存'
  1932. WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1933. '下单驳回'
  1934. WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1935. '下单提交'
  1936. WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1937. '下单审批中'
  1938. WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1939. '下单审批通过'
  1940. WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1941. '配船暂存'
  1942. WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1943. '配船驳回'
  1944. WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1945. '配船提交'
  1946. WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1947. '配船审批中'
  1948. WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1949. '配船审批通过'
  1950. WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1951. '运单变更'
  1952. WHEN tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1953. '申请变更驳回'
  1954. WHEN tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1955. '申请变更提交'
  1956. WHEN tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1957. '申请变更审批中'
  1958. WHEN tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1959. '申请变更通过'
  1960. WHEN tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1961. '提交变更驳回'
  1962. WHEN tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1963. '提交变更审批'
  1964. WHEN tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1965. '提交变更审批中'
  1966. WHEN tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  1967. '提交变更通过'
  1968. WHEN tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
  1969. '申请删单驳回'
  1970. WHEN tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
  1971. '申请删单提交'
  1972. WHEN tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
  1973. '申请删单审批中'
  1974. WHEN tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
  1975. '申请删单通过'
  1976. WHEN tw.f_dismount_status = '3' THEN
  1977. '拆单审批驳回'
  1978. WHEN tw.f_dismount_status = '4' THEN
  1979. '拆单审批提交'
  1980. WHEN tw.f_dismount_status = '5' THEN
  1981. '拆单审批中'
  1982. WHEN tw.f_dismount_status = '6' THEN
  1983. '拆单审批通过'
  1984. END AS fBillstatusName,
  1985. CASE
  1986. WHEN tf.f_billstatus = '1' THEN
  1987. '新建'
  1988. WHEN tf.f_billstatus = '2' THEN
  1989. '暂存'
  1990. WHEN tf.f_billstatus = '3' THEN
  1991. '驳回'
  1992. WHEN tf.f_billstatus = '4' THEN
  1993. '提交'
  1994. WHEN tf.f_billstatus = '5' THEN
  1995. '审批中'
  1996. WHEN tf.f_billstatus = '6' THEN
  1997. '审批通过'
  1998. END AS moneyStatus,
  1999. tw.f_updete_status fUpdeteStatus,
  2000. tw.f_submit_update fSubmitUpdate,
  2001. tw.f_delete_status fDeleteStatus,
  2002. ROUND(IFNULL(tf.fAmount,0),2) fAmount,
  2003. tw.f_cargo_planning fCargoPlanning,
  2004. tw.f_arrival_status
  2005. FROM
  2006. t_warehousebills tw
  2007. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  2008. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  2009. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  2010. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2011. AND sd.dict_type = 'f_serviceitems'
  2012. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2013. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2014. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  2015. LEFT JOIN (
  2016. SELECT
  2017. th.f_pid,
  2018. th.f_cntrcount,
  2019. tr.f_no,
  2020. th.f_cntrid,
  2021. tg.f_name
  2022. FROM
  2023. t_warehousebills_cntr th
  2024. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  2025. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  2026. ) tc ON tc.f_pid = tw.f_id
  2027. LEFT JOIN (SELECT f_pid,f_billstatus,IFNULL(SUM(f_amount),0) fAmount FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
  2028. <where>
  2029. tw.f_typeid = '1'
  2030. and tw.del_flag = '0'
  2031. <if test="fId != null">and tw.f_id = #{fId}</if>
  2032. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2033. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2034. #{fCustomsdeclartion}
  2035. </if>
  2036. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2037. </if>
  2038. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2039. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2040. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2041. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2042. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2043. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2044. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2045. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2046. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2047. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2048. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2049. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2050. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2051. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2052. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2053. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2054. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2055. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2056. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2057. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2058. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2059. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2060. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2061. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2062. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2063. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2064. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2065. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2066. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2067. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2068. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2069. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2070. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2071. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2072. <if test="fBillstatus != null and (fBillstatus == 4 or fBillstatus == 6 or fBillstatus == 9 or fBillstatus == 11)">
  2073. and tw.f_billstatus = #{fBillstatus}
  2074. and tw.f_updete_status = 2
  2075. and tw.f_submit_update = 2
  2076. and tw.f_delete_status = 2
  2077. </if>
  2078. <if test="fBillstatus != null and fBillstatus == 10">
  2079. and tw.f_billstatus in ('3','8')
  2080. and tw.f_updete_status in ('2','3')
  2081. and tw.f_submit_update in ('2','3')
  2082. and tw.f_delete_status in ('2','3')
  2083. </if>
  2084. <if test="fBillstatus != null and fBillstatus == 12">
  2085. AND (tw.f_updete_status != 2
  2086. OR tw.f_submit_update != 2
  2087. OR tw.f_delete_status != 2 )
  2088. </if>
  2089. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2090. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2091. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2092. #{fProductName}, '%')
  2093. </if>
  2094. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2095. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2096. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2097. '%')
  2098. </if>
  2099. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2100. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2101. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2102. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2103. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2104. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2105. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2106. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2107. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2108. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2109. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2110. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2111. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2112. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2113. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2114. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2115. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2116. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2117. #{fShippername}, '%')
  2118. </if>
  2119. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2120. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2121. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2122. #{fConsigneername}, '%')
  2123. </if>
  2124. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2125. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2126. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2127. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2128. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2129. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2130. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2131. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2132. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2133. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  2134. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  2135. <if test='startTime != null'>
  2136. and tw.create_time &gt;= #{startTime}
  2137. </if>
  2138. <if test='endTime != null'>
  2139. and tw.create_time &lt;= #{endTime}
  2140. </if>
  2141. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  2142. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  2143. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  2144. #{vslidName}, '%')
  2145. </if>
  2146. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  2147. #{voyidName}, '%')
  2148. </if>
  2149. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  2150. #{voyidName}, '%')
  2151. </if>
  2152. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  2153. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2154. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  2155. </if>
  2156. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2157. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  2158. </if>
  2159. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  2160. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  2161. </where>
  2162. ORDER BY tw.create_time DESC, tw.f_id DESC
  2163. </select>
  2164. <select id="webVersionOrderById" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2165. SELECT tw.f_id,
  2166. tw.f_billno,
  2167. tw.f_customsdeclartion,
  2168. tw.f_originalbillno,
  2169. tw.f_deptid,
  2170. tw.f_bsdeptid,
  2171. tw.f_contacts,
  2172. tw.f_tel,
  2173. tw.f_corpid,
  2174. tc.f_name corpName,
  2175. tw.f_tocorpid,
  2176. tw.f_stltypeid,
  2177. tw.f_bscorpno,
  2178. tw.f_warehouseid,
  2179. tw.f_storekeeper,
  2180. tw.f_chargedate,
  2181. tw.f_bsdate,
  2182. tw.f_planqty,
  2183. tw.f_plangrossweight,
  2184. tw.f_plannetweight,
  2185. tw.f_planvolumn,
  2186. tw.f_qty,
  2187. tw.f_grossweight,
  2188. tw.f_netweight,
  2189. tw.f_volumn,
  2190. tw.f_billingway,
  2191. tw.f_trademodeid,
  2192. tw.f_sbu,
  2193. tw.f_feetunit,
  2194. tw.f_mblno,
  2195. tw.f_marks,
  2196. tw.f_vslvoy,
  2197. tw.f_eta,
  2198. tw.f_customno,
  2199. tw.f_ifweigh,
  2200. tw.f_ifpledge,
  2201. tw.f_ifdamage,
  2202. tw.f_bankcorpid,
  2203. tw.f_billtype,
  2204. tw.f_billstatus,
  2205. tw.f_items_status,
  2206. tw.del_flag,
  2207. tw.create_by,
  2208. tw.create_time,
  2209. tw.update_by,
  2210. tw.update_time,
  2211. tw.remark,
  2212. tw.f_billing_deadline,
  2213. tw.f_product_name,
  2214. tw.f_review_date,
  2215. tw.f_truckno,
  2216. tw.f_driver_name,
  2217. tw.f_driver_tel,
  2218. tw.f_driver_id_car,
  2219. tw.f_business_type,
  2220. tw.f_labour,
  2221. tw.f_fleet,
  2222. tw.f_inwarehouseid,
  2223. tw.f_bstime,
  2224. tw.f_cartype,
  2225. tw.f_goodsid,
  2226. tw.f_new_trademodeid,
  2227. tw.f_loadportid,
  2228. address.f_name loadportidName,
  2229. tw.f_destportid,
  2230. ta.f_name destportidName,
  2231. tw.f_serviceitems,
  2232. sd.dict_label serviceitemsName,
  2233. tw.f_invoceobj,
  2234. sdi.dict_label invoceobjName,
  2235. tw.f_sign,
  2236. sdc.dict_label signName,
  2237. tw.f_detentioncargo,
  2238. sdt.dict_label detentioncargoName,
  2239. tw.f_booksmarks,
  2240. tw.f_shippername,
  2241. tw.f_shipperattn,
  2242. tw.f_shippertel,
  2243. tw.f_consigneername,
  2244. tw.f_consigneeattn,
  2245. tw.f_consigneetel,
  2246. tw.f_insurance,
  2247. sdd.dict_label insuranceName,
  2248. tw.f_insuranceamt,
  2249. tw.f_closedate,
  2250. tw.f_docmentdate,
  2251. tw.f_vslid,
  2252. tv.f_name vslidName,
  2253. tw.f_voyid,
  2254. ty.f_no voyidName,
  2255. tw.f_typeid,
  2256. tw.f_paymode,
  2257. sda.dict_label paymodeName,
  2258. tw.f_laneid,
  2259. tr.f_name laneidName,
  2260. tw.f_updete_status,
  2261. tw.f_submit_update,
  2262. tw.f_delete_status,
  2263. tw.f_cargo_planning,
  2264. tw.f_arrival_status,
  2265. tw.f_dismount_status
  2266. FROM t_warehousebills tw
  2267. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  2268. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2269. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  2270. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  2271. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2272. AND sd.dict_type = 'f_serviceitems'
  2273. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  2274. AND sdi.dict_type = 'f_invoceobj'
  2275. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  2276. AND sdc.dict_type = 'f_sign'
  2277. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  2278. AND sdt.dict_type = 'f_detentioncargo'
  2279. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  2280. AND sdd.dict_type = 'f_insurance'
  2281. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  2282. AND sda.dict_type = 'f_paymode'
  2283. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  2284. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  2285. where tw.f_id = #{fId}
  2286. </select>
  2287. <select id="selectTWarehousebillsfMblno" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2288. SELECT
  2289. f_id,
  2290. f_mblno
  2291. FROM
  2292. t_warehousebills
  2293. WHERE
  2294. f_typeid = '1'
  2295. and f_mblno = #{fMblno}
  2296. </select>
  2297. <select id="selectAppStockList" parameterType="TWarehousebills" resultType="Map">
  2298. SELECT DISTINCT
  2299. w.f_id fId,
  2300. w.f_corpid fCorpid,
  2301. c.f_name corpName,
  2302. w.f_bsdate fBsdate,
  2303. g.f_name goodsName,
  2304. w.f_mblno fMblno,
  2305. w.f_qty fQty,
  2306. w.f_cntval fCntval,
  2307. w.f_planqty fPlanqty,
  2308. t.f_name fWarehouseName,
  2309. w.f_planvolumn fPlanvolumn,
  2310. w.f_plannetweight fPlannetweight,
  2311. w.f_plangrossweight fPlangrossweight,
  2312. IFNULL(ROUND(w.f_grossweight/1000.3465,2),0) fGrossweight,
  2313. w.f_grossweight fGrossweights,
  2314. w.f_storekeeper fStorekeeper,
  2315. w.create_by createBy,
  2316. w.f_warehouseid fWarehouseid,
  2317. w.f_driver_tel fDriverTel,
  2318. w.f_trademodeid fTrademodeid,
  2319. w.f_product_name fProductName,
  2320. CASE
  2321. WHEN w.f_billtype = 'SJRK'
  2322. AND w.f_items_status = '1' THEN
  2323. '计划'
  2324. WHEN w.f_billtype = 'SJRK'
  2325. AND w.f_items_status = '2' THEN
  2326. '待入库'
  2327. WHEN w.f_billtype = 'SJRK'
  2328. AND w.f_items_status = '3' THEN
  2329. '入库中'
  2330. WHEN w.f_billtype = 'SJRK'
  2331. AND w.f_items_status = '4' THEN
  2332. '已入库'
  2333. WHEN w.f_billtype = 'SJCK'
  2334. AND w.f_items_status = '1' THEN
  2335. '计划'
  2336. WHEN w.f_billtype = 'SJCK'
  2337. AND w.f_items_status = '2' THEN
  2338. '待出库'
  2339. WHEN w.f_billtype = 'SJCK'
  2340. AND w.f_items_status = '3' THEN
  2341. '出库中'
  2342. WHEN w.f_billtype = 'SJCK'
  2343. AND w.f_items_status = '4' THEN
  2344. '已出库'
  2345. WHEN w.f_billtype = 'CKDB'
  2346. AND w.f_items_status = '1' THEN
  2347. '计划'
  2348. WHEN w.f_billtype = 'CKDB'
  2349. AND w.f_items_status = '2' THEN
  2350. '待调拨'
  2351. WHEN w.f_billtype = 'CKDB'
  2352. AND w.f_items_status = '3' THEN
  2353. '调拨中'
  2354. WHEN w.f_billtype = 'CKDB'
  2355. AND w.f_items_status = '4' THEN
  2356. '已调拨'
  2357. WHEN w.f_billtype = 'HWTG'
  2358. AND w.f_items_status = '1' THEN
  2359. '计划'
  2360. WHEN w.f_billtype = 'HWTG'
  2361. AND w.f_items_status = '2' THEN
  2362. '待调拨'
  2363. WHEN w.f_billtype = 'HWTG'
  2364. AND w.f_items_status = '3' THEN
  2365. '调拨中'
  2366. WHEN w.f_billtype = 'HWTG'
  2367. AND w.f_items_status = '4' THEN
  2368. '已调拨'
  2369. END AS fBillstatus
  2370. FROM
  2371. t_warehousebills w
  2372. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2373. LEFT JOIN t_goods g ON g.f_id = w.f_goodsid
  2374. LEFT JOIN t_warehouse t ON t.f_id = w.f_warehouseid
  2375. left join sys_user u on w.create_by = u.user_name
  2376. left join sys_user u1 on w.f_storekeeper = u1.user_name
  2377. left join sys_dept d on w.f_bsdeptid = d.dept_id
  2378. where
  2379. IF( w.f_planqty IS NOT NULL, w.f_planqty != w.f_qty, w.f_id != '')
  2380. and w.f_billtype = #{fBilltype}
  2381. AND w.f_billstatus != 6
  2382. <if test="fMblno != null ">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  2383. <if test="fItemsStatus != null ">and w.f_items_status = #{fItemsStatus}</if>
  2384. <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
  2385. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2386. and w.f_bsdate &gt;= #{timeInterval[0]}
  2387. </if>
  2388. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2389. and w.f_bsdate &lt;= #{timeInterval[1]}
  2390. </if>
  2391. ${params.dataScope}
  2392. order by w.f_bsdate desc
  2393. </select>
  2394. <select id="selectWarehouseItemListById" resultType="java.util.Map">
  2395. SELECT
  2396. t.f_id fId,
  2397. t.f_pid fPid,
  2398. c.f_name corpName,
  2399. t.f_bsdate fBsdate,
  2400. g.f_name goodsName,
  2401. t.f_mblno fMblno,
  2402. t.f_warehouse_information fWarehouseInformation,
  2403. t.f_truckno fTruckno,
  2404. t.f_cntrno fCntrno,
  2405. cntr.f_name cntrtypes,
  2406. t.f_cntrtype fCntrtype,
  2407. t.f_qty fQty,
  2408. IFNULL(ROUND(w.f_grossweight/1000.3465,2),0) fGrossweight,
  2409. t.f_grossweight fGrossweights,
  2410. t.f_cntqty fCntqty,
  2411. CASE
  2412. WHEN t.f_billstatus = '10' THEN
  2413. '计划'
  2414. WHEN t.f_billstatus = '20' THEN
  2415. IF(w.f_billtype = 'SJRK', '待入库', IF(w.f_billtype = 'SJCK','待出库', IF(w.f_billtype = 'CKDB', '待调拨',IF(w.f_billtype = 'HWTG', '待通关', IF(w.f_billtype = 'HQZY', '待转移', '无')))))
  2416. WHEN t.f_billstatus = '30' THEN
  2417. IF(w.f_billtype = 'SJRK', '入库中', IF(w.f_billtype = 'SJCK','出库中', IF(w.f_billtype = 'CKDB', '调拨中',IF(w.f_billtype = 'HWTG', '通关中', IF(w.f_billtype = 'HQZY', '转移中', '无')))))
  2418. WHEN t.f_billstatus = '40' THEN
  2419. IF(w.f_billtype = 'SJRK', '已入库', IF(w.f_billtype = 'SJCK','已出库', IF(w.f_billtype = 'CKDB', '已调拨',IF(w.f_billtype = 'HWTG', '已通关', IF(w.f_billtype = 'HQZY', '已转移', '无')))))
  2420. END fBillstatus
  2421. FROM
  2422. t_warehousebills w
  2423. LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  2424. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2425. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  2426. LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype
  2427. where
  2428. t.f_pid = #{fId}
  2429. </select>
  2430. <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
  2431. SELECT
  2432. DISTINCT
  2433. c.f_name corpName,
  2434. #{fMblno} fMblno,
  2435. w.f_product_name goodsName,
  2436. d.dict_label fBusinessType,
  2437. w.f_cntval fCntval,
  2438. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_tocorpid = #{fCorpid} || item.f_billtype = 'CKDB', date_format( item.f_bsdate, '%Y-%m-%d' ), NULL) inBsdate,
  2439. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_tocorpid = #{fCorpid} || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_qty, 0) inQty,
  2440. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid} || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_grossweight, 0.00) inGrossweight,
  2441. IF(item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, date_format( item.f_bsdate, '%Y-%m-%d' ), NULL ) outBsdate,
  2442. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_qty, 0 ) outQty,
  2443. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_grossweight, 0.00 ) outGrossweight,
  2444. CASE
  2445. WHEN item.f_billtype = 'SJRK' THEN
  2446. '入库'
  2447. WHEN item.f_billtype = 'SJCK' THEN
  2448. '出库'
  2449. WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
  2450. '调拨'
  2451. WHEN item.f_billtype = 'HQZY' THEN
  2452. '货权转移'
  2453. WHEN item.f_billtype = 'HWTG' THEN
  2454. '货物通关'
  2455. END AS fBilltype,
  2456. 0 fQtyblc,
  2457. 0 fGrossweightblc,
  2458. item.remark
  2459. FROM
  2460. t_warehousebills w
  2461. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  2462. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2463. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  2464. LEFT JOIN sys_dict_data d ON d.dict_value = w.f_business_type
  2465. WHERE
  2466. w.f_corpid = #{fCorpid}
  2467. AND item.f_mblno = #{fMblno}
  2468. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  2469. AND IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type = 'st_out_type', d.dict_type = 'st_trans_type'))
  2470. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  2471. AND item.f_bsdate &gt;= #{bsdateList[0]}
  2472. </if>
  2473. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  2474. AND item.f_bsdate &lt;= #{bsdateList[1]}
  2475. </if>
  2476. order by item.f_bsdate asc
  2477. </select>
  2478. <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
  2479. SELECT
  2480. DISTINCT
  2481. f.f_id,
  2482. date_format( f.create_time, '%Y-%m-%d' ) createTime,
  2483. d.dict_label fBusinessType,
  2484. fee.f_name fFeeid,
  2485. f.f_qty fQty,
  2486. f.f_unitprice fUnitprice,
  2487. f.f_amount fAmount,
  2488. f.remark
  2489. FROM
  2490. t_warehousebills w
  2491. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  2492. LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
  2493. LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
  2494. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  2495. LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type
  2496. WHERE
  2497. item.f_mblno = #{fMblno}
  2498. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  2499. AND IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type = 'st_out_type', d.dict_type = 'st_trans_type'))
  2500. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  2501. AND item.f_bsdate &gt;= #{bsdateList[0]}
  2502. </if>
  2503. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  2504. AND item.f_bsdate &lt;= #{bsdateList[1]}
  2505. </if>
  2506. order by f.create_time asc
  2507. </select>
  2508. <!--凯和导出清单根据船名航次-->
  2509. <select id="deriveInventory" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.DeriveInventoryExcel">
  2510. SELECT
  2511. @rank:=@rank + 1 AS rankNo,
  2512. a.*
  2513. FROM
  2514. (
  2515. SELECT
  2516. tw.f_mblno AS fMblno, /*提单号*/
  2517. twc.f_cntrno AS fCntrno, /*箱号*/
  2518. twc.f_sealno AS fSealno, /*铅封号*/
  2519. substring(tr.f_no,1,2) AS measure, /*尺寸*/
  2520. substring(tr.f_no,3,2) AS genre, /*类型*/
  2521. twc.f_cntrweight AS fCntrweight, /*重量*/
  2522. CASE
  2523. WHEN tcr.f_soc = '0' THEN tc.f_name
  2524. WHEN tcr.f_soc = '1' THEN '凯和志诚'
  2525. END AS boxCompany,/*箱公司最新*/
  2526. pro.dict_label AS boxCompanyOld, /*箱公司旧*/
  2527. td.f_name AS portOfDeparture, /*始发港*/
  2528. ts.f_name AS destinationPort, /*目的港*/
  2529. tg.f_name AS goodName, /*货名*/
  2530. sd.dict_label AS transitClause, /*运输条款*/
  2531. tc.f_name AS bookingCompany, /*订舱公司*/
  2532. tw.f_consigneername AS fConsigneername, /*收货公司名称*/
  2533. tw.f_consigneeattn AS fConsigneeattn, /*收货公司地址*/
  2534. tw.f_consigneetel AS fConsigneetel /*收货公司电话*/
  2535. FROM
  2536. t_warehousebills_cntritems twc
  2537. LEFT JOIN t_warehousebills tw ON twc.f_pid = tw.f_id
  2538. LEFT JOIN t_warehousebills_cntr tcr ON tcr.f_pid = tw.f_id
  2539. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  2540. LEFT JOIN t_cntr tr ON tr.f_id = twc.f_cntrid
  2541. LEFT JOIN t_cntrno tro ON tro.f_no = twc.f_cntrno
  2542. LEFT JOIN sys_dict_data pro ON pro.dict_value = tro.f_owner AND pro.dict_type = 'f_owner'
  2543. LEFT JOIN t_address td ON td.f_id = tw.f_loadportid
  2544. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  2545. LEFT JOIN t_goods tg ON tg.f_id = tcr.f_goodsid
  2546. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  2547. <where>
  2548. tw.f_typeid = '1'
  2549. and tw.del_flag = '0'
  2550. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2551. <if test="fCntrid != null ">and tcr.f_cntrid = #{fCntrid}</if>
  2552. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  2553. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2554. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2555. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2556. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2557. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2558. #{fConsigneername}, '%')
  2559. </if>
  2560. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2561. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  2562. </if>
  2563. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2564. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  2565. </if>
  2566. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  2567. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  2568. </where>
  2569. ORDER BY tw.f_mblno,twc.f_cntrno
  2570. )a,
  2571. (SELECT @rank:= 0) b
  2572. </select>
  2573. <select id="selectTWarehousebillsByIds" parameterType="String" resultMap="TWarehousebillsResult">
  2574. select f_id,f_vslid, f_voyid,f_arrival_status,f_billno,f_cargo_planning from t_warehousebills
  2575. where f_id in
  2576. <foreach item="fId" collection="array" open="(" separator="," close=")">
  2577. #{fId}
  2578. </foreach>
  2579. </select>
  2580. <update id="updateTWarehousebillsByIds">
  2581. update
  2582. t_warehousebills
  2583. <trim prefix="SET" suffixOverrides=",">
  2584. <if test="fVessel != null">f_vslid = #{fVessel},</if>
  2585. <if test="fVoyage != null">f_voyid = #{fVoyage},</if>
  2586. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  2587. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  2588. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  2589. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  2590. </trim>
  2591. where f_id in
  2592. <foreach item="fId" collection="fIds" open="(" separator="," close=")">
  2593. #{fId}
  2594. </foreach>
  2595. </update>
  2596. <!--凯和单航次配船-->
  2597. <select id="singleVoyageByShip" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.SingleVoyageByShipExcel">
  2598. SELECT
  2599. tv.f_name vslName,
  2600. ty.f_no voyNo,
  2601. ty.f_ATD fAtd,
  2602. ty.f_ATA fAta,
  2603. ta.f_name fName,
  2604. tre.f_name loadportName,
  2605. ts.f_name destportName,
  2606. tw.f_vslid fVslid,
  2607. tw.f_voyid fVoyid,
  2608. tw.f_arrival_status fArrivalStatus
  2609. FROM
  2610. t_warehousebills tw
  2611. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2612. AND sd.dict_type = 'f_serviceitems'
  2613. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2614. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2615. LEFT JOIN t_address ta ON ta.f_id = ty.f_laneid
  2616. LEFT JOIN t_address tre ON tre.f_id = ty.f_portofloadid
  2617. LEFT JOIN t_address ts ON ts.f_id = ty.f_distinationid
  2618. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  2619. LEFT JOIN (
  2620. SELECT
  2621. th.f_pid,
  2622. th.f_cntrcount,
  2623. tr.f_no,
  2624. th.f_cntrid,
  2625. tg.f_name
  2626. FROM
  2627. t_warehousebills_cntr th
  2628. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  2629. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  2630. ) tc ON tc.f_pid = tw.f_id
  2631. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
  2632. where
  2633. tw.f_typeid = '1'
  2634. and tw.del_flag = '0'
  2635. and tw.f_cargo_planning = '0'
  2636. and tw.f_arrival_status != '2'
  2637. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2638. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2639. GROUP BY tw.f_vslid,tw.f_voyid
  2640. </select>
  2641. </mapper>