TWarehousebillsMapper.xml 96 KB

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