TWarehousebillsMapper.xml 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  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. <delete id="deleteTWarehousebillsById" parameterType="Long">
  985. delete
  986. from t_warehousebills
  987. where f_id = #{fId}
  988. </delete>
  989. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  990. delete
  991. item.*,
  992. bill.*,
  993. fess.*,
  994. enclosure.*
  995. from
  996. t_warehousebills bill
  997. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  998. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  999. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1000. where
  1001. bill.f_id in
  1002. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1003. #{fId}
  1004. </foreach>
  1005. </delete>
  1006. <delete id="deleteKHTWarehousebillsByIds" parameterType="String">
  1007. delete
  1008. bill.*,
  1009. fess.*,
  1010. enclosure.*
  1011. from
  1012. t_warehousebills bill
  1013. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1014. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1015. where
  1016. bill.f_id in
  1017. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1018. #{fId}
  1019. </foreach>
  1020. </delete>
  1021. <update id="warehouseFollowUpdate">
  1022. update
  1023. t_warehousebills
  1024. <trim prefix="SET" suffixOverrides=",">
  1025. <if test="fettle != null">f_billstatus = #{fettle},</if>
  1026. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  1027. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  1028. </trim>
  1029. where f_id = #{fPid}
  1030. </update>
  1031. <select id="selectDetailedList" resultType="java.util.Map">
  1032. SELECT t.f_id AS fId,
  1033. item.f_id AS fItemsId,
  1034. C.f_name AS fcorpid,
  1035. t.f_mblno AS fMblno,
  1036. g.f_name AS fGoodsid,
  1037. dict.dict_label AS fBusinessType,
  1038. t.f_marks AS fMarks,
  1039. CASE
  1040. WHEN t.f_billtype = 'SJRK' THEN
  1041. '入库'
  1042. WHEN t.f_billtype = 'SJCK' THEN
  1043. '出库'
  1044. WHEN t.f_billtype = 'CKDB' THEN
  1045. '调拨'
  1046. WHEN t.f_billtype = 'HQZY' THEN
  1047. '货权转移'
  1048. WHEN t.f_billtype = 'HWTG' THEN
  1049. '货物通关'
  1050. END AS fBilltype,
  1051. item.f_bsdate AS fBsdate,
  1052. item.f_warehouse_information AS fWarehouseInformation,
  1053. dictTra.dict_label AS fTrademodeid,
  1054. CASE
  1055. WHEN t.f_billtype = 'SJRK' THEN
  1056. item.f_qty
  1057. else '0'
  1058. END AS fQtyRK,
  1059. CASE
  1060. WHEN t.f_billtype = 'SJRK' THEN
  1061. item.f_grossweight
  1062. else '0'
  1063. END AS fGrossweightRK,
  1064. CASE
  1065. WHEN t.f_billtype = 'SJRK' THEN
  1066. item.f_netweight
  1067. else '0'
  1068. END AS fNetweightRK,
  1069. CASE
  1070. WHEN t.f_billtype = 'SJCK' THEN
  1071. item.f_qty
  1072. else '0'
  1073. END AS fQtyCK,
  1074. CASE
  1075. WHEN t.f_billtype = 'SJCK' THEN
  1076. item.f_grossweight
  1077. else '0'
  1078. END AS fGrossweightCK,
  1079. CASE
  1080. WHEN t.f_billtype = 'SJCK' THEN
  1081. item.f_netweight
  1082. else '0'
  1083. END AS fNetweightCK,
  1084. CASE
  1085. WHEN t.f_billtype = 'CKDB' THEN
  1086. item.f_qty
  1087. else '0'
  1088. END AS fQtyDB,
  1089. CASE
  1090. WHEN t.f_billtype = 'CKDB' THEN
  1091. item.f_grossweight
  1092. else '0'
  1093. END AS fGrossweightDB,
  1094. CASE
  1095. WHEN t.f_billtype = 'CKDB' THEN
  1096. item.f_netweight
  1097. else '0'
  1098. END AS fNetweightDB,
  1099. CASE
  1100. WHEN t.f_billtype = 'HQZY' THEN
  1101. item.f_qty
  1102. else '0'
  1103. END AS fQtyHZ,
  1104. CASE
  1105. WHEN t.f_billtype = 'HQZY' THEN
  1106. item.f_grossweight
  1107. else '0'
  1108. END AS fGrossweightHZ,
  1109. CASE
  1110. WHEN t.f_billtype = 'HQZY' THEN
  1111. item.f_netweight
  1112. else '0'
  1113. END AS fNetweightHZ,
  1114. CASE
  1115. WHEN t.f_billtype = 'HWTG' THEN
  1116. item.f_qty
  1117. else '0'
  1118. END AS fQtyTG,
  1119. CASE
  1120. WHEN t.f_billtype = 'HWTG' THEN
  1121. item.f_grossweight
  1122. else '0'
  1123. END AS fGrossweightTG,
  1124. CASE
  1125. WHEN t.f_billtype = 'HWTG' THEN
  1126. item.f_netweight
  1127. else '0'
  1128. END AS fNetweightTG
  1129. FROM t_warehousebills t
  1130. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1131. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1132. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1133. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1134. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1135. WHERE dict.STATUS = '0'
  1136. AND t.f_typeid IS NULL
  1137. AND dict.dict_type = 'storage_type'
  1138. AND dictTra.STATUS = '0'
  1139. AND dictTra.dict_type = 'data_trademodes'
  1140. AND item.f_billstatus = 40
  1141. AND item.f_mblno = #{fMblno}
  1142. AND (item.f_warehouselocid = #{fWarehouseLocationid} or
  1143. item.f_transfer_warehouselocid = #{fWarehouseLocationid})
  1144. AND t.f_trademodeid = #{fTrademodeids}
  1145. AND item.f_business_type = #{fBusinessType}
  1146. AND item.f_goodsid = #{fGoodsid}
  1147. AND item.f_marks = #{fMarks}
  1148. AND t.f_corpid = #{fCorpIds}
  1149. </select>
  1150. <select id="webVersionOrderList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1151. SELECT tw.f_id,
  1152. tw.f_billno,
  1153. tw.f_customsdeclartion,
  1154. tw.f_originalbillno,
  1155. tw.f_deptid,
  1156. tw.f_bsdeptid,
  1157. tw.f_contacts,
  1158. tw.f_tel,
  1159. tw.f_corpid,
  1160. tc.f_name corpName,
  1161. tw.f_tocorpid,
  1162. tw.f_stltypeid,
  1163. tw.f_bscorpno,
  1164. tw.f_warehouseid,
  1165. tw.f_storekeeper,
  1166. tw.f_chargedate,
  1167. tw.f_bsdate,
  1168. tw.f_planqty,
  1169. tw.f_plangrossweight,
  1170. tw.f_plannetweight,
  1171. tw.f_planvolumn,
  1172. tw.f_qty,
  1173. tw.f_grossweight,
  1174. tw.f_netweight,
  1175. tw.f_volumn,
  1176. tw.f_billingway,
  1177. tw.f_trademodeid,
  1178. tw.f_sbu,
  1179. tw.f_feetunit,
  1180. tw.f_mblno,
  1181. tw.f_marks,
  1182. tw.f_vslvoy,
  1183. tw.f_eta,
  1184. tw.f_customno,
  1185. tw.f_ifweigh,
  1186. tw.f_ifpledge,
  1187. tw.f_ifdamage,
  1188. tw.f_bankcorpid,
  1189. tw.f_billtype,
  1190. tw.f_billstatus,
  1191. tw.f_items_status,
  1192. tw.del_flag,
  1193. tw.create_by,
  1194. tw.create_time,
  1195. tw.update_by,
  1196. tw.update_time,
  1197. tw.remark,
  1198. tw.f_billing_deadline,
  1199. tw.f_product_name,
  1200. tw.f_review_date,
  1201. tw.f_truckno,
  1202. tw.f_driver_name,
  1203. tw.f_driver_tel,
  1204. tw.f_driver_id_car,
  1205. tw.f_business_type,
  1206. tw.f_labour,
  1207. tw.f_fleet,
  1208. tw.f_inwarehouseid,
  1209. tw.f_bstime,
  1210. tw.f_cartype,
  1211. tw.f_goodsid,
  1212. tw.f_new_trademodeid,
  1213. tw.f_loadportid,
  1214. address.f_name loadportidName,
  1215. tw.f_destportid,
  1216. ta.f_name destportidName,
  1217. tw.f_serviceitems,
  1218. sd.dict_label serviceitemsName,
  1219. tw.f_invoceobj,
  1220. sdi.dict_label invoceobjName,
  1221. tw.f_sign,
  1222. sdc.dict_label signName,
  1223. tw.f_detentioncargo,
  1224. sdt.dict_label detentioncargoName,
  1225. tw.f_booksmarks,
  1226. tw.f_shippername,
  1227. tw.f_shipperattn,
  1228. tw.f_shippertel,
  1229. tw.f_consigneername,
  1230. tw.f_consigneeattn,
  1231. tw.f_consigneetel,
  1232. tw.f_insurance,
  1233. sdd.dict_label insuranceName,
  1234. tw.f_insuranceamt,
  1235. tw.f_closedate,
  1236. tw.f_docmentdate,
  1237. tw.f_vslid,
  1238. tv.f_name vslidName,
  1239. tw.f_voyid,
  1240. ty.f_no voyidName,
  1241. tw.f_typeid,
  1242. tw.f_paymode,
  1243. sda.dict_label paymodeName,
  1244. tw.f_laneid,
  1245. tr.f_name laneidName
  1246. FROM t_warehousebills tw
  1247. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1248. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1249. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1250. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1251. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1252. AND sd.dict_type = 'f_serviceitems'
  1253. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1254. AND sdi.dict_type = 'f_invoceobj'
  1255. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1256. AND sdc.dict_type = 'f_sign'
  1257. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1258. AND sdt.dict_type = 'f_detentioncargo'
  1259. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1260. AND sdd.dict_type = 'f_insurance'
  1261. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1262. AND sda.dict_type = 'f_paymode'
  1263. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1264. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1265. <where>
  1266. tw.f_typeid = '1'
  1267. <if test="fId != null">and tw.f_id = #{fId}</if>
  1268. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1269. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1270. #{fCustomsdeclartion}
  1271. </if>
  1272. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1273. </if>
  1274. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1275. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1276. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1277. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1278. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1279. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1280. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1281. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1282. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1283. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1284. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1285. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1286. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1287. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1288. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1289. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1290. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1291. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1292. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1293. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1294. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1295. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1296. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1297. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1298. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1299. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1300. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1301. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1302. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1303. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1304. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1305. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1306. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1307. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1308. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1309. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1310. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1311. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1312. #{fProductName}, '%')
  1313. </if>
  1314. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1315. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1316. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1317. '%')
  1318. </if>
  1319. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1320. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1321. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1322. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1323. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1324. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1325. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1326. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1327. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1328. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1329. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1330. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1331. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1332. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1333. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1334. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1335. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1336. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1337. #{fShippername}, '%')
  1338. </if>
  1339. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1340. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1341. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1342. #{fConsigneername}, '%')
  1343. </if>
  1344. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1345. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1346. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1347. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1348. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1349. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1350. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1351. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1352. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1353. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1354. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1355. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1356. and tw.create_time &gt;= #{timeInterval[0]}
  1357. </if>
  1358. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1359. and tw.create_time &lt;= #{timeInterval[1]}
  1360. </if>
  1361. </where>
  1362. ORDER BY tw.create_time DESC, tw.f_id DESC
  1363. </select>
  1364. <select id="ruoYiVersionOrderList" parameterType="TWarehousebills" resultType="map">
  1365. SELECT
  1366. tw.f_id fId,
  1367. tw.f_billno fBillno,
  1368. tw.f_mblno fMblno,
  1369. sd.dict_label fServiceitems,
  1370. tw.f_consigneername fConsigneername,
  1371. ta.f_name fName,
  1372. tw.f_bsdate fBsdate,
  1373. tc.f_cntrcount fCntrcount,
  1374. tc.f_no fNo,
  1375. tv.f_name vslName,
  1376. ty.f_no voyNo,
  1377. tw.f_corpid,
  1378. tp.f_name corpName,
  1379. tw.create_by createBy,
  1380. tw.create_time createTime,
  1381. tw.f_loadportid,
  1382. tre.f_name loadportName,
  1383. tw.f_destportid,
  1384. ts.f_name destportName,
  1385. tc.f_name goodsName,
  1386. CASE
  1387. WHEN tw.f_billstatus = '1' THEN
  1388. '下单新建'
  1389. WHEN tw.f_billstatus = '2' THEN
  1390. '下单暂存'
  1391. WHEN tw.f_billstatus = '3' THEN
  1392. '下单驳回'
  1393. WHEN tw.f_billstatus = '4' THEN
  1394. '下单提交'
  1395. WHEN tw.f_billstatus = '5' THEN
  1396. '下单审批中'
  1397. WHEN tw.f_billstatus = '6' THEN
  1398. '下单审批通过'
  1399. WHEN tw.f_billstatus = '7' THEN
  1400. '配船暂存'
  1401. WHEN tw.f_billstatus = '8' THEN
  1402. '配船驳回'
  1403. WHEN tw.f_billstatus = '9' THEN
  1404. '配船提交'
  1405. WHEN tw.f_billstatus = '10' THEN
  1406. '配船审批中'
  1407. WHEN tw.f_billstatus = '11' THEN
  1408. '配船审批通过'
  1409. WHEN tw.f_billstatus = '12' THEN
  1410. '运单变更'
  1411. END AS fBillstatus
  1412. FROM
  1413. t_warehousebills tw
  1414. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  1415. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  1416. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  1417. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1418. AND sd.dict_type = 'f_serviceitems'
  1419. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  1420. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  1421. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  1422. LEFT JOIN (
  1423. SELECT
  1424. th.f_pid,
  1425. th.f_cntrcount,
  1426. tr.f_no,
  1427. th.f_cntrid,
  1428. tg.f_name
  1429. FROM
  1430. t_warehousebills_cntr th
  1431. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  1432. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  1433. ) tc ON tc.f_pid = tw.f_id
  1434. <where>
  1435. tw.f_typeid = '1'
  1436. <if test="fId != null">and tw.f_id = #{fId}</if>
  1437. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1438. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  1439. #{fCustomsdeclartion}
  1440. </if>
  1441. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  1442. </if>
  1443. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  1444. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  1445. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  1446. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  1447. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1448. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  1449. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  1450. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  1451. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  1452. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  1453. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1454. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1455. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  1456. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  1457. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  1458. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  1459. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1460. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  1461. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  1462. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  1463. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1464. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  1465. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  1466. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  1467. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1468. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1469. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  1470. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  1471. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  1472. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  1473. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  1474. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  1475. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  1476. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1477. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  1478. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  1479. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1480. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  1481. #{fProductName}, '%')
  1482. </if>
  1483. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1484. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  1485. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  1486. '%')
  1487. </if>
  1488. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  1489. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  1490. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  1491. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  1492. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  1493. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  1494. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  1495. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  1496. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  1497. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  1498. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  1499. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  1500. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  1501. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  1502. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  1503. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  1504. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  1505. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  1506. #{fShippername}, '%')
  1507. </if>
  1508. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  1509. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  1510. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  1511. #{fConsigneername}, '%')
  1512. </if>
  1513. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  1514. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  1515. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  1516. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  1517. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  1518. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  1519. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  1520. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  1521. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  1522. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  1523. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  1524. <if test='startTime != null'>
  1525. and tw.create_time &gt;= #{startTime}
  1526. </if>
  1527. <if test='endTime != null'>
  1528. and tw.create_time &lt;= #{endTime}
  1529. </if>
  1530. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  1531. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  1532. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  1533. #{vslidName}, '%')
  1534. </if>
  1535. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  1536. #{voyidName}, '%')
  1537. </if>
  1538. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  1539. #{voyidName}, '%')
  1540. </if>
  1541. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  1542. </where>
  1543. ORDER BY tw.create_time DESC, tw.f_id DESC
  1544. </select>
  1545. <select id="webVersionOrderById" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1546. SELECT tw.f_id,
  1547. tw.f_billno,
  1548. tw.f_customsdeclartion,
  1549. tw.f_originalbillno,
  1550. tw.f_deptid,
  1551. tw.f_bsdeptid,
  1552. tw.f_contacts,
  1553. tw.f_tel,
  1554. tw.f_corpid,
  1555. tc.f_name corpName,
  1556. tw.f_tocorpid,
  1557. tw.f_stltypeid,
  1558. tw.f_bscorpno,
  1559. tw.f_warehouseid,
  1560. tw.f_storekeeper,
  1561. tw.f_chargedate,
  1562. tw.f_bsdate,
  1563. tw.f_planqty,
  1564. tw.f_plangrossweight,
  1565. tw.f_plannetweight,
  1566. tw.f_planvolumn,
  1567. tw.f_qty,
  1568. tw.f_grossweight,
  1569. tw.f_netweight,
  1570. tw.f_volumn,
  1571. tw.f_billingway,
  1572. tw.f_trademodeid,
  1573. tw.f_sbu,
  1574. tw.f_feetunit,
  1575. tw.f_mblno,
  1576. tw.f_marks,
  1577. tw.f_vslvoy,
  1578. tw.f_eta,
  1579. tw.f_customno,
  1580. tw.f_ifweigh,
  1581. tw.f_ifpledge,
  1582. tw.f_ifdamage,
  1583. tw.f_bankcorpid,
  1584. tw.f_billtype,
  1585. tw.f_billstatus,
  1586. tw.f_items_status,
  1587. tw.del_flag,
  1588. tw.create_by,
  1589. tw.create_time,
  1590. tw.update_by,
  1591. tw.update_time,
  1592. tw.remark,
  1593. tw.f_billing_deadline,
  1594. tw.f_product_name,
  1595. tw.f_review_date,
  1596. tw.f_truckno,
  1597. tw.f_driver_name,
  1598. tw.f_driver_tel,
  1599. tw.f_driver_id_car,
  1600. tw.f_business_type,
  1601. tw.f_labour,
  1602. tw.f_fleet,
  1603. tw.f_inwarehouseid,
  1604. tw.f_bstime,
  1605. tw.f_cartype,
  1606. tw.f_goodsid,
  1607. tw.f_new_trademodeid,
  1608. tw.f_loadportid,
  1609. address.f_name loadportidName,
  1610. tw.f_destportid,
  1611. ta.f_name destportidName,
  1612. tw.f_serviceitems,
  1613. sd.dict_label serviceitemsName,
  1614. tw.f_invoceobj,
  1615. sdi.dict_label invoceobjName,
  1616. tw.f_sign,
  1617. sdc.dict_label signName,
  1618. tw.f_detentioncargo,
  1619. sdt.dict_label detentioncargoName,
  1620. tw.f_booksmarks,
  1621. tw.f_shippername,
  1622. tw.f_shipperattn,
  1623. tw.f_shippertel,
  1624. tw.f_consigneername,
  1625. tw.f_consigneeattn,
  1626. tw.f_consigneetel,
  1627. tw.f_insurance,
  1628. sdd.dict_label insuranceName,
  1629. tw.f_insuranceamt,
  1630. tw.f_closedate,
  1631. tw.f_docmentdate,
  1632. tw.f_vslid,
  1633. tv.f_name vslidName,
  1634. tw.f_voyid,
  1635. ty.f_no voyidName,
  1636. tw.f_typeid,
  1637. tw.f_paymode,
  1638. sda.dict_label paymodeName,
  1639. tw.f_laneid,
  1640. tr.f_name laneidName
  1641. FROM t_warehousebills tw
  1642. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1643. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1644. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1645. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1646. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1647. AND sd.dict_type = 'f_serviceitems'
  1648. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1649. AND sdi.dict_type = 'f_invoceobj'
  1650. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1651. AND sdc.dict_type = 'f_sign'
  1652. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1653. AND sdt.dict_type = 'f_detentioncargo'
  1654. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1655. AND sdd.dict_type = 'f_insurance'
  1656. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1657. AND sda.dict_type = 'f_paymode'
  1658. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1659. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1660. where tw.f_id = #{fId}
  1661. </select>
  1662. <select id="selectTWarehousebillsfMblno" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1663. SELECT
  1664. f_id,
  1665. f_mblno
  1666. FROM
  1667. t_warehousebills
  1668. WHERE
  1669. f_typeid = '1'
  1670. and f_mblno = #{fMblno}
  1671. </select>
  1672. <select id="selectAppStockList" parameterType="TWarehousebills" resultType="Map">
  1673. SELECT
  1674. w.f_id fId,
  1675. w.f_corpid fCorpid,
  1676. c.f_name corpName,
  1677. w.f_bsdate fBsdate,
  1678. g.f_name goodsName,
  1679. w.f_mblno fMblno,
  1680. w.f_qty fQty,
  1681. w.f_cntval fCntval,
  1682. w.f_planqty fPlanqty,
  1683. t.f_name fWarehouseName,
  1684. w.f_planvolumn fPlanvolumn,
  1685. w.f_plannetweight fPlannetweight,
  1686. w.f_plangrossweight fPlangrossweight,
  1687. w.f_grossweight fGrossweight,
  1688. w.f_storekeeper fStorekeeper,
  1689. w.create_by createBy,
  1690. w.f_warehouseid fWarehouseid,
  1691. w.f_driver_tel fDriverTel,
  1692. w.f_trademodeid fTrademodeid,
  1693. CASE WHEN w.f_billstatus = '1' THEN '录入'
  1694. WHEN w.f_billstatus = '2' THEN '暂存'
  1695. WHEN w.f_billstatus = '3' THEN '驳回'
  1696. WHEN w.f_billstatus = '4' THEN '请核'
  1697. WHEN w.f_billstatus = '5' THEN '审核中'
  1698. WHEN w.f_billstatus = '6' THEN '全部入账'
  1699. END fBillstatus
  1700. FROM
  1701. t_warehousebills w
  1702. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1703. LEFT JOIN t_goods g ON g.f_id = w.f_goodsid
  1704. LEFT JOIN t_warehouse t ON t.f_id = w.f_warehouseid
  1705. left join sys_user u on w.create_by = u.user_name
  1706. left join sys_dept d on w.f_bsdeptid = d.dept_id
  1707. where
  1708. w.f_id != ''
  1709. and w.f_billtype = #{fBilltype}
  1710. or w.f_storekeeper = u.user_name
  1711. <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
  1712. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1713. and w.f_bsdate &gt;= #{timeInterval[0]}
  1714. </if>
  1715. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1716. and w.f_bsdate &lt;= #{timeInterval[1]}
  1717. </if>
  1718. ${params.dataScope}
  1719. order by w.f_bsdate desc
  1720. </select>
  1721. <select id="selectWarehouseItemListById" resultType="java.util.Map">
  1722. SELECT
  1723. t.f_id fId,
  1724. t.f_pid fPid,
  1725. c.f_name corpName,
  1726. w.f_bsdate fBsdate,
  1727. g.f_name goodsName,
  1728. t.f_mblno fMblno,
  1729. t.f_warehouse_information fWarehouseInformation,
  1730. t.f_truckno fTruckno,
  1731. t.f_cntrno fCntrno,
  1732. t.f_cntrtype fCntrtype,
  1733. t.f_qty fQty,
  1734. t.f_grossweight fGrossweight,
  1735. t.f_cntqty fCntqty,
  1736. CASE
  1737. WHEN t.f_billstatus = '10' THEN
  1738. '计划'
  1739. WHEN t.f_billstatus = '20' THEN
  1740. 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', '待转移', '无')))))
  1741. WHEN t.f_billstatus = '30' THEN
  1742. 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', '转移中', '无')))))
  1743. WHEN t.f_billstatus = '40' THEN
  1744. 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', '已转移', '无')))))
  1745. END fBillstatus
  1746. FROM
  1747. t_warehousebills w
  1748. LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  1749. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1750. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  1751. where
  1752. t.f_pid = #{fId}
  1753. </select>
  1754. <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
  1755. SELECT
  1756. DISTINCT
  1757. c.f_name corpName,
  1758. #{fMblno} fMblno,
  1759. w.f_product_name goodsName,
  1760. d.dict_label fBusinessType,
  1761. w.f_cntval fCntval,
  1762. 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,
  1763. 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,
  1764. 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,
  1765. IF(item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, date_format( item.f_bsdate, '%Y-%m-%d' ), NULL ) outBsdate,
  1766. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_qty, 0 ) outQty,
  1767. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY' AND w.f_corpid = #{fCorpid}, item.f_grossweight, 0.00 ) outGrossweight,
  1768. CASE
  1769. WHEN item.f_billtype = 'SJRK' THEN
  1770. '入库'
  1771. WHEN item.f_billtype = 'SJCK' THEN
  1772. '出库'
  1773. WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
  1774. '调拨'
  1775. WHEN item.f_billtype = 'HQZY' THEN
  1776. '货权转移'
  1777. WHEN item.f_billtype = 'HWTG' THEN
  1778. '货物通关'
  1779. END AS fBilltype,
  1780. 0 fQtyblc,
  1781. 0 fGrossweightblc,
  1782. item.remark
  1783. FROM
  1784. t_warehousebills w
  1785. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  1786. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1787. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  1788. LEFT JOIN sys_dict_data d ON d.dict_value = item.f_business_type
  1789. WHERE
  1790. w.f_corpid = #{fCorpid}
  1791. AND item.f_mblno = #{fMblno}
  1792. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  1793. 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'))
  1794. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  1795. AND item.f_bsdate &gt;= #{bsdateList[0]}
  1796. </if>
  1797. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  1798. AND item.f_bsdate &lt;= #{bsdateList[1]}
  1799. </if>
  1800. order by item.f_bsdate asc
  1801. </select>
  1802. <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
  1803. SELECT
  1804. DISTINCT
  1805. f.f_id,
  1806. date_format( f.create_time, '%Y-%m-%d' ) createTime,
  1807. d.dict_label fBusinessType,
  1808. fee.f_name fFeeid,
  1809. f.f_qty fQty,
  1810. f.f_unitprice fUnitprice,
  1811. f.f_amount fAmount,
  1812. f.remark
  1813. FROM
  1814. t_warehousebills w
  1815. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  1816. LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
  1817. LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
  1818. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  1819. LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type
  1820. WHERE
  1821. item.f_mblno = #{fMblno}
  1822. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
  1823. 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'))
  1824. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  1825. AND item.f_bsdate &gt;= #{bsdateList[0]}
  1826. </if>
  1827. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  1828. AND item.f_bsdate &lt;= #{bsdateList[1]}
  1829. </if>
  1830. order by f.create_time asc
  1831. </select>
  1832. </mapper>