TWarehousebillsMapper.xml 146 KB

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