TWarehousebillsMapper.xml 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  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="fTrademodeid" column="f_trademodeid" />
  32. <result property="fBillingway" column="f_billingway" />
  33. <result property="fSbu" column="f_sbu" />
  34. <result property="fFeetunit" column="f_feetunit" />
  35. <result property="fMblno" column="f_mblno" />
  36. <result property="fVslvoy" column="f_vslvoy" />
  37. <result property="fMarks" column="f_marks" />
  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="delFlag" column="del_flag" />
  47. <result property="createBy" column="create_by" />
  48. <result property="createTime" column="create_time" />
  49. <result property="fItemsStatus" column="f_items_status" />
  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. </resultMap>
  69. <sql id="selectTWarehousebillsVo">
  70. select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid,
  71. f_contacts, f_tel, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno, f_warehouseid,
  72. f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight,
  73. f_planvolumn, f_qty, f_grossweight, f_netweight, f_volumn, f_trademodeid, f_billingway,
  74. f_sbu, f_feetunit, f_mblno, f_vslvoy, f_inwarehouseid, f_marks, f_eta, f_customno, f_ifweigh, f_ifpledge,
  75. f_ifdamage, f_bankcorpid, f_billtype, f_billstatus, del_flag, create_by, create_time,
  76. f_items_status, update_by, update_time, remark, f_billing_deadline, f_product_name,
  77. f_review_date, f_truckno, f_driver_name, f_driver_tel, f_driver_id_car, f_business_type,f_labour,f_fleet,
  78. f_bstime,f_cartype ,f_goodsid ,f_new_trademodeid from t_warehousebills
  79. </sql>
  80. <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  81. select
  82. ware.*
  83. from
  84. t_warehousebills ware
  85. left join sys_user u on ware.create_by = u.user_name
  86. left join sys_dept d on ware.f_bsdeptid = d.dept_id
  87. <where>
  88. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  89. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and f_customsdeclartion =
  90. #{fCustomsdeclartion}
  91. </if>
  92. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  93. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  94. <if test="fBsdeptid != null ">and f_bsdeptid = #{fBsdeptid}</if>
  95. <if test="fInwarehouseid != null ">and f_inwarehouseid = #{fInwarehouseid}</if>
  96. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  97. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  98. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  99. <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
  100. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  101. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  102. and f_bsdate &gt;= #{timeInterval[0]}
  103. </if>
  104. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  105. and f_bsdate &lt;= #{timeInterval[1]}
  106. </if>
  107. <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
  108. <if test="fBscorpno != null and fBscorpno != ''">and f_bscorpno = #{fBscorpno}</if>
  109. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  110. <if test="fStorekeeper != null and fStorekeeper != ''">and f_storekeeper = #{fStorekeeper}</if>
  111. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  112. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  113. <if test="fProductName != null and fProductName != ''"> and f_product_name like concat('%', #{fProductName}, '%')</if>
  114. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  115. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  116. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  117. <if test="fQty != null ">and f_qty = #{fQty}</if>
  118. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  119. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  120. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  121. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  122. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  123. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  124. <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
  125. <if test="fFeetunit != null and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
  126. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  127. <if test="fVslvoy != null and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
  128. <if test="fEta != null ">and f_eta = #{fEta}</if>
  129. <if test="fCustomno != null and fCustomno != ''">and f_customno = #{fCustomno}</if>
  130. <if test="fIfweigh != null and fIfweigh != ''">and f_ifweigh = #{fIfweigh}</if>
  131. <if test="fIfpledge != null and fIfpledge != ''">and f_ifpledge = #{fIfpledge}</if>
  132. <if test="fIfdamage != null and fIfdamage != ''">and f_ifdamage = #{fIfdamage}</if>
  133. <if test="fBankcorpid != null ">and f_bankcorpid = #{fBankcorpid}</if>
  134. <if test="fBillingDeadline != null "> and f_billing_deadline = #{fBillingDeadline}</if>
  135. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  136. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  137. <if test="fNewTrademodeid != null ">and f_new_trademodeid = #{fNewTrademodeid}</if>
  138. </where>
  139. ${params.dataScope}
  140. </select>
  141. <select id="selectWarehouseBusinessList" parameterType="TWarehousebills" resultType="Map">
  142. SELECT
  143. DISTINCT
  144. bill.f_id AS fId,
  145. corp.f_name AS fCorpid,
  146. corpTo.f_name AS fTocorpid,
  147. bill.f_mblno AS fMblno,
  148. corpSub.f_name AS fSbu,
  149. bill.f_marks AS fMarks,
  150. bill.remark AS remark,
  151. bill.f_planqty AS fPlanqty,
  152. bill.f_plangrossweight AS fPlangrossweight,
  153. bill.f_plannetweight AS fPlannetweight,
  154. bill.f_planvolumn AS fPlanvolumn,
  155. bill.f_bsdate AS fBsdate,
  156. bill.f_trademodeid AS fTrademodeid,
  157. bill.f_truckno AS fTruckno,
  158. bill.f_driver_name AS fDriverName,
  159. bill.f_driver_tel AS fDriverTel,
  160. bill.f_driver_id_car AS fDriverIdCar,
  161. dictIn.dict_label AS fBusinessType,
  162. ware.f_name AS fWarehouseid,
  163. bill.f_qty AS fQty,
  164. bill.f_netweight AS fNetweight,
  165. bill.create_time AS createTime,
  166. ware1.f_name AS fInwarehouseid,
  167. bill.create_by AS createBy,
  168. bill.f_grossweight AS fGrossweight,
  169. bill.f_product_name AS fProductName,
  170. bill.f_billing_deadline AS fBillingDeadline,
  171. CASE WHEN bill.f_billstatus = '1' THEN '录入'
  172. WHEN bill.f_billstatus = '2' THEN '暂存'
  173. WHEN bill.f_billstatus = '3' THEN '驳回'
  174. WHEN bill.f_billstatus = '4' THEN '请核'
  175. WHEN bill.f_billstatus = '5' THEN '审核中'
  176. WHEN bill.f_billstatus = '6' THEN '全部入账'
  177. END
  178. AS fBillstatus,
  179. CASE
  180. WHEN bill.f_billtype = 'SJRK'
  181. AND bill.f_items_status = '1' THEN
  182. '计划'
  183. WHEN bill.f_billtype = 'SJRK'
  184. AND bill.f_items_status = '2' THEN
  185. '待入库'
  186. WHEN bill.f_billtype = 'SJRK'
  187. AND bill.f_items_status = '3' THEN
  188. '入库中'
  189. WHEN bill.f_billtype = 'SJRK'
  190. AND bill.f_items_status = '4' THEN
  191. '已入库'
  192. WHEN bill.f_billtype = 'SJCK'
  193. AND bill.f_items_status = '1' THEN
  194. '计划'
  195. WHEN bill.f_billtype = 'SJCK'
  196. AND bill.f_items_status = '2' THEN
  197. '待出库'
  198. WHEN bill.f_billtype = 'SJCK'
  199. AND bill.f_items_status = '3' THEN
  200. '出库中'
  201. WHEN bill.f_billtype = 'SJCK'
  202. AND bill.f_items_status = '4' THEN
  203. '已出库'
  204. WHEN bill.f_billtype = 'CKDB'
  205. AND bill.f_items_status = '1' THEN
  206. '计划'
  207. WHEN bill.f_billtype = 'CKDB'
  208. AND bill.f_items_status = '2' THEN
  209. '待调拨'
  210. WHEN bill.f_billtype = 'CKDB'
  211. AND bill.f_items_status = '3' THEN
  212. '调拨中'
  213. WHEN bill.f_billtype = 'CKDB'
  214. AND bill.f_items_status = '4' THEN
  215. '已调拨'
  216. WHEN bill.f_billtype = 'HWTG'
  217. AND bill.f_items_status = '1' THEN
  218. '计划'
  219. WHEN bill.f_billtype = 'HWTG'
  220. AND bill.f_items_status = '2' THEN
  221. '待调拨'
  222. WHEN bill.f_billtype = 'HWTG'
  223. AND bill.f_items_status = '3' THEN
  224. '调拨中'
  225. WHEN bill.f_billtype = 'HWTG'
  226. AND bill.f_items_status = '4' THEN
  227. '已调拨'
  228. END AS fItemsStatus,
  229. bill.f_billno AS fBillno,
  230. g.f_name AS fGoodsid,
  231. bill.f_storekeeper AS fStorekeeper
  232. FROM
  233. t_warehousebills bill
  234. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  235. left join sys_user u on bill.create_by = u.user_name
  236. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  237. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  238. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  239. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  240. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  241. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  242. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  243. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  244. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type
  245. <where>
  246. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  247. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  248. #{fCustomsdeclartion}
  249. </if>
  250. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  251. #{fOriginalbillno}
  252. </if>
  253. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  254. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  255. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  256. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  257. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  258. and bill.f_bsdate &gt;= #{timeInterval[0]}
  259. </if>
  260. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  261. and bill.f_bsdate &lt;= #{timeInterval[1]}
  262. </if>
  263. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  264. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  265. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  266. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  267. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  268. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  269. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  270. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  271. <if test="fReviewDate != null "> and f_review_date = #{fReviewDate}</if>
  272. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  273. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  274. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  275. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  276. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  277. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  278. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  279. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  280. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  281. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  282. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  283. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  284. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  285. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  286. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  287. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  288. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  289. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  290. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  291. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  292. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  293. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  294. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  295. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  296. <if test="fBilltype != null and fBilltype == 'SJRK'">
  297. and bill.f_billtype = #{fBilltype}
  298. AND dictIn.dict_type = 'st_in_type'
  299. AND dictIn.status = '0'
  300. </if>
  301. <if test="fBilltype != null and fBilltype == 'SJCK'">
  302. and bill.f_billtype = #{fBilltype}
  303. AND dictIn.dict_type = 'st_out_type'
  304. AND dictIn.status = '0'
  305. </if>
  306. <if test="fBilltype != null and fBilltype == 'CKDB'">
  307. and bill.f_billtype = #{fBilltype}
  308. AND dictIn.dict_type = 'st_trans_type'
  309. AND dictIn.status = '0'
  310. </if>
  311. <if test="fBilltype != null and fBilltype == 'HWTG'">
  312. and bill.f_billtype = #{fBilltype}
  313. AND dictIn.dict_type = 'st_trans_type'
  314. AND dictIn.status = '0'
  315. </if>
  316. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  317. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  318. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  319. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  320. </where>
  321. ${params.dataScope}
  322. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  323. </select>
  324. <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
  325. SELECT
  326. DISTINCT
  327. bill.f_id AS fId,
  328. corp.f_name AS fCorpid,
  329. corpTo.f_name AS fTocorpid,
  330. bill.f_mblno AS fMblno,
  331. corpSub.f_name AS fSbu,
  332. bill.f_marks AS fMarks,
  333. bill.remark AS remark,
  334. bill.f_planqty AS fPlanqty,
  335. bill.f_plangrossweight AS fPlangrossweight,
  336. bill.f_plannetweight AS fPlannetweight,
  337. bill.f_planvolumn AS fPlanvolumn,
  338. bill.f_bsdate AS fBsdate,
  339. dict.dict_label AS fTrademodeid,
  340. bill.f_truckno AS fTruckno,
  341. bill.f_driver_name AS fDriverName,
  342. bill.f_driver_tel AS fDriverTel,
  343. bill.f_driver_id_car AS fDriverIdCar,
  344. ware.f_name AS fWarehouseid,
  345. bill.f_qty AS fQty,
  346. bill.f_netweight AS fNetweight,
  347. bill.create_time AS createTime,
  348. ware1.f_name AS fInwarehouseid,
  349. bill.create_by AS createBy,
  350. bill.f_grossweight AS fGrossweight,
  351. bill.f_product_name AS fProductName,
  352. bill.f_billing_deadline AS fBillingDeadline,
  353. CASE
  354. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
  355. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
  356. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
  357. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
  358. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
  359. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
  360. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
  361. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
  362. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
  363. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
  364. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
  365. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
  366. END
  367. AS fBillstatus,
  368. CASE
  369. WHEN bill.f_billtype = 'HQZY'
  370. AND bill.f_items_status = '1' THEN
  371. '计划'
  372. WHEN bill.f_billtype = 'HQZY'
  373. AND bill.f_items_status = '2' THEN
  374. '待货转'
  375. WHEN bill.f_billtype = 'HQZY'
  376. AND bill.f_items_status = '3' THEN
  377. '货转中'
  378. WHEN bill.f_billtype = 'HQZY'
  379. AND bill.f_items_status = '4' THEN
  380. '已货转'
  381. END
  382. AS fItemsStatus,
  383. bill.f_billno AS fBillno,
  384. g.f_name AS fGoodsid,
  385. bill.f_storekeeper AS fStorekeeper
  386. FROM
  387. t_warehousebills bill
  388. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  389. left join sys_user u on bill.create_by = u.user_name
  390. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  391. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  392. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  393. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  394. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  395. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  396. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  397. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  398. LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
  399. <where>
  400. dict.status = '0'
  401. AND dict.dict_type = 'data_trademodes'
  402. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  403. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  404. #{fCustomsdeclartion}
  405. </if>
  406. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  407. #{fOriginalbillno}
  408. </if>
  409. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  410. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  411. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  412. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  413. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  414. and bill.f_bsdate &gt;= #{timeInterval[0]}
  415. </if>
  416. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  417. and bill.f_bsdate &lt;= #{timeInterval[1]}
  418. </if>
  419. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  420. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  421. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  422. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  423. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  424. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  425. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  426. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  427. <if test="fReviewDate != null "> and f_review_date = #{fReviewDate}</if>
  428. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  429. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  430. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  431. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  432. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  433. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  434. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  435. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  436. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  437. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  438. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  439. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  440. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  441. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  442. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  443. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  444. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  445. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  446. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  447. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  448. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  449. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  450. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  451. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  452. <if test="fBilltype != null and fBilltype != ''">
  453. and bill.f_billtype = #{fBilltype}
  454. </if>
  455. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  456. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  457. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  458. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  459. </where>
  460. ${params.dataScope}
  461. ORDER BY bill.f_billstatus , bill.f_bsdate DESC
  462. </select>
  463. <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
  464. <include refid="selectTWarehousebillsVo"/>
  465. where f_id = #{fId}
  466. ORDER BY f_bsdate desc
  467. </select>
  468. <select id="selectTWarehousebillsItemsList"
  469. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems">
  470. SELECT
  471. ( @ii := @ii + 1 ) AS fId,
  472. CASE
  473. wi.f_billtype
  474. WHEN 'SJRK' THEN
  475. '入库'
  476. WHEN 'SJCK' THEN
  477. '出库'
  478. WHEN 'KCZZ' THEN
  479. '库存总账'
  480. END AS fBilltype,
  481. wi.f_mblno AS fMblno,
  482. wi.f_product_name AS fGoodsid,
  483. wi.f_marks AS fMarks,
  484. wi.f_bsdate AS fBsdate,
  485. dict.dict_label AS fFeeUnitid,
  486. wi.f_billing_qty AS fBillingQty,
  487. wi.f_chargedate AS fChargedate,
  488. wi.f_billing_deadline AS fBillingDeadline,
  489. wi.f_billing_days AS fBillingDays,
  490. wi.f_inventory_days AS fInventoryDays,
  491. wi.f_amt AS fAmt,
  492. wi.remark AS remark
  493. FROM
  494. t_warehousebills w
  495. LEFT JOIN t_warehousebillsfees wi ON w.f_id = wi.f_pid
  496. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  497. ,(
  498. SELECT
  499. @ii := 0
  500. ) AS ii
  501. WHERE
  502. w.f_id = #{fId}
  503. AND dict.status = '0'
  504. AND dict.dict_type = 'data_unitfees'
  505. </select>
  506. <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
  507. SELECT
  508. co.f_name AS fName,
  509. it.f_bsdate AS fBsdate,
  510. leg.f_mblno AS fMblno,
  511. it.f_business_type AS fBusinessType,
  512. dict.dict_label AS fBusinessTypes,
  513. it.f_marks AS fMarks ,
  514. goo.f_name AS fGoodsName,
  515. it.f_warehouse_information AS fWarehouseLocationids,
  516. dicttr.dict_label AS fTrademodeid,
  517. it.f_qty AS fQty,
  518. it.f_grossweight AS fGrossweight,
  519. it.f_netweight AS fNetweight,
  520. CASE
  521. it.f_billtype
  522. WHEN 'SJRK' THEN
  523. '入库'
  524. WHEN 'SJCK' THEN
  525. '出库'
  526. WHEN 'CKDB' THEN
  527. '调拨'
  528. END AS fBilltype
  529. FROM
  530. t_warehousebills leg
  531. left join sys_user u on leg.create_by = u.user_name
  532. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  533. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  534. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  535. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  536. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  537. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  538. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  539. <where>
  540. dict.status = '0'
  541. AND dict.dict_type = 'storage_type'
  542. AND dicttr.STATUS = '0'
  543. AND dicttr.dict_type = 'data_trademodes'
  544. AND leg.f_billtype in ('SJRK','CKDB')
  545. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  546. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  547. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  548. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  549. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  550. <if test="fLocation != null and fLocation ==1 ">
  551. and it.f_warehouselocid = #{fWarehouseid}
  552. </if>
  553. <if test="fLocation != null and fLocation ==0 ">
  554. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  555. </if>
  556. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  557. and it.f_bsdate &gt;= #{timeInterval[0]}
  558. </if>
  559. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  560. and it.f_bsdate &lt;= #{timeInterval[1]}
  561. </if>
  562. </where>
  563. ${params.dataScope}
  564. </select>
  565. <select id="selectInventorySJCKList" parameterType="TWarehousebills" resultType="java.util.Map">
  566. SELECT
  567. co.f_name AS fName,
  568. it.f_bsdate AS fBsdate,
  569. leg.f_mblno AS fMblno,
  570. it.f_business_type AS fBusinessType,
  571. dict.dict_label AS fBusinessTypes,
  572. it.f_marks AS fMarks ,
  573. goo.f_name AS fGoodsName,
  574. dicttr.dict_label AS fTrademodeid,
  575. it.f_qty AS fQty,
  576. it.f_grossweight AS fGrossweight,
  577. it.f_netweight AS fNetweight,
  578. CASE
  579. it.f_billtype
  580. WHEN 'SJRK' THEN
  581. '入库'
  582. WHEN 'SJCK' THEN
  583. '出库'
  584. WHEN 'CKDB' THEN
  585. '调拨'
  586. END AS fBilltype ,
  587. CASE
  588. it.f_billtype
  589. WHEN 'SJRK' THEN
  590. it.f_warehouse_information
  591. WHEN 'SJCK' THEN
  592. it.f_warehouse_information
  593. WHEN 'CKDB' THEN
  594. it.f_orgwarehouse_information
  595. END AS fWarehouseLocationids
  596. FROM
  597. t_warehousebills leg
  598. left join sys_user u on leg.create_by = u.user_name
  599. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  600. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  601. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  602. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  603. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  604. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  605. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  606. <where>
  607. dict.status = '0'
  608. AND dict.dict_type = 'storage_type'
  609. AND dicttr.STATUS = '0'
  610. AND dicttr.dict_type = 'data_trademodes'
  611. AND leg.f_billtype in ('SJCK','CKDB')
  612. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  613. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  614. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  615. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  616. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  617. <if test="fLocation != null and fLocation ==1 ">
  618. and it.f_warehouselocid = #{fWarehouseid}
  619. </if>
  620. <if test="fLocation != null and fLocation ==0 ">
  621. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  622. </if>
  623. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  624. and it.f_bsdate &gt;= #{timeInterval[0]}
  625. </if>
  626. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  627. and it.f_bsdate &lt;= #{timeInterval[1]}
  628. </if>
  629. </where>
  630. ${params.dataScope}
  631. </select>
  632. <select id="selectTWarehousebillsItemList"
  633. resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
  634. SELECT
  635. ( @ii := @ii + 1 ) AS fId,
  636. co.f_name AS fCorpid,
  637. it.f_bsdate AS fBsdate,
  638. leg.f_mblno AS fMblno,
  639. dict.dict_label AS fBusinessType,
  640. it.f_marks AS fMarks,
  641. go.f_name AS fGoodsid,
  642. it.f_warehouse_information AS fWarehouseInformation,
  643. dicttr.dict_label AS fTrademodeid,
  644. it.f_qty AS fQty,
  645. it.f_grossweight AS fGrossweight,
  646. it.f_netweight AS fNetweight
  647. FROM
  648. t_warehousebills leg
  649. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  650. LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
  651. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  652. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  653. LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
  654. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
  655. SELECT
  656. @ii := 0
  657. ) AS ii
  658. WHERE
  659. dict.STATUS = '0'
  660. AND dict.dict_type = 'storage_type'
  661. AND dicttr.STATUS = '0'
  662. AND dicttr.dict_type = 'data_trademodes'
  663. AND leg.f_billtype IN (
  664. 'SJRk',
  665. 'SJCK'
  666. )
  667. <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
  668. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  669. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  670. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  671. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  672. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  673. <if test="fLocation != null and fLocation ==1 ">
  674. and it.f_warehouselocid = #{fWarehouseid}
  675. </if>
  676. <if test="fLocation != null and fLocation ==0 ">
  677. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  678. </if>
  679. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  680. and it.f_bsdate &gt;= #{timeInterval[0]}
  681. </if>
  682. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  683. and it.f_bsdate &lt;= #{timeInterval[1]}
  684. </if>
  685. </select>
  686. <select id="selectContainMblno" resultType="int">
  687. SELECT
  688. count( f_id )
  689. FROM
  690. t_warehouse
  691. where
  692. f_mblno = #{mblNo}
  693. AND f_bsdate &gt; #{currentDay[0]}
  694. AND f_bsdate &lt; #{currentDay[1]}
  695. </select>
  696. <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
  697. insert into t_warehousebills
  698. <trim prefix="(" suffix=")" suffixOverrides=",">
  699. <if test="fBillno != null">f_billno,</if>
  700. <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
  701. <if test="fOriginalbillno != null">f_originalbillno,</if>
  702. <if test="fDeptid != null">f_deptid,</if>
  703. <if test="fBsdeptid != null">f_bsdeptid,</if>
  704. <if test="fContacts != null">f_contacts,</if>
  705. <if test="fTel != null">f_tel,</if>
  706. <if test="fCorpid != null">f_corpid,</if>
  707. <if test="fTocorpid != null">f_tocorpid,</if>
  708. <if test="fStltypeid != null">f_stltypeid,</if>
  709. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno,</if>
  710. <if test="fWarehouseid != null">f_warehouseid,</if>
  711. <if test="fStorekeeper != null">f_storekeeper,</if>
  712. <if test="fChargedate != null">f_chargedate,</if>
  713. <if test="fBsdate != null">f_bsdate,</if>
  714. <if test="fPlanqty != null">f_planqty,</if>
  715. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  716. <if test="fPlannetweight != null">f_plannetweight,</if>
  717. <if test="fPlanvolumn != null">f_planvolumn,</if>
  718. <if test="fQty != null">f_qty,</if>
  719. <if test="fGrossweight != null">f_grossweight,</if>
  720. <if test="fNetweight != null">f_netweight,</if>
  721. <if test="fVolumn != null">f_volumn,</if>
  722. <if test="fTrademodeid != null">f_trademodeid,</if>
  723. <if test="fBillingway != null">f_billingway,</if>
  724. <if test="fSbu != null">f_sbu,</if>
  725. <if test="fFeetunit != null">f_feetunit,</if>
  726. <if test="fMblno != null">f_mblno,</if>
  727. <if test="fVslvoy != null">f_vslvoy,</if>
  728. <if test="fMarks != null and fMarks != ''">f_marks,</if>
  729. <if test="fEta != null">f_eta,</if>
  730. <if test="fCustomno != null">f_customno,</if>
  731. <if test="fIfweigh != null">f_ifweigh,</if>
  732. <if test="fIfpledge != null">f_ifpledge,</if>
  733. <if test="fIfdamage != null">f_ifdamage,</if>
  734. <if test="fBankcorpid != null">f_bankcorpid,</if>
  735. <if test="fBilltype != null">f_billtype,</if>
  736. <if test="fBillstatus != null">f_billstatus,</if>
  737. <if test="delFlag != null">del_flag,</if>
  738. <if test="createBy != null">create_by,</if>
  739. <if test="createTime != null">create_time,</if>
  740. <if test="fItemsStatus != null">f_items_status,</if>
  741. <if test="updateBy != null">update_by,</if>
  742. <if test="updateTime != null">update_time,</if>
  743. <if test="remark != null">remark,</if>
  744. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  745. <if test="fProductName != null">f_product_name,</if>
  746. <if test="fReviewDate != null">f_review_date,</if>
  747. <if test="fTruckno != null">f_truckno,</if>
  748. <if test="fDriverName != null">f_driver_name,</if>
  749. <if test="fDriverTel != null">f_driver_tel,</if>
  750. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  751. <if test="fBusinessType != null">f_business_type,</if>
  752. <if test="fLabour != null">f_labour,</if>
  753. <if test="fFleet != null">f_fleet,</if>
  754. <if test="fInwarehouseid != null">f_inwarehouseid,</if>
  755. <if test="fBstime != null">f_bstime,</if>
  756. <if test="fCartype != null">f_cartype,</if>
  757. <if test="fGoodsid != null">f_goodsid,</if>
  758. <if test="fNewTrademodeid != null">f_new_trademodeid,</if>
  759. </trim>
  760. <trim prefix="values (" suffix=")" suffixOverrides=",">
  761. <if test="fBillno != null">#{fBillno},</if>
  762. <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
  763. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  764. <if test="fDeptid != null">#{fDeptid},</if>
  765. <if test="fBsdeptid != null">#{fBsdeptid},</if>
  766. <if test="fContacts != null">#{fContacts},</if>
  767. <if test="fTel != null">#{fTel},</if>
  768. <if test="fCorpid != null">#{fCorpid},</if>
  769. <if test="fTocorpid != null">#{fTocorpid},</if>
  770. <if test="fStltypeid != null">#{fStltypeid},</if>
  771. <if test="fBscorpno != null and fBscorpno != ''">#{fBscorpno},</if>
  772. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  773. <if test="fStorekeeper != null">#{fStorekeeper},</if>
  774. <if test="fChargedate != null">#{fChargedate},</if>
  775. <if test="fBsdate != null">#{fBsdate},</if>
  776. <if test="fPlanqty != null">#{fPlanqty},</if>
  777. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  778. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  779. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  780. <if test="fQty != null">#{fQty},</if>
  781. <if test="fGrossweight != null">#{fGrossweight},</if>
  782. <if test="fNetweight != null">#{fNetweight},</if>
  783. <if test="fVolumn != null">#{fVolumn},</if>
  784. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  785. <if test="fBillingway != null">#{fBillingway},</if>
  786. <if test="fSbu != null">#{fSbu},</if>
  787. <if test="fFeetunit != null">#{fFeetunit},</if>
  788. <if test="fMblno != null">#{fMblno},</if>
  789. <if test="fVslvoy != null">#{fVslvoy},</if>
  790. <if test="fMarks != null and fMarks != ''">#{fMarks},</if>
  791. <if test="fEta != null">#{fEta},</if>
  792. <if test="fCustomno != null">#{fCustomno},</if>
  793. <if test="fIfweigh != null">#{fIfweigh},</if>
  794. <if test="fIfpledge != null">#{fIfpledge},</if>
  795. <if test="fIfdamage != null">#{fIfdamage},</if>
  796. <if test="fBankcorpid != null">#{fBankcorpid},</if>
  797. <if test="fBilltype != null">#{fBilltype},</if>
  798. <if test="fBillstatus != null">#{fBillstatus},</if>
  799. <if test="delFlag != null">#{delFlag},</if>
  800. <if test="createBy != null">#{createBy},</if>
  801. <if test="createTime != null">#{createTime},</if>
  802. <if test="fItemsStatus != null">#{fItemsStatus},</if>
  803. <if test="updateBy != null">#{updateBy},</if>
  804. <if test="updateTime != null">#{updateTime},</if>
  805. <if test="remark != null">#{remark},</if>
  806. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  807. <if test="fProductName != null">#{fProductName},</if>
  808. <if test="fReviewDate != null">#{fReviewDate},</if>
  809. <if test="fTruckno != null">#{fTruckno},</if>
  810. <if test="fDriverName != null">#{fDriverName},</if>
  811. <if test="fDriverTel != null">#{fDriverTel},</if>
  812. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  813. <if test="fBusinessType != null">#{fBusinessType},</if>
  814. <if test="fLabour != null">#{fLabour},</if>
  815. <if test="fFleet != null">#{fFleet},</if>
  816. <if test="fInwarehouseid != null">#{fInwarehouseid},</if>
  817. <if test="fBstime != null">#{fBstime},</if>
  818. <if test="fCartype != null">#{fCartype},</if>
  819. <if test="fGoodsid != null">#{fGoodsid},</if>
  820. <if test="fNewTrademodeid != null">#{fNewTrademodeid},</if>
  821. </trim>
  822. </insert>
  823. <update id="updateTWarehousebills" parameterType="TWarehousebills">
  824. update t_warehousebills
  825. <trim prefix="SET" suffixOverrides=",">
  826. <if test="fBillno != null">f_billno = #{fBillno},</if>
  827. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  828. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  829. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  830. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  831. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  832. <if test="fTel != null">f_tel = #{fTel},</if>
  833. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  834. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  835. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  836. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
  837. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  838. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  839. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  840. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  841. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  842. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  843. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  844. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  845. <if test="fQty != null">f_qty = #{fQty},</if>
  846. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  847. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  848. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  849. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  850. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  851. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  852. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  853. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  854. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  855. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  856. <if test="fEta != null">f_eta = #{fEta},</if>
  857. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  858. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  859. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  860. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  861. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  862. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  863. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  864. <if test="delFlag != null">del_flag = #{delFlag},</if>
  865. <if test="createBy != null">create_by = #{createBy},</if>
  866. <if test="createTime != null">create_time = #{createTime},</if>
  867. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  868. <if test="updateBy != null">update_by = #{updateBy},</if>
  869. <if test="updateTime != null">update_time = #{updateTime},</if>
  870. <if test="remark != null">remark = #{remark},</if>
  871. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  872. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  873. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  874. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  875. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  876. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  877. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  878. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  879. <if test="fReviewDate == null">f_review_date = null,</if>
  880. <if test="fLabour != null">f_labour = #{fLabour },</if>
  881. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  882. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  883. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  884. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  885. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  886. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  887. </trim>
  888. where f_id = #{fId}
  889. </update>
  890. <delete id="deleteTWarehousebillsById" parameterType="Long">
  891. delete from t_warehousebills where f_id = #{fId}
  892. </delete>
  893. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  894. delete
  895. item.*,
  896. bill.*,
  897. fess.*,
  898. enclosure.*
  899. from
  900. t_warehousebills bill
  901. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  902. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  903. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  904. where
  905. bill.f_id in
  906. <foreach item="fId" collection="array" open="(" separator="," close=")">
  907. #{fId}
  908. </foreach>
  909. </delete>
  910. <update id="warehouseFollowUpdate">
  911. update
  912. t_warehousebills
  913. <trim prefix="SET" suffixOverrides=",">
  914. <if test="fettle != null">f_billstatus = #{fettle},</if>
  915. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  916. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  917. </trim>
  918. where f_id = #{fPid}
  919. </update>
  920. <select id="selectDetailedList" resultType="java.util.Map">
  921. SELECT
  922. t.f_id AS fId,
  923. item.f_id AS fItemsId,
  924. C.f_name AS fcorpid,
  925. t.f_mblno AS fMblno,
  926. g.f_name AS fGoodsid,
  927. dict.dict_label AS fBusinessType,
  928. t.f_marks AS fMarks,
  929. CASE
  930. WHEN t.f_billtype = 'SJRK' THEN
  931. '入库'
  932. WHEN t.f_billtype = 'SJCK' THEN
  933. '出库'
  934. WHEN t.f_billtype = 'CKDB' THEN
  935. '调拨'
  936. WHEN t.f_billtype = 'HQZY' THEN
  937. '货权转移'
  938. WHEN t.f_billtype = 'HWTG' THEN
  939. '货物通关'
  940. END AS fBilltype,
  941. item.f_bsdate AS fBsdate,
  942. item.f_warehouse_information AS fWarehouseInformation,
  943. dictTra.dict_label AS fTrademodeid,
  944. CASE
  945. WHEN t.f_billtype = 'SJRK' THEN
  946. item.f_qty
  947. else '0'
  948. END AS fQtyRK,
  949. CASE
  950. WHEN t.f_billtype = 'SJRK' THEN
  951. item.f_grossweight
  952. else '0'
  953. END AS fGrossweightRK,
  954. CASE
  955. WHEN t.f_billtype = 'SJRK' THEN
  956. item.f_netweight
  957. else '0'
  958. END AS fNetweightRK,
  959. CASE
  960. WHEN t.f_billtype = 'SJCK' THEN
  961. item.f_qty
  962. else '0'
  963. END AS fQtyCK,
  964. CASE
  965. WHEN t.f_billtype = 'SJCK' THEN
  966. item.f_grossweight
  967. else '0'
  968. END AS fGrossweightCK,
  969. CASE
  970. WHEN t.f_billtype = 'SJCK' THEN
  971. item.f_netweight
  972. else '0'
  973. END AS fNetweightCK,
  974. CASE
  975. WHEN t.f_billtype = 'CKDB' THEN
  976. item.f_qty
  977. else '0'
  978. END AS fQtyDB,
  979. CASE
  980. WHEN t.f_billtype = 'CKDB' THEN
  981. item.f_grossweight
  982. else '0'
  983. END AS fGrossweightDB,
  984. CASE
  985. WHEN t.f_billtype = 'CKDB' THEN
  986. item.f_netweight
  987. else '0'
  988. END AS fNetweightDB,
  989. CASE
  990. WHEN t.f_billtype = 'HQZY' THEN
  991. item.f_qty
  992. else '0'
  993. END AS fQtyHZ,
  994. CASE
  995. WHEN t.f_billtype = 'HQZY' THEN
  996. item.f_grossweight
  997. else '0'
  998. END AS fGrossweightHZ,
  999. CASE
  1000. WHEN t.f_billtype = 'HQZY' THEN
  1001. item.f_netweight
  1002. else '0'
  1003. END AS fNetweightHZ,
  1004. CASE
  1005. WHEN t.f_billtype = 'HWTG' THEN
  1006. item.f_qty
  1007. else '0'
  1008. END AS fQtyTG,
  1009. CASE
  1010. WHEN t.f_billtype = 'HWTG' THEN
  1011. item.f_grossweight
  1012. else '0'
  1013. END AS fGrossweightTG,
  1014. CASE
  1015. WHEN t.f_billtype = 'HWTG' THEN
  1016. item.f_netweight
  1017. else '0'
  1018. END AS fNetweightTG
  1019. FROM
  1020. t_warehousebills t
  1021. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1022. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1023. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1024. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1025. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1026. WHERE
  1027. dict.STATUS = '0'
  1028. AND dict.dict_type = 'storage_type'
  1029. AND dictTra.STATUS = '0'
  1030. AND dictTra.dict_type = 'data_trademodes'
  1031. AND item.f_billstatus = 40
  1032. AND item.f_mblno = #{fMblno}
  1033. AND ( item.f_warehouselocid = #{fWarehouseLocationid} or
  1034. item.f_transfer_warehouselocid = #{fWarehouseLocationid} )
  1035. AND t.f_trademodeid = #{fTrademodeids}
  1036. AND item.f_business_type = #{fBusinessType}
  1037. AND item.f_goodsid = #{fGoodsid}
  1038. AND item.f_marks = #{fMarks}
  1039. AND t.f_corpid = #{fCorpIds}
  1040. </select>
  1041. </mapper>