TWarehousebillsMapper.xml 106 KB

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