TWarehousebillsMapper.xml 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper">
  6. <resultMap type="TWarehousebills" id="TWarehousebillsResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCustomsdeclartion" column="f_customsdeclartion"/>
  10. <result property="fOriginalbillno" column="f_originalbillno"/>
  11. <result property="fDeptid" column="f_deptid"/>
  12. <result property="fBsdeptid" column="f_bsdeptid"/>
  13. <result property="fContacts" column="f_contacts"/>
  14. <result property="fTel" column="f_tel"/>
  15. <result property="fCorpid" column="f_corpid"/>
  16. <result property="fTocorpid" column="f_tocorpid"/>
  17. <result property="fStltypeid" column="f_stltypeid"/>
  18. <result property="fBscorpno" column="f_bscorpno"/>
  19. <result property="fWarehouseid" column="f_warehouseid"/>
  20. <result property="fStorekeeper" column="f_storekeeper"/>
  21. <result property="fChargedate" column="f_chargedate"/>
  22. <result property="fBsdate" column="f_bsdate"/>
  23. <result property="fPlanqty" column="f_planqty"/>
  24. <result property="fPlangrossweight" column="f_plangrossweight"/>
  25. <result property="fPlannetweight" column="f_plannetweight"/>
  26. <result property="fPlanvolumn" column="f_planvolumn"/>
  27. <result property="fQty" column="f_qty"/>
  28. <result property="fGrossweight" column="f_grossweight"/>
  29. <result property="fNetweight" column="f_netweight"/>
  30. <result property="fVolumn" column="f_volumn"/>
  31. <result property="fBillingway" column="f_billingway"/>
  32. <result property="fTrademodeid" column="f_trademodeid"/>
  33. <result property="fSbu" column="f_sbu"/>
  34. <result property="fFeetunit" column="f_feetunit"/>
  35. <result property="fMblno" column="f_mblno"/>
  36. <result property="fMarks" column="f_marks"/>
  37. <result property="fVslvoy" column="f_vslvoy"/>
  38. <result property="fEta" column="f_eta"/>
  39. <result property="fCustomno" column="f_customno"/>
  40. <result property="fIfweigh" column="f_ifweigh"/>
  41. <result property="fIfpledge" column="f_ifpledge"/>
  42. <result property="fIfdamage" column="f_ifdamage"/>
  43. <result property="fBankcorpid" column="f_bankcorpid"/>
  44. <result property="fBilltype" column="f_billtype"/>
  45. <result property="fBillstatus" column="f_billstatus"/>
  46. <result property="fItemsStatus" column="f_items_status"/>
  47. <result property="delFlag" column="del_flag"/>
  48. <result property="createBy" column="create_by"/>
  49. <result property="createTime" column="create_time"/>
  50. <result property="updateBy" column="update_by"/>
  51. <result property="updateTime" column="update_time"/>
  52. <result property="remark" column="remark"/>
  53. <result property="fBillingDeadline" column="f_billing_deadline"/>
  54. <result property="fProductName" column="f_product_name"/>
  55. <result property="fReviewDate" column="f_review_date"/>
  56. <result property="fTruckno" column="f_truckno"/>
  57. <result property="fDriverName" column="f_driver_name"/>
  58. <result property="fDriverTel" column="f_driver_tel"/>
  59. <result property="fDriverIdCar" column="f_driver_id_car"/>
  60. <result property="fBusinessType" column="f_business_type"/>
  61. <result property="fLabour" column="f_labour"/>
  62. <result property="fFleet" column="f_fleet"/>
  63. <result property="fInwarehouseid" column="f_inwarehouseid"/>
  64. <result property="fBstime" column="f_bstime"/>
  65. <result property="fCartype" column="f_cartype"/>
  66. <result property="fGoodsid" column="f_goodsid"/>
  67. <result property="fNewTrademodeid" column="f_new_trademodeid"/>
  68. <result property="fLoadportid" column="f_loadportid"/>
  69. <result property="fDestportid" column="f_destportid"/>
  70. <result property="fServiceitems" column="f_serviceitems"/>
  71. <result property="fInvoceobj" column="f_invoceobj"/>
  72. <result property="fSign" column="f_sign"/>
  73. <result property="fDetentioncargo" column="f_detentioncargo"/>
  74. <result property="fBooksmarks" column="f_booksmarks"/>
  75. <result property="fShippername" column="f_shippername"/>
  76. <result property="fShipperattn" column="f_shipperattn"/>
  77. <result property="fShippertel" column="f_shippertel"/>
  78. <result property="fConsigneername" column="f_consigneername"/>
  79. <result property="fConsigneeattn" column="f_consigneeattn"/>
  80. <result property="fConsigneetel" column="f_consigneetel"/>
  81. <result property="fInsurance" column="f_insurance"/>
  82. <result property="fInsuranceamt" column="f_insuranceamt"/>
  83. <result property="fClosedate" column="f_closedate"/>
  84. <result property="fDocmentdate" column="f_docmentdate"/>
  85. <result property="fVslid" column="f_vslid"/>
  86. <result property="fVoyid" column="f_voyid"/>
  87. <result property="fTypeid" column="f_typeid"/>
  88. <result property="fPaymode" column="f_paymode"/>
  89. <result property="fLaneid" column="f_laneid"/>
  90. <result property="fCntval" column="f_cntval"/>
  91. <result property="freeContainerDate" column="free_container_date"/>
  92. </resultMap>
  93. <sql id="selectTWarehousebillsVo">
  94. 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,
  95. f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
  96. 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,
  97. 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,
  98. 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,
  99. f_loadportid, f_destportid, f_serviceitems, f_invoceobj, f_sign, f_detentioncargo, f_booksmarks, f_shippername, f_shipperattn, f_shippertel, f_consigneername,
  100. f_consigneeattn, f_consigneetel, f_insurance, f_insuranceamt, f_closedate, f_docmentdate, f_vslid, f_voyid, f_typeid, f_paymode, f_laneid, f_cntval,
  101. free_container_date from t_warehousebills
  102. </sql>
  103. <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  104. select
  105. ware.*
  106. from
  107. t_warehousebills ware
  108. left join sys_user u on ware.create_by = u.user_name
  109. left join sys_dept d on ware.f_bsdeptid = d.dept_id
  110. <where>
  111. ware.f_typeid IS NULL
  112. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  113. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and f_customsdeclartion =
  114. #{fCustomsdeclartion}
  115. </if>
  116. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  117. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  118. <if test="fBsdeptid != null ">and f_bsdeptid = #{fBsdeptid}</if>
  119. <if test="fInwarehouseid != null ">and f_inwarehouseid = #{fInwarehouseid}</if>
  120. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  121. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  122. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  123. <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
  124. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  125. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  126. and f_bsdate &gt;= #{timeInterval[0]}
  127. </if>
  128. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  129. and f_bsdate &lt;= #{timeInterval[1]}
  130. </if>
  131. <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
  132. <if test="fBscorpno != null and fBscorpno != ''">and f_bscorpno = #{fBscorpno}</if>
  133. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  134. <if test="fStorekeeper != null and fStorekeeper != ''">and f_storekeeper = #{fStorekeeper}</if>
  135. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  136. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  137. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  138. '%')
  139. </if>
  140. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  141. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  142. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  143. <if test="fQty != null ">and f_qty = #{fQty}</if>
  144. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  145. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  146. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  147. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  148. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  149. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  150. <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
  151. <if test="fFeetunit != null and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
  152. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  153. <if test="fVslvoy != null and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
  154. <if test="fEta != null ">and f_eta = #{fEta}</if>
  155. <if test="fCustomno != null and fCustomno != ''">and f_customno = #{fCustomno}</if>
  156. <if test="fIfweigh != null and fIfweigh != ''">and f_ifweigh = #{fIfweigh}</if>
  157. <if test="fIfpledge != null and fIfpledge != ''">and f_ifpledge = #{fIfpledge}</if>
  158. <if test="fIfdamage != null and fIfdamage != ''">and f_ifdamage = #{fIfdamage}</if>
  159. <if test="fBankcorpid != null ">and f_bankcorpid = #{fBankcorpid}</if>
  160. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  161. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  162. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  163. <if test="fNewTrademodeid != null ">and f_new_trademodeid = #{fNewTrademodeid}</if>
  164. </where>
  165. ${params.dataScope}
  166. </select>
  167. <select id="selectWarehouseBusinessList" parameterType="TWarehousebills" resultType="Map">
  168. SELECT
  169. DISTINCT
  170. bill.f_id AS fId,
  171. corp.f_name AS fCorpid,
  172. corpTo.f_name AS fTocorpid,
  173. bill.f_mblno AS fMblno,
  174. corpSub.f_name AS fSbu,
  175. bill.f_marks AS fMarks,
  176. bill.remark AS remark,
  177. bill.f_planqty AS fPlanqty,
  178. bill.f_plangrossweight AS fPlangrossweight,
  179. bill.f_plannetweight AS fPlannetweight,
  180. bill.f_planvolumn AS fPlanvolumn,
  181. bill.f_bsdate AS fBsdate,
  182. bill.f_trademodeid AS fTrademodeid,
  183. bill.f_truckno AS fTruckno,
  184. bill.f_driver_name AS fDriverName,
  185. bill.f_driver_tel AS fDriverTel,
  186. bill.f_driver_id_car AS fDriverIdCar,
  187. dictIn.dict_label AS fBusinessType,
  188. ware.f_name AS fWarehouseid,
  189. bill.f_qty AS fQty,
  190. bill.f_cntval AS fCntval,
  191. bill.f_netweight AS fNetweight,
  192. bill.create_time AS createTime,
  193. ware1.f_name AS fInwarehouseid,
  194. bill.create_by AS createBy,
  195. bill.f_grossweight AS fGrossweight,
  196. bill.f_product_name AS fProductName,
  197. bill.f_billing_deadline AS fBillingDeadline,
  198. bill.free_container_date AS freeContainerDate,
  199. CASE WHEN bill.f_billstatus = '1' THEN '录入'
  200. WHEN bill.f_billstatus = '2' THEN '暂存'
  201. WHEN bill.f_billstatus = '3' THEN '驳回'
  202. WHEN bill.f_billstatus = '4' THEN '请核'
  203. WHEN bill.f_billstatus = '5' THEN '审核中'
  204. WHEN bill.f_billstatus = '6' THEN '全部入账'
  205. END
  206. AS fBillstatus,
  207. CASE
  208. WHEN bill.f_billtype = 'SJRK'
  209. AND bill.f_items_status = '1' THEN
  210. '计划'
  211. WHEN bill.f_billtype = 'SJRK'
  212. AND bill.f_items_status = '2' THEN
  213. '待入库'
  214. WHEN bill.f_billtype = 'SJRK'
  215. AND bill.f_items_status = '3' THEN
  216. '入库中'
  217. WHEN bill.f_billtype = 'SJRK'
  218. AND bill.f_items_status = '4' THEN
  219. '已入库'
  220. WHEN bill.f_billtype = 'SJCK'
  221. AND bill.f_items_status = '1' THEN
  222. '计划'
  223. WHEN bill.f_billtype = 'SJCK'
  224. AND bill.f_items_status = '2' THEN
  225. '待出库'
  226. WHEN bill.f_billtype = 'SJCK'
  227. AND bill.f_items_status = '3' THEN
  228. '出库中'
  229. WHEN bill.f_billtype = 'SJCK'
  230. AND bill.f_items_status = '4' THEN
  231. '已出库'
  232. WHEN bill.f_billtype = 'CKDB'
  233. AND bill.f_items_status = '1' THEN
  234. '计划'
  235. WHEN bill.f_billtype = 'CKDB'
  236. AND bill.f_items_status = '2' THEN
  237. '待调拨'
  238. WHEN bill.f_billtype = 'CKDB'
  239. AND bill.f_items_status = '3' THEN
  240. '调拨中'
  241. WHEN bill.f_billtype = 'CKDB'
  242. AND bill.f_items_status = '4' THEN
  243. '已调拨'
  244. WHEN bill.f_billtype = 'HWTG'
  245. AND bill.f_items_status = '1' THEN
  246. '计划'
  247. WHEN bill.f_billtype = 'HWTG'
  248. AND bill.f_items_status = '2' THEN
  249. '待调拨'
  250. WHEN bill.f_billtype = 'HWTG'
  251. AND bill.f_items_status = '3' THEN
  252. '调拨中'
  253. WHEN bill.f_billtype = 'HWTG'
  254. AND bill.f_items_status = '4' THEN
  255. '已调拨'
  256. END AS fItemsStatus,
  257. bill.f_billno AS fBillno,
  258. g.f_name AS fGoodsid,
  259. bill.f_storekeeper AS fStorekeeper
  260. FROM
  261. t_warehousebills bill
  262. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  263. left join sys_user u on bill.create_by = u.user_name
  264. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  265. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  266. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  267. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  268. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  269. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  270. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  271. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  272. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type
  273. <where>
  274. bill.f_typeid IS NULL
  275. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  276. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  277. #{fCustomsdeclartion}
  278. </if>
  279. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  280. #{fOriginalbillno}
  281. </if>
  282. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  283. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  284. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  285. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  286. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  287. and bill.f_bsdate &gt;= #{timeInterval[0]}
  288. </if>
  289. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  290. and bill.f_bsdate &lt;= #{timeInterval[1]}
  291. </if>
  292. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  293. and bill.free_container_date &gt;= #{freeContainerList[0]}
  294. </if>
  295. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  296. and bill.free_container_date &lt;= #{freeContainerList[1]}
  297. </if>
  298. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  299. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  300. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  301. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  302. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  303. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  304. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  305. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  306. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  307. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  308. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  309. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  310. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  311. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  312. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  313. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  314. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  315. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  316. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  317. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  318. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  319. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  320. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  321. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  322. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  323. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  324. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  325. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  326. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  327. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  328. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  329. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  330. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  331. <if test="fBilltype != null">and bill.f_billtype = #{fBilltype}</if>
  332. <if test="fBilltype != null and fBilltype == 'SJRK'">
  333. AND dictIn.dict_type = 'st_in_type'
  334. AND dictIn.status = '0'
  335. </if>
  336. <if test="fBilltype != null and fBilltype == 'SJCK'">
  337. AND dictIn.dict_type = 'st_out_type'
  338. AND dictIn.status = '0'
  339. </if>
  340. <if test="fBilltype != null and fBilltype == 'CKDB'">
  341. AND dictIn.dict_type = 'st_trans_type'
  342. AND dictIn.status = '0'
  343. </if>
  344. <if test="fBilltype != null and fBilltype == 'HWTG'">
  345. AND dictIn.dict_type = 'st_trans_type'
  346. AND dictIn.status = '0'
  347. </if>
  348. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  349. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  350. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  351. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  352. </where>
  353. ${params.dataScope}
  354. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  355. </select>
  356. <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
  357. SELECT
  358. DISTINCT
  359. bill.f_id AS fId,
  360. corp.f_name AS fCorpid,
  361. corpTo.f_name AS fTocorpid,
  362. bill.f_mblno AS fMblno,
  363. corpSub.f_name AS fSbu,
  364. bill.f_marks AS fMarks,
  365. bill.remark AS remark,
  366. bill.f_planqty AS fPlanqty,
  367. bill.f_plangrossweight AS fPlangrossweight,
  368. bill.f_plannetweight AS fPlannetweight,
  369. bill.f_planvolumn AS fPlanvolumn,
  370. bill.f_bsdate AS fBsdate,
  371. dict.dict_label AS fTrademodeid,
  372. bill.f_truckno AS fTruckno,
  373. bill.f_driver_name AS fDriverName,
  374. bill.f_driver_tel AS fDriverTel,
  375. bill.f_driver_id_car AS fDriverIdCar,
  376. ware.f_name AS fWarehouseid,
  377. bill.f_qty AS fQty,
  378. bill.f_cntval AS fCntval,
  379. bill.f_netweight AS fNetweight,
  380. bill.create_time AS createTime,
  381. ware1.f_name AS fInwarehouseid,
  382. bill.create_by AS createBy,
  383. bill.f_grossweight AS fGrossweight,
  384. bill.f_product_name AS fProductName,
  385. bill.f_billing_deadline AS fBillingDeadline,
  386. bill.free_container_date AS freeContainerDate,
  387. CASE
  388. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
  389. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
  390. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
  391. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
  392. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
  393. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
  394. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
  395. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
  396. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
  397. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
  398. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
  399. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
  400. END
  401. AS fBillstatus,
  402. CASE
  403. WHEN bill.f_billtype = 'HQZY'
  404. AND bill.f_items_status = '1' THEN
  405. '计划'
  406. WHEN bill.f_billtype = 'HQZY'
  407. AND bill.f_items_status = '2' THEN
  408. '待货转'
  409. WHEN bill.f_billtype = 'HQZY'
  410. AND bill.f_items_status = '3' THEN
  411. '货转中'
  412. WHEN bill.f_billtype = 'HQZY'
  413. AND bill.f_items_status = '4' THEN
  414. '已货转'
  415. END
  416. AS fItemsStatus,
  417. bill.f_billno AS fBillno,
  418. g.f_name AS fGoodsid,
  419. bill.f_storekeeper AS fStorekeeper
  420. FROM
  421. t_warehousebills bill
  422. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  423. left join sys_user u on bill.create_by = u.user_name
  424. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  425. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  426. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  427. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  428. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  429. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  430. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  431. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  432. LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
  433. <where>
  434. dict.status = '0'
  435. AND dict.dict_type = 'data_trademodes'
  436. AND bill.f_typeid IS NULL
  437. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  438. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  439. #{fCustomsdeclartion}
  440. </if>
  441. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  442. #{fOriginalbillno}
  443. </if>
  444. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  445. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  446. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  447. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  448. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  449. and bill.f_bsdate &gt;= #{timeInterval[0]}
  450. </if>
  451. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  452. and bill.f_bsdate &lt;= #{timeInterval[1]}
  453. </if>
  454. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  455. and bill.free_container_date &gt;= #{freeContainerList[0]}
  456. </if>
  457. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  458. and bill.free_container_date &lt;= #{freeContainerList[1]}
  459. </if>
  460. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  461. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  462. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  463. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  464. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  465. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  466. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  467. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  468. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  469. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  470. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  471. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  472. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  473. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  474. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  475. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  476. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  477. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  478. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  479. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  480. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  481. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  482. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  483. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  484. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  485. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  486. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  487. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  488. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  489. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  490. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  491. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  492. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  493. <if test="fBilltype != null and fBilltype != ''">
  494. and bill.f_billtype = #{fBilltype}
  495. </if>
  496. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  497. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  498. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  499. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  500. </where>
  501. ${params.dataScope}
  502. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  503. </select>
  504. <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
  505. <include refid="selectTWarehousebillsVo"/>
  506. where f_id = #{fId}
  507. ORDER BY f_bsdate desc
  508. </select>
  509. <select id="selectTWarehousebillsItemsList"
  510. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems">
  511. SELECT (@ii := @ii + 1) AS fId,
  512. CASE
  513. wi.f_billtype
  514. WHEN 'SJRK' THEN
  515. '入库'
  516. WHEN 'SJCK' THEN
  517. '出库'
  518. WHEN 'KCZZ' THEN
  519. '库存总账'
  520. END AS fBilltype,
  521. wi.f_mblno AS fMblno,
  522. wi.f_product_name AS fGoodsid,
  523. wi.f_marks AS fMarks,
  524. wi.f_bsdate AS fBsdate,
  525. dict.dict_label AS fFeeUnitid,
  526. wi.f_billing_qty AS fBillingQty,
  527. wi.f_chargedate AS fChargedate,
  528. wi.f_billing_deadline AS fBillingDeadline,
  529. wi.f_billing_days AS fBillingDays,
  530. wi.f_inventory_days AS fInventoryDays,
  531. wi.f_amt AS fAmt,
  532. wi.remark AS remark
  533. FROM t_warehousebills w
  534. LEFT JOIN t_warehousebillsfees wi ON w.f_id = wi.f_pid
  535. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  536. , (
  537. SELECT @ii := 0
  538. ) AS ii
  539. WHERE w.f_id = #{fId}
  540. AND w.f_typeid IS NULL
  541. AND dict.status = '0'
  542. AND dict.dict_type = 'data_unitfees'
  543. </select>
  544. <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
  545. SELECT
  546. co.f_name AS fName,
  547. it.f_bsdate AS fBsdate,
  548. leg.f_mblno AS fMblno,
  549. it.f_business_type AS fBusinessType,
  550. dict.dict_label AS fBusinessTypes,
  551. it.f_marks AS fMarks ,
  552. goo.f_name AS fGoodsName,
  553. it.f_warehouse_information AS fWarehouseLocationids,
  554. dicttr.dict_label AS fTrademodeid,
  555. it.f_qty AS fQty,
  556. it.f_grossweight AS fGrossweight,
  557. it.f_netweight AS fNetweight,
  558. CASE
  559. it.f_billtype
  560. WHEN 'SJRK' THEN
  561. '入库'
  562. WHEN 'SJCK' THEN
  563. '出库'
  564. WHEN 'CKDB' THEN
  565. '调拨'
  566. END AS fBilltype
  567. FROM
  568. t_warehousebills leg
  569. left join sys_user u on leg.create_by = u.user_name
  570. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  571. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  572. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  573. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  574. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  575. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  576. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  577. <where>
  578. dict.status = '0'
  579. AND leg.f_typeid IS NULL
  580. AND dict.dict_type = 'storage_type'
  581. AND dicttr.STATUS = '0'
  582. AND dicttr.dict_type = 'data_trademodes'
  583. AND leg.f_billtype in ('SJRK','CKDB')
  584. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  585. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  586. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  587. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  588. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  589. <if test="fLocation != null and fLocation ==1 ">
  590. and it.f_warehouselocid = #{fWarehouseid}
  591. </if>
  592. <if test="fLocation != null and fLocation ==0 ">
  593. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  594. </if>
  595. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  596. and it.f_bsdate &gt;= #{timeInterval[0]}
  597. </if>
  598. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  599. and it.f_bsdate &lt;= #{timeInterval[1]}
  600. </if>
  601. </where>
  602. ${params.dataScope}
  603. </select>
  604. <select id="selectInventorySJCKList" parameterType="TWarehousebills" resultType="java.util.Map">
  605. SELECT
  606. co.f_name AS fName,
  607. it.f_bsdate AS fBsdate,
  608. leg.f_mblno AS fMblno,
  609. it.f_business_type AS fBusinessType,
  610. dict.dict_label AS fBusinessTypes,
  611. it.f_marks AS fMarks ,
  612. goo.f_name AS fGoodsName,
  613. dicttr.dict_label AS fTrademodeid,
  614. it.f_qty AS fQty,
  615. it.f_grossweight AS fGrossweight,
  616. it.f_netweight AS fNetweight,
  617. CASE
  618. it.f_billtype
  619. WHEN 'SJRK' THEN
  620. '入库'
  621. WHEN 'SJCK' THEN
  622. '出库'
  623. WHEN 'CKDB' THEN
  624. '调拨'
  625. END AS fBilltype ,
  626. CASE
  627. it.f_billtype
  628. WHEN 'SJRK' THEN
  629. it.f_warehouse_information
  630. WHEN 'SJCK' THEN
  631. it.f_warehouse_information
  632. WHEN 'CKDB' THEN
  633. it.f_orgwarehouse_information
  634. END AS fWarehouseLocationids
  635. FROM
  636. t_warehousebills leg
  637. left join sys_user u on leg.create_by = u.user_name
  638. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  639. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  640. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  641. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  642. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  643. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  644. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  645. <where>
  646. dict.status = '0'
  647. AND leg.f_typeid IS NULL
  648. AND dict.dict_type = 'storage_type'
  649. AND dicttr.STATUS = '0'
  650. AND dicttr.dict_type = 'data_trademodes'
  651. AND leg.f_billtype in ('SJCK','CKDB')
  652. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  653. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  654. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  655. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  656. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  657. <if test="fLocation != null and fLocation ==1 ">
  658. and it.f_warehouselocid = #{fWarehouseid}
  659. </if>
  660. <if test="fLocation != null and fLocation ==0 ">
  661. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  662. </if>
  663. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  664. and it.f_bsdate &gt;= #{timeInterval[0]}
  665. </if>
  666. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  667. and it.f_bsdate &lt;= #{timeInterval[1]}
  668. </if>
  669. </where>
  670. ${params.dataScope}
  671. </select>
  672. <select id="selectTWarehousebillsItemList"
  673. resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
  674. SELECT
  675. ( @ii := @ii + 1 ) AS fId,
  676. co.f_name AS fCorpid,
  677. it.f_bsdate AS fBsdate,
  678. leg.f_mblno AS fMblno,
  679. dict.dict_label AS fBusinessType,
  680. it.f_marks AS fMarks,
  681. go.f_name AS fGoodsid,
  682. it.f_warehouse_information AS fWarehouseInformation,
  683. dicttr.dict_label AS fTrademodeid,
  684. it.f_qty AS fQty,
  685. it.f_grossweight AS fGrossweight,
  686. it.f_netweight AS fNetweight
  687. FROM
  688. t_warehousebills leg
  689. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  690. LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
  691. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  692. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  693. LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
  694. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
  695. SELECT
  696. @ii := 0
  697. ) AS ii
  698. WHERE
  699. dict.STATUS = '0'
  700. AND leg.f_typeid IS NULL
  701. AND dict.dict_type = 'storage_type'
  702. AND dicttr.STATUS = '0'
  703. AND dicttr.dict_type = 'data_trademodes'
  704. AND leg.f_billtype IN (
  705. 'SJRk',
  706. 'SJCK'
  707. )
  708. <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
  709. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  710. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  711. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  712. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  713. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  714. <if test="fLocation != null and fLocation ==1 ">
  715. and it.f_warehouselocid = #{fWarehouseid}
  716. </if>
  717. <if test="fLocation != null and fLocation ==0 ">
  718. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  719. </if>
  720. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  721. and it.f_bsdate &gt;= #{timeInterval[0]}
  722. </if>
  723. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  724. and it.f_bsdate &lt;= #{timeInterval[1]}
  725. </if>
  726. </select>
  727. <select id="selectContainMblno" parameterType="TWarehousebills" resultType="int">
  728. SELECT
  729. count( f_id )
  730. FROM
  731. t_warehousebills
  732. where
  733. f_mblno = #{fMblno}
  734. AND f_bsdate = #{fBsdate}
  735. AND f_billtype = #{fBilltype}
  736. </select>
  737. <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
  738. insert into t_warehousebills
  739. <trim prefix="(" suffix=")" suffixOverrides=",">
  740. <if test="fBillno != null">f_billno,</if>
  741. <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
  742. <if test="fOriginalbillno != null">f_originalbillno,</if>
  743. <if test="fDeptid != null">f_deptid,</if>
  744. <if test="fBsdeptid != null">f_bsdeptid,</if>
  745. <if test="fContacts != null">f_contacts,</if>
  746. <if test="fTel != null">f_tel,</if>
  747. <if test="fCorpid != null">f_corpid,</if>
  748. <if test="fTocorpid != null">f_tocorpid,</if>
  749. <if test="fStltypeid != null">f_stltypeid,</if>
  750. <if test="fBscorpno != null">f_bscorpno,</if>
  751. <if test="fWarehouseid != null">f_warehouseid,</if>
  752. <if test="fStorekeeper != null">f_storekeeper,</if>
  753. <if test="fChargedate != null">f_chargedate,</if>
  754. <if test="fBsdate != null">f_bsdate,</if>
  755. <if test="fPlanqty != null">f_planqty,</if>
  756. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  757. <if test="fPlannetweight != null">f_plannetweight,</if>
  758. <if test="fPlanvolumn != null">f_planvolumn,</if>
  759. <if test="fQty != null">f_qty,</if>
  760. <if test="fGrossweight != null">f_grossweight,</if>
  761. <if test="fNetweight != null">f_netweight,</if>
  762. <if test="fVolumn != null">f_volumn,</if>
  763. <if test="fBillingway != null">f_billingway,</if>
  764. <if test="fTrademodeid != null">f_trademodeid,</if>
  765. <if test="fSbu != null">f_sbu,</if>
  766. <if test="fFeetunit != null">f_feetunit,</if>
  767. <if test="fMblno != null">f_mblno,</if>
  768. <if test="fMarks != null">f_marks,</if>
  769. <if test="fVslvoy != null">f_vslvoy,</if>
  770. <if test="fEta != null">f_eta,</if>
  771. <if test="fCustomno != null">f_customno,</if>
  772. <if test="fIfweigh != null">f_ifweigh,</if>
  773. <if test="fIfpledge != null">f_ifpledge,</if>
  774. <if test="fIfdamage != null">f_ifdamage,</if>
  775. <if test="fBankcorpid != null">f_bankcorpid,</if>
  776. <if test="fBilltype != null">f_billtype,</if>
  777. <if test="fBillstatus != null">f_billstatus,</if>
  778. <if test="fItemsStatus != null">f_items_status,</if>
  779. <if test="delFlag != null">del_flag,</if>
  780. <if test="createBy != null">create_by,</if>
  781. <if test="createTime != null">create_time,</if>
  782. <if test="updateBy != null">update_by,</if>
  783. <if test="updateTime != null">update_time,</if>
  784. <if test="remark != null">remark,</if>
  785. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  786. <if test="fProductName != null">f_product_name,</if>
  787. <if test="fReviewDate != null">f_review_date,</if>
  788. <if test="fTruckno != null">f_truckno,</if>
  789. <if test="fDriverName != null">f_driver_name,</if>
  790. <if test="fDriverTel != null">f_driver_tel,</if>
  791. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  792. <if test="fBusinessType != null">f_business_type,</if>
  793. <if test="fLabour != null">f_labour,</if>
  794. <if test="fFleet != null">f_fleet,</if>
  795. <if test="fInwarehouseid != null">f_inwarehouseid,</if>
  796. <if test="fBstime != null">f_bstime,</if>
  797. <if test="fCartype != null">f_cartype,</if>
  798. <if test="fGoodsid != null">f_goodsid,</if>
  799. <if test="fNewTrademodeid != null">f_new_trademodeid,</if>
  800. <if test="fLoadportid != null">f_loadportid,</if>
  801. <if test="fDestportid != null">f_destportid,</if>
  802. <if test="fServiceitems != null">f_serviceitems,</if>
  803. <if test="fInvoceobj != null">f_invoceobj,</if>
  804. <if test="fSign != null">f_sign,</if>
  805. <if test="fDetentioncargo != null">f_detentioncargo,</if>
  806. <if test="fBooksmarks != null">f_booksmarks,</if>
  807. <if test="fShippername != null">f_shippername,</if>
  808. <if test="fShipperattn != null">f_shipperattn,</if>
  809. <if test="fShippertel != null">f_shippertel,</if>
  810. <if test="fConsigneername != null">f_consigneername,</if>
  811. <if test="fConsigneeattn != null">f_consigneeattn,</if>
  812. <if test="fConsigneetel != null">f_consigneetel,</if>
  813. <if test="fInsurance != null">f_insurance,</if>
  814. <if test="fInsuranceamt != null">f_insuranceamt,</if>
  815. <if test="fClosedate != null">f_closedate,</if>
  816. <if test="fDocmentdate != null">f_docmentdate,</if>
  817. <if test="fVslid != null">f_vslid,</if>
  818. <if test="fVoyid != null">f_voyid,</if>
  819. <if test="fTypeid != null">f_typeid,</if>
  820. <if test="fPaymode != null">f_paymode,</if>
  821. <if test="fLaneid != null">f_laneid,</if>
  822. <if test="fCntval != null">f_cntval,</if>
  823. <if test="freeContainerDate != null">free_container_date,</if>
  824. </trim>
  825. <trim prefix="values (" suffix=")" suffixOverrides=",">
  826. <if test="fBillno != null">#{fBillno},</if>
  827. <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
  828. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  829. <if test="fDeptid != null">#{fDeptid},</if>
  830. <if test="fBsdeptid != null">#{fBsdeptid},</if>
  831. <if test="fContacts != null">#{fContacts},</if>
  832. <if test="fTel != null">#{fTel},</if>
  833. <if test="fCorpid != null">#{fCorpid},</if>
  834. <if test="fTocorpid != null">#{fTocorpid},</if>
  835. <if test="fStltypeid != null">#{fStltypeid},</if>
  836. <if test="fBscorpno != null">#{fBscorpno},</if>
  837. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  838. <if test="fStorekeeper != null">#{fStorekeeper},</if>
  839. <if test="fChargedate != null">#{fChargedate},</if>
  840. <if test="fBsdate != null">#{fBsdate},</if>
  841. <if test="fPlanqty != null">#{fPlanqty},</if>
  842. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  843. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  844. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  845. <if test="fQty != null">#{fQty},</if>
  846. <if test="fGrossweight != null">#{fGrossweight},</if>
  847. <if test="fNetweight != null">#{fNetweight},</if>
  848. <if test="fVolumn != null">#{fVolumn},</if>
  849. <if test="fBillingway != null">#{fBillingway},</if>
  850. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  851. <if test="fSbu != null">#{fSbu},</if>
  852. <if test="fFeetunit != null">#{fFeetunit},</if>
  853. <if test="fMblno != null">#{fMblno},</if>
  854. <if test="fMarks != null">#{fMarks},</if>
  855. <if test="fVslvoy != null">#{fVslvoy},</if>
  856. <if test="fEta != null">#{fEta},</if>
  857. <if test="fCustomno != null">#{fCustomno},</if>
  858. <if test="fIfweigh != null">#{fIfweigh},</if>
  859. <if test="fIfpledge != null">#{fIfpledge},</if>
  860. <if test="fIfdamage != null">#{fIfdamage},</if>
  861. <if test="fBankcorpid != null">#{fBankcorpid},</if>
  862. <if test="fBilltype != null">#{fBilltype},</if>
  863. <if test="fBillstatus != null">#{fBillstatus},</if>
  864. <if test="fItemsStatus != null">#{fItemsStatus},</if>
  865. <if test="delFlag != null">#{delFlag},</if>
  866. <if test="createBy != null">#{createBy},</if>
  867. <if test="createTime != null">#{createTime},</if>
  868. <if test="updateBy != null">#{updateBy},</if>
  869. <if test="updateTime != null">#{updateTime},</if>
  870. <if test="remark != null">#{remark},</if>
  871. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  872. <if test="fProductName != null">#{fProductName},</if>
  873. <if test="fReviewDate != null">#{fReviewDate},</if>
  874. <if test="fTruckno != null">#{fTruckno},</if>
  875. <if test="fDriverName != null">#{fDriverName},</if>
  876. <if test="fDriverTel != null">#{fDriverTel},</if>
  877. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  878. <if test="fBusinessType != null">#{fBusinessType},</if>
  879. <if test="fLabour != null">#{fLabour},</if>
  880. <if test="fFleet != null">#{fFleet},</if>
  881. <if test="fInwarehouseid != null">#{fInwarehouseid},</if>
  882. <if test="fBstime != null">#{fBstime},</if>
  883. <if test="fCartype != null">#{fCartype},</if>
  884. <if test="fGoodsid != null">#{fGoodsid},</if>
  885. <if test="fNewTrademodeid != null">#{fNewTrademodeid},</if>
  886. <if test="fLoadportid != null">#{fLoadportid},</if>
  887. <if test="fDestportid != null">#{fDestportid},</if>
  888. <if test="fServiceitems != null">#{fServiceitems},</if>
  889. <if test="fInvoceobj != null">#{fInvoceobj},</if>
  890. <if test="fSign != null">#{fSign},</if>
  891. <if test="fDetentioncargo != null">#{fDetentioncargo},</if>
  892. <if test="fBooksmarks != null">#{fBooksmarks},</if>
  893. <if test="fShippername != null">#{fShippername},</if>
  894. <if test="fShipperattn != null">#{fShipperattn},</if>
  895. <if test="fShippertel != null">#{fShippertel},</if>
  896. <if test="fConsigneername != null">#{fConsigneername},</if>
  897. <if test="fConsigneeattn != null">#{fConsigneeattn},</if>
  898. <if test="fConsigneetel != null">#{fConsigneetel},</if>
  899. <if test="fInsurance != null">#{fInsurance},</if>
  900. <if test="fInsuranceamt != null">#{fInsuranceamt},</if>
  901. <if test="fClosedate != null">#{fClosedate},</if>
  902. <if test="fDocmentdate != null">#{fDocmentdate},</if>
  903. <if test="fVslid != null">#{fVslid},</if>
  904. <if test="fVoyid != null">#{fVoyid},</if>
  905. <if test="fTypeid != null">#{fTypeid},</if>
  906. <if test="fPaymode != null">#{fPaymode},</if>
  907. <if test="fLaneid != null">#{fLaneid},</if>
  908. <if test="fCntval != null">#{fCntval},</if>
  909. <if test="freeContainerDate != null">#{freeContainerDate},</if>
  910. </trim>
  911. </insert>
  912. <update id="updateTWarehousebills" parameterType="TWarehousebills">
  913. update t_warehousebills
  914. <trim prefix="SET" suffixOverrides=",">
  915. <if test="fBillno != null">f_billno = #{fBillno},</if>
  916. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  917. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  918. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  919. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  920. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  921. <if test="fTel != null">f_tel = #{fTel},</if>
  922. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  923. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  924. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  925. <if test="fBscorpno != null">f_bscorpno = #{fBscorpno},</if>
  926. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  927. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  928. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  929. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  930. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  931. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  932. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  933. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  934. <if test="fQty != null">f_qty = #{fQty},</if>
  935. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  936. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  937. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  938. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  939. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  940. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  941. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  942. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  943. <if test="fMarks != null">f_marks = #{fMarks},</if>
  944. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  945. <if test="fEta != null">f_eta = #{fEta},</if>
  946. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  947. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  948. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  949. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  950. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  951. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  952. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  953. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  954. <if test="delFlag != null">del_flag = #{delFlag},</if>
  955. <if test="createBy != null">create_by = #{createBy},</if>
  956. <if test="createTime != null">create_time = #{createTime},</if>
  957. <if test="updateBy != null">update_by = #{updateBy},</if>
  958. <if test="updateTime != null">update_time = #{updateTime},</if>
  959. <if test="remark != null">remark = #{remark},</if>
  960. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  961. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  962. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  963. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  964. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  965. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  966. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  967. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  968. <if test="fLabour != null">f_labour = #{fLabour},</if>
  969. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  970. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  971. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  972. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  973. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  974. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  975. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  976. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  977. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  978. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  979. <if test="fSign != null">f_sign = #{fSign},</if>
  980. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  981. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  982. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  983. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  984. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  985. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  986. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  987. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  988. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  989. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  990. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  991. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  992. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  993. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  994. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  995. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  996. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  997. <if test="fCntval != null">f_cntval = #{fCntval},</if>
  998. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  999. </trim>
  1000. where f_id = #{fId}
  1001. </update>
  1002. <update id="updateKaHeOrder" parameterType="TWarehousebills">
  1003. update t_warehousebills
  1004. <trim prefix="SET" suffixOverrides=",">
  1005. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1006. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1007. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1008. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1009. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1010. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1011. <if test="fTel != null">f_tel = #{fTel},</if>
  1012. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1013. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1014. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1015. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
  1016. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1017. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1018. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1019. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1020. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1021. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1022. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1023. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1024. <if test="fQty != null">f_qty = #{fQty},</if>
  1025. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1026. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1027. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1028. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1029. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1030. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1031. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1032. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1033. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1034. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  1035. <if test="fEta != null">f_eta = #{fEta},</if>
  1036. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1037. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1038. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1039. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1040. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1041. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1042. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1043. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1044. <if test="createBy != null">create_by = #{createBy},</if>
  1045. <if test="createTime != null">create_time = #{createTime},</if>
  1046. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1047. <if test="updateBy != null">update_by = #{updateBy},</if>
  1048. <if test="updateTime != null">update_time = #{updateTime},</if>
  1049. <if test="remark != null">remark = #{remark},</if>
  1050. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1051. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1052. <if test="fReviewDate != null and fBillstatus == 11" >f_review_date = #{fReviewDate},</if>
  1053. <if test="fReviewDate != null and fBillstatus != 11">f_review_date = null,</if>
  1054. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1055. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1056. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1057. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1058. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1059. <if test="fReviewDate == null">f_review_date = null,</if>
  1060. <if test="fLabour != null">f_labour = #{fLabour },</if>
  1061. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1062. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1063. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1064. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1065. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1066. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1067. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1068. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1069. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1070. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1071. <if test="fSign != null">f_sign = #{fSign},</if>
  1072. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1073. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1074. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1075. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1076. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1077. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1078. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1079. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1080. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1081. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1082. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1083. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1084. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1085. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1086. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1087. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1088. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1089. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  1090. </trim>
  1091. where f_id = #{fId}
  1092. </update>
  1093. <delete id="deleteTWarehousebillsById" parameterType="Long">
  1094. delete
  1095. from t_warehousebills
  1096. where f_id = #{fId}
  1097. </delete>
  1098. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  1099. delete
  1100. item.*,
  1101. bill.*,
  1102. fess.*,
  1103. enclosure.*
  1104. from
  1105. t_warehousebills bill
  1106. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  1107. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  1108. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1109. where
  1110. bill.f_id in
  1111. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1112. #{fId}
  1113. </foreach>
  1114. </delete>
  1115. <delete id="deleteKHTWarehousebillsByIds" parameterType="String">
  1116. delete
  1117. bill.*,
  1118. fess.*,
  1119. enclosure.*
  1120. from
  1121. t_warehousebills bill
  1122. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1123. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1124. where
  1125. bill.f_id in
  1126. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1127. #{fId}
  1128. </foreach>
  1129. </delete>
  1130. <update id="warehouseFollowUpdate">
  1131. update
  1132. t_warehousebills
  1133. <trim prefix="SET" suffixOverrides=",">
  1134. <if test="fettle != null">f_billstatus = #{fettle},</if>
  1135. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  1136. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  1137. </trim>
  1138. where f_id = #{fPid}
  1139. </update>
  1140. <select id="selectDetailedList" resultType="java.util.Map">
  1141. SELECT
  1142. t.f_id AS fId,
  1143. item.f_id AS fItemsId,
  1144. C.f_name AS fcorpid,
  1145. t.f_mblno AS fMblno,
  1146. g.f_name AS fGoodsid,
  1147. dict.dict_label AS fBusinessType,
  1148. t.f_marks AS fMarks,
  1149. CASE
  1150. WHEN t.f_billtype = 'SJRK' THEN
  1151. '入库'
  1152. WHEN t.f_billtype = 'SJCK' THEN
  1153. '出库'
  1154. WHEN t.f_billtype = 'CKDB' THEN
  1155. '调拨'
  1156. WHEN t.f_billtype = 'HQZY' THEN
  1157. '货权转移'
  1158. WHEN t.f_billtype = 'HWTG' THEN
  1159. '货物通关'
  1160. END AS fBilltype,
  1161. item.f_bsdate AS fBsdate,
  1162. item.f_warehouse_information AS fWarehouseInformation,
  1163. dictTra.dict_label AS fTrademodeid,
  1164. CASE
  1165. WHEN t.f_billtype = 'SJRK' THEN
  1166. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1167. END AS fQtyRK,
  1168. CASE
  1169. WHEN t.f_billtype = 'SJRK' THEN
  1170. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1171. END AS fGrossweightRK,
  1172. CASE
  1173. WHEN t.f_billtype = 'SJRK' THEN
  1174. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1175. END AS fNetweightRK,
  1176. CASE
  1177. WHEN t.f_billtype = 'SJCK' THEN
  1178. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1179. END AS fQtyCK,
  1180. CASE
  1181. WHEN t.f_billtype = 'SJCK' THEN
  1182. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1183. END AS fGrossweightCK,
  1184. CASE
  1185. WHEN t.f_billtype = 'SJCK' THEN
  1186. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1187. END AS fNetweightCK,
  1188. CASE
  1189. WHEN t.f_billtype = 'CKDB' THEN
  1190. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1191. END AS fQtyDB,
  1192. CASE
  1193. WHEN t.f_billtype = 'CKDB' THEN
  1194. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1195. END AS fGrossweightDB,
  1196. CASE
  1197. WHEN t.f_billtype = 'CKDB' THEN
  1198. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1199. END AS fNetweightDB,
  1200. CASE
  1201. WHEN t.f_billtype = 'HQZY' THEN
  1202. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1203. END AS fQtyHZ,
  1204. CASE
  1205. WHEN t.f_billtype = 'HQZY' THEN
  1206. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1207. END AS fGrossweightHZ,
  1208. CASE
  1209. WHEN t.f_billtype = 'HQZY' THEN
  1210. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1211. END AS fNetweightHZ,
  1212. CASE
  1213. WHEN t.f_billtype = 'HWTG' THEN
  1214. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1215. END AS fQtyTG,
  1216. CASE
  1217. WHEN t.f_billtype = 'HWTG' THEN
  1218. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1219. END AS fGrossweightTG,
  1220. CASE
  1221. WHEN t.f_billtype = 'HWTG' THEN
  1222. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1223. END AS fNetweightTG
  1224. FROM t_warehousebills t
  1225. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1226. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1227. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1228. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1229. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1230. WHERE dict.STATUS = '0'
  1231. AND t.f_typeid IS NULL
  1232. AND dict.dict_type = 'storage_type'
  1233. AND dictTra.STATUS = '0'
  1234. AND dictTra.dict_type = 'data_trademodes'
  1235. AND item.f_billstatus = 40
  1236. AND item.f_mblno = #{fMblno}
  1237. AND (item.f_warehouselocid = #{fWarehouseLocationid} or
  1238. item.f_transfer_warehouselocid = #{fWarehouseLocationid})
  1239. AND t.f_trademodeid = #{fTrademodeids}
  1240. AND item.f_business_type = #{fBusinessType}
  1241. AND item.f_goodsid = #{fGoodsid}
  1242. AND item.f_marks = #{fMarks}
  1243. AND t.f_corpid = #{fCorpIds}
  1244. GROUP BY t.f_id
  1245. </select>
  1246. <select id="webVersionOrderList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1247. SELECT
  1248. tw.f_id,
  1249. tw.f_billno,
  1250. tw.f_customsdeclartion,
  1251. tw.f_originalbillno,
  1252. tw.f_deptid,
  1253. tw.f_bsdeptid,
  1254. tw.f_contacts,
  1255. tw.f_tel,
  1256. tw.f_corpid,
  1257. tc.f_name corpName,
  1258. tw.f_tocorpid,
  1259. tw.f_stltypeid,
  1260. tw.f_bscorpno,
  1261. tw.f_warehouseid,
  1262. tw.f_storekeeper,
  1263. tw.f_chargedate,
  1264. tw.f_bsdate,
  1265. tw.f_planqty,
  1266. tw.f_plangrossweight,
  1267. tw.f_plannetweight,
  1268. tw.f_planvolumn,
  1269. tw.f_qty,
  1270. tw.f_grossweight,
  1271. tw.f_netweight,
  1272. tw.f_volumn,
  1273. tw.f_billingway,
  1274. tw.f_trademodeid,
  1275. tw.f_sbu,
  1276. tw.f_feetunit,
  1277. tw.f_mblno,
  1278. tw.f_marks,
  1279. tw.f_vslvoy,
  1280. tw.f_eta,
  1281. tw.f_customno,
  1282. tw.f_ifweigh,
  1283. tw.f_ifpledge,
  1284. tw.f_ifdamage,
  1285. tw.f_bankcorpid,
  1286. tw.f_billtype,
  1287. tw.f_billstatus,
  1288. tw.f_items_status,
  1289. tw.del_flag,
  1290. tw.create_by,
  1291. tw.create_time,
  1292. tw.update_by,
  1293. tw.update_time,
  1294. tw.remark,
  1295. tw.f_billing_deadline,
  1296. tw.f_product_name,
  1297. tw.f_review_date,
  1298. tw.f_truckno,
  1299. tw.f_driver_name,
  1300. tw.f_driver_tel,
  1301. tw.f_driver_id_car,
  1302. tw.f_business_type,
  1303. tw.f_labour,
  1304. tw.f_fleet,
  1305. tw.f_inwarehouseid,
  1306. tw.f_bstime,
  1307. tw.f_cartype,
  1308. tw.f_goodsid,
  1309. tw.f_new_trademodeid,
  1310. tw.f_loadportid,
  1311. address.f_name loadportidName,
  1312. tw.f_destportid,
  1313. ta.f_name destportidName,
  1314. tw.f_serviceitems,
  1315. sd.dict_label serviceitemsName,
  1316. tw.f_invoceobj,
  1317. sdi.dict_label invoceobjName,
  1318. tw.f_sign,
  1319. sdc.dict_label signName,
  1320. tw.f_detentioncargo,
  1321. sdt.dict_label detentioncargoName,
  1322. tw.f_booksmarks,
  1323. tw.f_shippername,
  1324. tw.f_shipperattn,
  1325. tw.f_shippertel,
  1326. tw.f_consigneername,
  1327. tw.f_consigneeattn,
  1328. tw.f_consigneetel,
  1329. tw.f_insurance,
  1330. sdd.dict_label insuranceName,
  1331. tw.f_insuranceamt,
  1332. tw.f_closedate,
  1333. tw.f_docmentdate,
  1334. tw.f_vslid,
  1335. tv.f_name vslidName,
  1336. tw.f_voyid,
  1337. ty.f_no voyidName,
  1338. tw.f_typeid,
  1339. tw.f_paymode,
  1340. sda.dict_label paymodeName,
  1341. tw.f_laneid,
  1342. tr.f_name laneidName
  1343. FROM t_warehousebills tw
  1344. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1345. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1346. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1347. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1348. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1349. AND sd.dict_type = 'f_serviceitems'
  1350. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1351. AND sdi.dict_type = 'f_invoceobj'
  1352. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1353. AND sdc.dict_type = 'f_sign'
  1354. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1355. AND sdt.dict_type = 'f_detentioncargo'
  1356. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1357. AND sdd.dict_type = 'f_insurance'
  1358. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1359. AND sda.dict_type = 'f_paymode'
  1360. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1361. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1362. <where>
  1363. tw.f_typeid = '1'
  1364. <if test="fId != null">and tw.f_id = #{fId}</if>
  1365. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1366. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =#{fCustomsdeclartion}</if>
  1367. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}</if>
  1368. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1369. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1370. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1371. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1372. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1373. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1374. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1375. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1376. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1377. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1378. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1379. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1380. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1381. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1382. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1383. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1384. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1385. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1386. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1387. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1388. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1389. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1390. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1391. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1392. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1393. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1394. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1395. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1396. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1397. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1398. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1399. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1400. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1401. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1402. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1403. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1404. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1405. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1406. #{fProductName}, '%')
  1407. </if>
  1408. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1409. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1410. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1411. '%')
  1412. </if>
  1413. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1414. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1415. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1416. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1417. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1418. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1419. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1420. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1421. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1422. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1423. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1424. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1425. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1426. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1427. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1428. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1429. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1430. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1431. #{fShippername}, '%')
  1432. </if>
  1433. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1434. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1435. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1436. #{fConsigneername}, '%')
  1437. </if>
  1438. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1439. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1440. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1441. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1442. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1443. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1444. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1445. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1446. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1447. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1448. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1449. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1450. and tw.create_time &gt;= #{timeInterval[0]}
  1451. </if>
  1452. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1453. and tw.create_time &lt;= #{timeInterval[1]}
  1454. </if>
  1455. </where>
  1456. ORDER BY tw.create_time DESC, tw.f_id DESC
  1457. </select>
  1458. <select id="ruoYiVersionOrderList" parameterType="TWarehousebills" resultType="map">
  1459. SELECT
  1460. tw.f_id fId,
  1461. tw.f_billno fBillno,
  1462. tw.f_mblno fMblno,
  1463. sd.dict_label fServiceitems,
  1464. tw.f_consigneername fConsigneername,
  1465. ta.f_name fName,
  1466. tw.f_bsdate fBsdate,
  1467. tc.f_cntrcount fCntrcount,
  1468. tc.f_no fNo,
  1469. tv.f_name vslName,
  1470. ty.f_no voyNo,
  1471. tw.f_corpid,
  1472. tp.f_name corpName,
  1473. tw.create_by createBy,
  1474. tw.create_time createTime,
  1475. tw.f_loadportid,
  1476. tre.f_name loadportName,
  1477. tw.f_destportid,
  1478. ts.f_name destportName,
  1479. tc.f_name goodsName,
  1480. CASE
  1481. WHEN tw.f_billstatus = '1' THEN
  1482. '下单新建'
  1483. WHEN tw.f_billstatus = '2' THEN
  1484. '下单暂存'
  1485. WHEN tw.f_billstatus = '3' THEN
  1486. '下单驳回'
  1487. WHEN tw.f_billstatus = '4' THEN
  1488. '下单提交'
  1489. WHEN tw.f_billstatus = '5' THEN
  1490. '下单审批中'
  1491. WHEN tw.f_billstatus = '6' THEN
  1492. '下单审批通过'
  1493. WHEN tw.f_billstatus = '7' THEN
  1494. '配船暂存'
  1495. WHEN tw.f_billstatus = '8' THEN
  1496. '配船驳回'
  1497. WHEN tw.f_billstatus = '9' THEN
  1498. '配船提交'
  1499. WHEN tw.f_billstatus = '10' THEN
  1500. '配船审批中'
  1501. WHEN tw.f_billstatus = '11' THEN
  1502. '配船审批通过'
  1503. WHEN tw.f_billstatus = '12' THEN
  1504. '运单变更'
  1505. END AS fBillstatus,
  1506. CASE
  1507. WHEN tf.f_billstatus = '1' THEN
  1508. '新建'
  1509. WHEN tf.f_billstatus = '2' THEN
  1510. '暂存'
  1511. WHEN tf.f_billstatus = '3' THEN
  1512. '驳回'
  1513. WHEN tf.f_billstatus = '4' THEN
  1514. '提交'
  1515. WHEN tf.f_billstatus = '5' THEN
  1516. '审批中'
  1517. WHEN tf.f_billstatus = '6' THEN
  1518. '审批通过'
  1519. END AS moneyStatus
  1520. FROM
  1521. t_warehousebills tw
  1522. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  1523. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  1524. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  1525. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1526. AND sd.dict_type = 'f_serviceitems'
  1527. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  1528. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  1529. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  1530. LEFT JOIN (
  1531. SELECT
  1532. th.f_pid,
  1533. th.f_cntrcount,
  1534. tr.f_no,
  1535. th.f_cntrid,
  1536. tg.f_name
  1537. FROM
  1538. t_warehousebills_cntr th
  1539. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  1540. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  1541. ) tc ON tc.f_pid = tw.f_id
  1542. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
  1543. <where>
  1544. tw.f_typeid = '1'
  1545. <if test="fId != null">and tw.f_id = #{fId}</if>
  1546. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1547. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1548. #{fCustomsdeclartion}
  1549. </if>
  1550. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1551. </if>
  1552. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1553. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1554. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1555. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1556. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1557. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1558. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1559. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1560. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1561. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1562. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1563. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1564. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1565. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1566. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1567. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1568. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1569. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1570. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1571. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1572. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1573. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1574. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1575. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1576. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1577. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1578. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1579. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1580. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1581. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1582. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1583. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1584. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1585. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1586. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1587. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1588. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1589. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1590. #{fProductName}, '%')
  1591. </if>
  1592. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1593. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1594. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1595. '%')
  1596. </if>
  1597. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1598. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1599. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1600. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1601. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1602. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1603. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1604. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1605. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1606. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1607. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1608. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1609. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1610. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1611. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1612. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1613. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1614. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1615. #{fShippername}, '%')
  1616. </if>
  1617. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1618. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1619. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1620. #{fConsigneername}, '%')
  1621. </if>
  1622. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1623. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1624. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1625. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1626. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1627. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1628. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1629. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1630. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1631. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1632. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1633. <if test='startTime != null'>
  1634. and tw.create_time &gt;= #{startTime}
  1635. </if>
  1636. <if test='endTime != null'>
  1637. and tw.create_time &lt;= #{endTime}
  1638. </if>
  1639. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  1640. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  1641. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  1642. #{vslidName}, '%')
  1643. </if>
  1644. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  1645. #{voyidName}, '%')
  1646. </if>
  1647. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  1648. #{voyidName}, '%')
  1649. </if>
  1650. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  1651. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  1652. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  1653. </if>
  1654. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  1655. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  1656. </if>
  1657. </where>
  1658. ORDER BY tw.create_time DESC, tw.f_id DESC
  1659. </select>
  1660. <select id="webVersionOrderById" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1661. SELECT tw.f_id,
  1662. tw.f_billno,
  1663. tw.f_customsdeclartion,
  1664. tw.f_originalbillno,
  1665. tw.f_deptid,
  1666. tw.f_bsdeptid,
  1667. tw.f_contacts,
  1668. tw.f_tel,
  1669. tw.f_corpid,
  1670. tc.f_name corpName,
  1671. tw.f_tocorpid,
  1672. tw.f_stltypeid,
  1673. tw.f_bscorpno,
  1674. tw.f_warehouseid,
  1675. tw.f_storekeeper,
  1676. tw.f_chargedate,
  1677. tw.f_bsdate,
  1678. tw.f_planqty,
  1679. tw.f_plangrossweight,
  1680. tw.f_plannetweight,
  1681. tw.f_planvolumn,
  1682. tw.f_qty,
  1683. tw.f_grossweight,
  1684. tw.f_netweight,
  1685. tw.f_volumn,
  1686. tw.f_billingway,
  1687. tw.f_trademodeid,
  1688. tw.f_sbu,
  1689. tw.f_feetunit,
  1690. tw.f_mblno,
  1691. tw.f_marks,
  1692. tw.f_vslvoy,
  1693. tw.f_eta,
  1694. tw.f_customno,
  1695. tw.f_ifweigh,
  1696. tw.f_ifpledge,
  1697. tw.f_ifdamage,
  1698. tw.f_bankcorpid,
  1699. tw.f_billtype,
  1700. tw.f_billstatus,
  1701. tw.f_items_status,
  1702. tw.del_flag,
  1703. tw.create_by,
  1704. tw.create_time,
  1705. tw.update_by,
  1706. tw.update_time,
  1707. tw.remark,
  1708. tw.f_billing_deadline,
  1709. tw.f_product_name,
  1710. tw.f_review_date,
  1711. tw.f_truckno,
  1712. tw.f_driver_name,
  1713. tw.f_driver_tel,
  1714. tw.f_driver_id_car,
  1715. tw.f_business_type,
  1716. tw.f_labour,
  1717. tw.f_fleet,
  1718. tw.f_inwarehouseid,
  1719. tw.f_bstime,
  1720. tw.f_cartype,
  1721. tw.f_goodsid,
  1722. tw.f_new_trademodeid,
  1723. tw.f_loadportid,
  1724. address.f_name loadportidName,
  1725. tw.f_destportid,
  1726. ta.f_name destportidName,
  1727. tw.f_serviceitems,
  1728. sd.dict_label serviceitemsName,
  1729. tw.f_invoceobj,
  1730. sdi.dict_label invoceobjName,
  1731. tw.f_sign,
  1732. sdc.dict_label signName,
  1733. tw.f_detentioncargo,
  1734. sdt.dict_label detentioncargoName,
  1735. tw.f_booksmarks,
  1736. tw.f_shippername,
  1737. tw.f_shipperattn,
  1738. tw.f_shippertel,
  1739. tw.f_consigneername,
  1740. tw.f_consigneeattn,
  1741. tw.f_consigneetel,
  1742. tw.f_insurance,
  1743. sdd.dict_label insuranceName,
  1744. tw.f_insuranceamt,
  1745. tw.f_closedate,
  1746. tw.f_docmentdate,
  1747. tw.f_vslid,
  1748. tv.f_name vslidName,
  1749. tw.f_voyid,
  1750. ty.f_no voyidName,
  1751. tw.f_typeid,
  1752. tw.f_paymode,
  1753. sda.dict_label paymodeName,
  1754. tw.f_laneid,
  1755. tr.f_name laneidName
  1756. FROM t_warehousebills tw
  1757. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1758. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1759. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1760. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1761. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1762. AND sd.dict_type = 'f_serviceitems'
  1763. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1764. AND sdi.dict_type = 'f_invoceobj'
  1765. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1766. AND sdc.dict_type = 'f_sign'
  1767. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1768. AND sdt.dict_type = 'f_detentioncargo'
  1769. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1770. AND sdd.dict_type = 'f_insurance'
  1771. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1772. AND sda.dict_type = 'f_paymode'
  1773. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1774. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1775. where tw.f_id = #{fId}
  1776. </select>
  1777. <select id="selectTWarehousebillsfMblno" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1778. SELECT
  1779. f_id,
  1780. f_mblno
  1781. FROM
  1782. t_warehousebills
  1783. WHERE
  1784. f_typeid = '1'
  1785. and f_mblno = #{fMblno}
  1786. </select>
  1787. <select id="selectAppStockList" parameterType="TWarehousebills" resultType="Map">
  1788. SELECT DISTINCT
  1789. w.f_id fId,
  1790. w.f_corpid fCorpid,
  1791. c.f_name corpName,
  1792. w.f_bsdate fBsdate,
  1793. g.f_name goodsName,
  1794. w.f_mblno fMblno,
  1795. w.f_qty fQty,
  1796. w.f_cntval fCntval,
  1797. w.f_planqty fPlanqty,
  1798. t.f_name fWarehouseName,
  1799. w.f_planvolumn fPlanvolumn,
  1800. w.f_plannetweight fPlannetweight,
  1801. w.f_plangrossweight fPlangrossweight,
  1802. w.f_grossweight fGrossweight,
  1803. w.f_storekeeper fStorekeeper,
  1804. w.create_by createBy,
  1805. w.f_warehouseid fWarehouseid,
  1806. w.f_driver_tel fDriverTel,
  1807. w.f_trademodeid fTrademodeid,
  1808. w.f_product_name fProductName,
  1809. CASE
  1810. WHEN w.f_billtype = 'SJRK'
  1811. AND w.f_items_status = '1' THEN
  1812. '计划'
  1813. WHEN w.f_billtype = 'SJRK'
  1814. AND w.f_items_status = '2' THEN
  1815. '待入库'
  1816. WHEN w.f_billtype = 'SJRK'
  1817. AND w.f_items_status = '3' THEN
  1818. '入库中'
  1819. WHEN w.f_billtype = 'SJRK'
  1820. AND w.f_items_status = '4' THEN
  1821. '已入库'
  1822. WHEN w.f_billtype = 'SJCK'
  1823. AND w.f_items_status = '1' THEN
  1824. '计划'
  1825. WHEN w.f_billtype = 'SJCK'
  1826. AND w.f_items_status = '2' THEN
  1827. '待出库'
  1828. WHEN w.f_billtype = 'SJCK'
  1829. AND w.f_items_status = '3' THEN
  1830. '出库中'
  1831. WHEN w.f_billtype = 'SJCK'
  1832. AND w.f_items_status = '4' THEN
  1833. '已出库'
  1834. WHEN w.f_billtype = 'CKDB'
  1835. AND w.f_items_status = '1' THEN
  1836. '计划'
  1837. WHEN w.f_billtype = 'CKDB'
  1838. AND w.f_items_status = '2' THEN
  1839. '待调拨'
  1840. WHEN w.f_billtype = 'CKDB'
  1841. AND w.f_items_status = '3' THEN
  1842. '调拨中'
  1843. WHEN w.f_billtype = 'CKDB'
  1844. AND w.f_items_status = '4' THEN
  1845. '已调拨'
  1846. WHEN w.f_billtype = 'HWTG'
  1847. AND w.f_items_status = '1' THEN
  1848. '计划'
  1849. WHEN w.f_billtype = 'HWTG'
  1850. AND w.f_items_status = '2' THEN
  1851. '待调拨'
  1852. WHEN w.f_billtype = 'HWTG'
  1853. AND w.f_items_status = '3' THEN
  1854. '调拨中'
  1855. WHEN w.f_billtype = 'HWTG'
  1856. AND w.f_items_status = '4' THEN
  1857. '已调拨'
  1858. END AS fBillstatus
  1859. FROM
  1860. t_warehousebills w
  1861. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1862. LEFT JOIN t_goods g ON g.f_id = w.f_goodsid
  1863. LEFT JOIN t_warehouse t ON t.f_id = w.f_warehouseid
  1864. left join sys_user u on w.f_storekeeper = u.user_name
  1865. left join sys_dept d on w.f_bsdeptid = d.dept_id
  1866. where
  1867. w.f_id != ''
  1868. and w.f_billtype = #{fBilltype}
  1869. AND w.f_planqty != f_qty
  1870. AND w.f_billstatus != 6
  1871. <if test="fMblno != null ">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1872. <if test="fItemsStatus != null ">and w.f_items_status = #{fItemsStatus}</if>
  1873. <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
  1874. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1875. and w.f_bsdate &gt;= #{timeInterval[0]}
  1876. </if>
  1877. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1878. and w.f_bsdate &lt;= #{timeInterval[1]}
  1879. </if>
  1880. ${params.dataScope}
  1881. order by w.f_bsdate desc
  1882. </select>
  1883. <select id="selectWarehouseItemListById" resultType="java.util.Map">
  1884. SELECT
  1885. t.f_id fId,
  1886. t.f_pid fPid,
  1887. c.f_name corpName,
  1888. t.f_bsdate fBsdate,
  1889. g.f_name goodsName,
  1890. t.f_mblno fMblno,
  1891. t.f_warehouse_information fWarehouseInformation,
  1892. t.f_truckno fTruckno,
  1893. t.f_cntrno fCntrno,
  1894. cntr.f_name cntrtypes,
  1895. t.f_cntrtype fCntrtype,
  1896. t.f_qty fQty,
  1897. t.f_grossweight fGrossweight,
  1898. t.f_cntqty fCntqty,
  1899. CASE
  1900. WHEN t.f_billstatus = '10' THEN
  1901. '计划'
  1902. WHEN t.f_billstatus = '20' THEN
  1903. 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', '待转移', '无')))))
  1904. WHEN t.f_billstatus = '30' THEN
  1905. 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', '转移中', '无')))))
  1906. WHEN t.f_billstatus = '40' THEN
  1907. 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', '已转移', '无')))))
  1908. END fBillstatus
  1909. FROM
  1910. t_warehousebills w
  1911. LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  1912. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1913. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  1914. LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype
  1915. where
  1916. t.f_pid = #{fId}
  1917. </select>
  1918. <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
  1919. SELECT
  1920. DISTINCT
  1921. c.f_name corpName,
  1922. #{fMblno} fMblno,
  1923. w.f_product_name goodsName,
  1924. d.dict_label fBusinessType,
  1925. w.f_cntval fCntval,
  1926. 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,
  1927. 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,
  1928. 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,
  1929. IF(item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, date_format( item.f_bsdate, '%Y-%m-%d' ), NULL ) outBsdate,
  1930. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_qty, 0 ) outQty,
  1931. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_grossweight, 0.00 ) outGrossweight,
  1932. CASE
  1933. WHEN item.f_billtype = 'SJRK' THEN
  1934. '入库'
  1935. WHEN item.f_billtype = 'SJCK' THEN
  1936. '出库'
  1937. WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
  1938. '调拨'
  1939. WHEN item.f_billtype = 'HQZY' THEN
  1940. '货权转移'
  1941. WHEN item.f_billtype = 'HWTG' THEN
  1942. '货物通关'
  1943. END AS fBilltype,
  1944. 0 fQtyblc,
  1945. 0 fGrossweightblc,
  1946. item.remark
  1947. FROM
  1948. t_warehousebills w
  1949. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  1950. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1951. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  1952. LEFT JOIN sys_dict_data d ON d.dict_value = w.f_business_type
  1953. WHERE
  1954. w.f_corpid = #{fCorpid}
  1955. AND item.f_mblno = #{fMblno}
  1956. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  1957. 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'))
  1958. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  1959. AND item.f_bsdate &gt;= #{bsdateList[0]}
  1960. </if>
  1961. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  1962. AND item.f_bsdate &lt;= #{bsdateList[1]}
  1963. </if>
  1964. order by item.f_bsdate asc
  1965. </select>
  1966. <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
  1967. SELECT
  1968. DISTINCT
  1969. f.f_id,
  1970. date_format( f.create_time, '%Y-%m-%d' ) createTime,
  1971. d.dict_label fBusinessType,
  1972. fee.f_name fFeeid,
  1973. f.f_qty fQty,
  1974. f.f_unitprice fUnitprice,
  1975. f.f_amount fAmount,
  1976. f.remark
  1977. FROM
  1978. t_warehousebills w
  1979. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  1980. LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
  1981. LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
  1982. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  1983. LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type
  1984. WHERE
  1985. item.f_mblno = #{fMblno}
  1986. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  1987. 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'))
  1988. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  1989. AND item.f_bsdate &gt;= #{bsdateList[0]}
  1990. </if>
  1991. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  1992. AND item.f_bsdate &lt;= #{bsdateList[1]}
  1993. </if>
  1994. order by f.create_time asc
  1995. </select>
  1996. </mapper>