TWarehousebillsMapper.xml 104 KB

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