TWhgenlegMapper.xml 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  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.reportManagement.mapper.TWhgenlegMapper">
  6. <resultMap type="TWhgenleg" id="TWhgenlegResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fAccyear" column="f_accyear"/>
  9. <result property="fAccmonth" column="f_accmonth"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fMblno" column="f_mblno"/>
  12. <result property="fOriginalbillno" column="f_originalbillno"/>
  13. <result property="fWarehouseLocationid" column="f_warehouse_locationid"/>
  14. <result property="fGoodsid" column="f_goodsid"/>
  15. <result property="fChargedate" column="f_chargedate"/>
  16. <result property="fTrademodeid" column="f_trademodeid"/>
  17. <result property="fPreqty" column="f_preqty"/>
  18. <result property="fWarehouseid" column="f_warehouseid"/>
  19. <result property="fPregrossweight" column="f_pregrossweight"/>
  20. <result property="fPrenetweight" column="f_prenetweight"/>
  21. <result property="fQtyd" column="f_qtyD"/>
  22. <result property="fVolumnd" column="f_volumnD"/>
  23. <result property="fBillingway" column="f_billingway"/>
  24. <result property="fGrossweightd" column="f_grossweightD"/>
  25. <result property="fNetweightd" column="f_netweightD"/>
  26. <result property="fVolumnc" column="f_volumnC"/>
  27. <result property="fQtyc" column="f_qtyC"/>
  28. <result property="fGrossweightc" column="f_grossweightC"/>
  29. <result property="fQtyblc" column="f_qtyblc"/>
  30. <result property="fGrossweightblc" column="f_grossweightblc"/>
  31. <result property="fNetweightc" column="f_netweightC"/>
  32. <result property="fNetweightblc" column="f_netweightblc"/>
  33. <result property="fCntrno" column="f_cntrno"/>
  34. <result property="fStatus" column="f_status"/>
  35. <result property="delFlag" column="del_flag"/>
  36. <result property="createBy" column="create_by"/>
  37. <result property="fMarks" column="f_marks"/>
  38. <result property="createTime" column="create_time"/>
  39. <result property="updateBy" column="update_by"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="remark" column="remark"/>
  42. <result property="fBusinessType" column="f_business_type"/>
  43. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  44. <result property="fLocalcntrno" column="f_localcntrno"/>
  45. <result property="fCustomno" column="f_customno"/>
  46. </resultMap>
  47. <resultMap type="CalculateStorageFeesInfoVO" id="StorageFeesInfoResult">
  48. <result property="fId" column="f_id"/>
  49. <result property="warehouse" column="f_warehouseid"/>
  50. <result property="fBillno" column="f_billno"/>
  51. <result property="fGoodsid" column="f_goodsid"/>
  52. <result property="fBsdate" column="f_bsdate"/>
  53. <result property="fBillingway" column="f_billingway"/>
  54. <result property="fBsdate" column="f_bsdate"/>
  55. <result property="fChargedate" column="f_chargedate"/>
  56. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  57. <result property="fMblno" column="f_mblno"/>
  58. <result property="fVolumn" column="f_volumn"/>
  59. <result property="fMarks" column="f_marks"/>
  60. <result property="ifCntrno" column="if_cntrno"/>
  61. <result property="fBillingDays" column="f_billing_days"/>
  62. <result property="fIsInventory" column="f_is_inventory"/>
  63. <result property="fQty" column="f_qty"/>
  64. <result property="warehouseLocationid" column="f_warehouse_locationid"/>
  65. <result property="fOrgwarehouseInformation" column="f_orgwarehouse_information"/>
  66. <result property="fGrossweight" column="f_grossweight"/>
  67. <result property="fNetweight" column="f_netweight"/>
  68. <result property="fBilltype" column="f_billtype"/>
  69. <result property="fTypeid" column="f_typeid"/>
  70. <result property="fCntrno" column="f_cntrno"/>
  71. <result property="goodsName" column="goods_name"/>
  72. </resultMap>
  73. <resultMap type="whgenlegVO" id="WhgenlegInfoResult">
  74. <result property="fId" column="f_id"/>
  75. <result property="corpName" column="corp_name"/>
  76. <result property="fMblno" column="f_mblno"/>
  77. <result property="fBusinessType" column="f_business_type"/>
  78. <result property="fMarks" column="f_marks"/>
  79. <result property="fBsdate" column="f_bsdate"/>
  80. <result property="fTrademodeid" column="f_trademodeid"/>
  81. <result property="fBilltype" column="f_billtype"/>
  82. <result property="qty" column="f_qty"/>
  83. <result property="grossweight" column="f_netweight"/>
  84. <result property="netweight" column="f_grossweight"/>
  85. </resultMap>
  86. <sql id="selectTWhgenlegVo">
  87. select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty,
  88. f_pregrossweight, f_warehouseid, f_prenetweight, f_bsdate, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC,
  89. f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, f_marks, create_by,
  90. create_time, update_by, f_volumnblc, update_time, remark, f_business_type, f_originalbilldate, f_localcntrno,f_customno from t_whgenleg
  91. </sql>
  92. <select id="selectTWhgenlegList" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  93. select
  94. ware.*
  95. from
  96. t_whgenleg ware
  97. left join sys_user u on ware.create_by = u.user_name
  98. left join sys_dept d on u.dept_id = d.dept_id
  99. <where>
  100. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  101. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  102. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  103. <if test="fPreqty != null ">and f_preqty = #{fPreqty}</if>
  104. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  105. <if test="fPregrossweight != null ">and f_pregrossweight = #{fPregrossweight}</if>
  106. <if test="fPrenetweight != null ">and f_prenetweight = #{fPrenetweight}</if>
  107. <if test="fQtyd != null ">and f_qtyD = #{fQtyd}</if>
  108. <if test="fVolumnd != null ">and f_volumnD = #{fVolumnd}</if>
  109. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  110. <if test="fGrossweightd != null ">and f_grossweightD = #{fGrossweightd}</if>
  111. <if test="fNetweightd != null ">and f_netweightD = #{fNetweightd}</if>
  112. <if test="fVolumnc != null ">and f_volumnC = #{fVolumnc}</if>
  113. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  114. <if test="fBusinessType != null "> and f_business_type = #{fBusinessType}</if>
  115. <if test="fQtyc != null ">and f_qtyC = #{fQtyc}</if>
  116. <if test="fGrossweightc != null ">and f_grossweightC = #{fGrossweightc}</if>
  117. <if test="fQtyblc != null ">and f_qtyblc = #{fQtyblc}</if>
  118. <if test="fGrossweightblc != null ">and f_grossweightblc = #{fGrossweightblc}</if>
  119. <if test="fNetweightc != null ">and f_netweightC = #{fNetweightc}</if>
  120. <if test="fNetweightblc != null ">and f_netweightblc = #{fNetweightblc}</if>
  121. <if test="fCntrno != null and fCntrno != ''">and f_cntrno = #{fCntrno}</if>
  122. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  123. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  124. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  125. <if test="fMblno != null and fMblno != ''">and f_mblno like concat('%',#{fMblno},'%')</if>
  126. </where>
  127. ${params.dataScope}
  128. </select>
  129. <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  130. <include refid="selectTWhgenlegVo"/>
  131. <where>
  132. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  133. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  134. <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
  135. <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
  136. <if test="fMarks != null ">and f_marks = #{fMarks}</if>
  137. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  138. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  139. <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
  140. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  141. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  142. </where>
  143. </select>
  144. <!--
  145. <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  146. <include refid="selectTWhgenlegVo"/>
  147. <where>
  148. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  149. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  150. <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
  151. <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
  152. <if test="fMarks != null ">and f_marks = #{fMarks}</if>
  153. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  154. <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
  155. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  156. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  157. </where>
  158. </select>
  159. -->
  160. <select id="selectTWhgenlegById" parameterType="Long" resultMap="TWhgenlegResult">
  161. <include refid="selectTWhgenlegVo"/>
  162. where f_id = #{fId}
  163. </select>
  164. <insert id="insertTWhgenleg" parameterType="TWhgenleg">
  165. insert into t_whgenleg
  166. <trim prefix="(" suffix=")" suffixOverrides=",">
  167. <if test="fAccyear != null">f_accyear,</if>
  168. <if test="fAccmonth != null">f_accmonth,</if>
  169. <if test="fCorpid != null">f_corpid,</if>
  170. <if test="fMblno != null">f_mblno,</if>
  171. <if test="fOriginalbillno != null">f_originalbillno,</if>
  172. <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
  173. <if test="fGoodsid != null">f_goodsid,</if>
  174. <if test="fTrademodeid != null">f_trademodeid,</if>
  175. <if test="fPreqty != null">f_preqty,</if>
  176. <if test="fPregrossweight != null">f_pregrossweight,</if>
  177. <if test="fWarehouseid != null">f_warehouseid,</if>
  178. <if test="fPrenetweight != null">f_prenetweight,</if>
  179. <if test="fBsdate != null">f_bsdate,</if>
  180. <if test="fChargedate != null">f_chargedate,</if>
  181. <if test="fVolumnd != null">f_volumnD,</if>
  182. <if test="fQtyd != null">f_qtyD,</if>
  183. <if test="fBillingway != null">f_billingway,</if>
  184. <if test="fGrossweightd != null">f_grossweightD,</if>
  185. <if test="fNetweightd != null">f_netweightD,</if>
  186. <if test="fVolumnc != null">f_volumnC,</if>
  187. <if test="fQtyc != null">f_qtyC,</if>
  188. <if test="fGrossweightc != null">f_grossweightC,</if>
  189. <if test="fQtyblc != null">f_qtyblc,</if>
  190. <if test="fGrossweightblc != null">f_grossweightblc,</if>
  191. <if test="fNetweightc != null">f_netweightC,</if>
  192. <if test="fNetweightblc != null">f_netweightblc,</if>
  193. <if test="fCntrno != null">f_cntrno,</if>
  194. <if test="fStatus != null">f_status,</if>
  195. <if test="delFlag != null">del_flag,</if>
  196. <if test="fMarks != null and fMarks != ''">f_marks,</if>
  197. <if test="createBy != null">create_by,</if>
  198. <if test="createTime != null">create_time,</if>
  199. <if test="updateBy != null">update_by,</if>
  200. <if test="fVolumnblc != null">f_volumnblc,</if>
  201. <if test="updateTime != null">update_time,</if>
  202. <if test="remark != null">remark,</if>
  203. <if test="fBusinessType != null">f_business_type,</if>
  204. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  205. <if test="fLocalcntrno != null">f_localcntrno,</if>
  206. </trim>
  207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  208. <if test="fAccyear != null">#{fAccyear},</if>
  209. <if test="fAccmonth != null">#{fAccmonth},</if>
  210. <if test="fCorpid != null">#{fCorpid},</if>
  211. <if test="fMblno != null">#{fMblno},</if>
  212. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  213. <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
  214. <if test="fGoodsid != null">#{fGoodsid},</if>
  215. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  216. <if test="fPreqty != null">#{fPreqty},</if>
  217. <if test="fPregrossweight != null">#{fPregrossweight},</if>
  218. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  219. <if test="fPrenetweight != null">#{fPrenetweight},</if>
  220. <if test="fBsdate != null">#{fBsdate},</if>
  221. <if test="fChargedate != null">#{fChargedate},</if>
  222. <if test="fVolumnd != null">#{fVolumnd},</if>
  223. <if test="fQtyd != null">#{fQtyd},</if>
  224. <if test="fBillingway != null">#{fBillingway},</if>
  225. <if test="fGrossweightd != null">#{fGrossweightd},</if>
  226. <if test="fNetweightd != null">#{fNetweightd},</if>
  227. <if test="fVolumnc != null">#{fVolumnc},</if>
  228. <if test="fQtyc != null">#{fQtyc},</if>
  229. <if test="fGrossweightc != null">#{fGrossweightc},</if>
  230. <if test="fQtyblc != null">#{fQtyblc},</if>
  231. <if test="fGrossweightblc != null">#{fGrossweightblc},</if>
  232. <if test="fNetweightc != null">#{fNetweightc},</if>
  233. <if test="fNetweightblc != null">#{fNetweightblc},</if>
  234. <if test="fCntrno != null">#{fCntrno},</if>
  235. <if test="fStatus != null">#{fStatus},</if>
  236. <if test="delFlag != null">#{delFlag},</if>
  237. <if test="fMarks != null and fMarks != ''">#{fMarks},</if>
  238. <if test="createBy != null">#{createBy},</if>
  239. <if test="createTime != null">#{createTime},</if>
  240. <if test="updateBy != null">#{updateBy},</if>
  241. <if test="fVolumnblc != null">#{fVolumnblc},</if>
  242. <if test="updateTime != null">#{updateTime},</if>
  243. <if test="remark != null">#{remark},</if>
  244. <if test="fBusinessType != null">#{fBusinessType},</if>
  245. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  246. <if test="fLocalcntrno != null">#{fLocalcntrno},</if>
  247. </trim>
  248. </insert>
  249. <update id="updateTWhgenleg" parameterType="TWhgenleg">
  250. update t_whgenleg
  251. <trim prefix="SET" suffixOverrides=",">
  252. <if test="fAccyear != null">f_accyear = #{fAccyear},</if>
  253. <if test="fAccmonth != null">f_accmonth = #{fAccmonth},</if>
  254. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  255. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  256. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  257. <if test="fWarehouseLocationid != null">f_warehouse_locationid = #{fWarehouseLocationid},</if>
  258. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  259. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  260. <if test="fPreqty != null">f_preqty = #{fPreqty},</if>
  261. <if test="fPregrossweight != null">f_pregrossweight = #{fPregrossweight},</if>
  262. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  263. <if test="fPrenetweight != null">f_prenetweight = #{fPrenetweight},</if>
  264. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  265. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  266. <if test="fVolumnd != null">f_volumnD = #{fVolumnd},</if>
  267. <if test="fQtyd != null">f_qtyD = #{fQtyd},</if>
  268. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  269. <if test="fGrossweightd != null">f_grossweightD = #{fGrossweightd},</if>
  270. <if test="fNetweightd != null">f_netweightD = #{fNetweightd},</if>
  271. <if test="fVolumnc != null">f_volumnC = #{fVolumnc},</if>
  272. <if test="fQtyc != null">f_qtyC = #{fQtyc},</if>
  273. <if test="fGrossweightc != null">f_grossweightC = #{fGrossweightc},</if>
  274. <if test="fQtyblc != null">f_qtyblc = #{fQtyblc},</if>
  275. <if test="fGrossweightblc != null">f_grossweightblc = #{fGrossweightblc},</if>
  276. <if test="fNetweightc != null">f_netweightC = #{fNetweightc},</if>
  277. <if test="fNetweightblc != null">f_netweightblc = #{fNetweightblc},</if>
  278. <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
  279. <if test="fStatus != null">f_status = #{fStatus},</if>
  280. <if test="delFlag != null">del_flag = #{delFlag},</if>
  281. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  282. <if test="createBy != null">create_by = #{createBy},</if>
  283. <if test="createTime != null">create_time = #{createTime},</if>
  284. <if test="updateBy != null">update_by = #{updateBy},</if>
  285. <if test="fVolumnblc != null">f_volumnblc = #{fVolumnblc},</if>
  286. <if test="updateTime != null">update_time = #{updateTime},</if>
  287. <if test="remark != null">remark = #{remark},</if>
  288. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  289. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  290. <if test="fLocalcntrno != null">f_localcntrno = #{fLocalcntrno},</if>
  291. </trim>
  292. where f_id = #{fId}
  293. </update>
  294. <update id="updateTWhgenlegData" parameterType="Map">
  295. update t_whgenleg
  296. <trim prefix="SET" suffixOverrides=",">
  297. /*判断是否入库*/
  298. <if test="map.billType == 'SJRK'">
  299. f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
  300. f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
  301. f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
  302. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
  303. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  304. ,f_chargedate = #{map.warehousebillsitems.fBsdate}
  305. <if test="map.warehousebillsitems.fCustomno != null and map.warehousebillsitems.fCustomno != ''">
  306. ,f_customno = #{map.warehousebillsitems.fCustomno}
  307. </if>
  308. <if test="map.warehousebillsitems.remark != null and map.warehousebillsitems.remark != ''">
  309. ,remark = #{map.warehousebillsitems.remark}
  310. </if>
  311. </if>
  312. /*判断是否撤销入库*/
  313. <if test="map.billType == 'SJRKRevoke'">
  314. f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
  315. f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
  316. f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
  317. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
  318. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  319. </if>
  320. /*判断是否出库*/
  321. <if test="map.billType == 'SJCK'">
  322. f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
  323. f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
  324. f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
  325. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
  326. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  327. </if>
  328. /*判断是否撤销出库*/
  329. <if test="map.billType == 'SJCKRevoke'">
  330. f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
  331. f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
  332. f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
  333. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
  334. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  335. </if>
  336. -- update_by = NOW()
  337. </trim>
  338. where f_id = #{map.whgenlegId}
  339. </update>
  340. <!--
  341. <update id="updateTWhgenlegData" parameterType="Map">
  342. update t_whgenleg
  343. <trim prefix="SET" suffixOverrides=",">
  344. /*判断是否入库*/
  345. <if test="map.billType == 'SJRK'">
  346. f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
  347. f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
  348. f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
  349. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
  350. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  351. <if test="map.warehousebillsitems.fBilltype != null and map.warehousebillsitems.fBilltype == 'HQZY'">
  352. ,f_chargedate = #{map.warehousebillsitems.fBsdate}
  353. </if>
  354. <if test="map.warehousebillsitems.fBilltype != null and map.warehousebillsitems.fBilltype != 'HQZY'">
  355. ,f_chargedate = #{map.warehousebillsitems.fChargedate}
  356. </if>
  357. <if test="map.warehousebillsitems.fCustomno != null and map.warehousebillsitems.fCustomno != ''">
  358. ,f_customno = #{map.warehousebillsitems.fCustomno}
  359. </if>
  360. <if test="map.warehousebillsitems.remark != null and map.warehousebillsitems.remark != ''">
  361. ,remark = #{map.warehousebillsitems.remark}
  362. </if>
  363. </if>
  364. /*判断是否撤销入库*/
  365. <if test="map.billType == 'SJRKRevoke'">
  366. f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
  367. f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
  368. f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
  369. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
  370. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  371. </if>
  372. /*判断是否出库*/
  373. <if test="map.billType == 'SJCK'">
  374. f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
  375. f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
  376. f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
  377. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
  378. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  379. </if>
  380. /*判断是否撤销出库*/
  381. <if test="map.billType == 'SJCKRevoke'">
  382. f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
  383. f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
  384. f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
  385. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
  386. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  387. </if>
  388. &#45;&#45; update_by = NOW()
  389. </trim>
  390. where f_id = #{map.whgenlegId}
  391. </update>
  392. -->
  393. <delete id="deleteTWhgenlegById" parameterType="Long">
  394. delete from t_whgenleg where f_id = #{fId}
  395. </delete>
  396. <delete id="deleteTWhgenlegByIds" parameterType="String">
  397. delete from t_whgenleg where f_id in
  398. <foreach item="fAccyear" collection="array" open="(" separator="," close=")">
  399. #{fId}
  400. </foreach>
  401. </delete>
  402. <select id="selectGoodsList" resultType="Map">
  403. SELECT
  404. t.f_goodsid AS fGoodsid,
  405. g.f_name AS fName
  406. FROM
  407. t_goods g
  408. RIGHT JOIN (
  409. SELECT
  410. f_goodsid AS f_goodsid
  411. FROM
  412. t_whgenleg
  413. GROUP BY
  414. f_goodsid
  415. ) t ON g.f_id = t.f_goodsid
  416. </select>
  417. <select id="selectGoodsListWhouse" resultType="Map">
  418. SELECT
  419. t.f_goodsid AS fGoodsid,
  420. g.f_name AS fName,
  421. w.f_name AS fWarehouseName,
  422. w.f_totalgross AS fTotalgross,
  423. t.f_grossweightblc AS fGrossweightD
  424. FROM
  425. t_goods g
  426. RIGHT JOIN (
  427. SELECT
  428. f_goodsid AS f_goodsid,
  429. f_warehouseid AS f_warehouseid,
  430. sum( f_grossweightblc ) AS f_grossweightblc
  431. FROM
  432. t_whgenleg
  433. GROUP BY
  434. f_goodsid,
  435. f_warehouseid
  436. ORDER BY
  437. sum( f_grossweightblc ) DESC
  438. ) t ON g.f_id = t.f_goodsid
  439. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  440. <where>
  441. <if test="fId != null ">and w.f_id = #{fId}</if>
  442. </where>
  443. </select>
  444. <select id="selectWareHouseList" resultType="Map">
  445. SELECT
  446. t.f_warehouseid AS fWarehouseid,
  447. w.f_name AS fName,
  448. t.f_grossweightblc AS fGrossweightD,
  449. w.f_totalgross AS fTotalgross
  450. FROM
  451. t_warehouse w
  452. RIGHT JOIN (
  453. SELECT
  454. f_warehouseid AS f_warehouseid,
  455. sum( f_grossweightblc ) AS f_grossweightblc
  456. FROM
  457. t_whgenleg
  458. GROUP BY
  459. f_warehouseid
  460. ORDER BY
  461. sum( f_grossweightblc ) DESC
  462. ) t ON w.f_id = t.f_warehouseid
  463. </select>
  464. <select id="selectWareHouseListWhouse" resultType="Map">
  465. SELECT
  466. t.f_warehouseid AS fWarehouseid,
  467. w.f_name AS fName,
  468. t.f_grossweightblc AS fGrossweightD,
  469. w.f_totalgross AS fTotalgross
  470. FROM
  471. t_warehouse w
  472. RIGHT JOIN (
  473. SELECT
  474. f_warehouseid AS f_warehouseid,
  475. sum( f_grossweightblc ) AS f_grossweightblc
  476. FROM
  477. t_whgenleg
  478. GROUP BY
  479. f_warehouseid
  480. ORDER BY
  481. sum( f_grossweightblc ) DESC
  482. ) t ON w.f_id = t.f_warehouseid
  483. <where>
  484. <if test="fId != null ">and w.f_id = #{fId}</if>
  485. </where>
  486. </select>
  487. <select id="selectCorpsList" resultType="Map">
  488. SELECT
  489. t.f_corpid AS fCorpid,
  490. c.f_name AS fName
  491. FROM
  492. t_corps c
  493. RIGHT JOIN (
  494. SELECT
  495. f_corpid AS f_corpid
  496. FROM
  497. t_whgenleg
  498. GROUP BY
  499. f_corpid
  500. ) t ON c.f_id = t.f_corpid
  501. </select>
  502. <select id="selectCorpsListWhouse" resultType="Map">
  503. SELECT
  504. t.f_corpid AS fCorpid,
  505. g.f_name AS fName,
  506. w.f_name AS fWarehouseName,
  507. w.f_totalgross AS fTotalgross,
  508. t.f_grossweightblc AS fGrossweightD
  509. FROM
  510. t_corps g
  511. RIGHT JOIN (
  512. SELECT
  513. f_corpid AS f_corpid,
  514. f_warehouseid AS f_warehouseid,
  515. sum( f_grossweightblc ) AS f_grossweightblc
  516. FROM
  517. t_whgenleg
  518. GROUP BY
  519. f_corpid,
  520. f_warehouseid
  521. ORDER BY
  522. sum( f_grossweightblc ) DESC
  523. ) t ON g.f_id = t.f_corpid
  524. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  525. <where>
  526. <if test="fId != null ">and w.f_id = #{fId}</if>
  527. </where>
  528. </select>
  529. <select id="selectDateFQtyblcListList" resultType="Map">
  530. SELECT
  531. t.f_originalbilldate AS fOriginalbilldate,
  532. sum(t.f_qtyblc) AS fQtyblc
  533. FROM
  534. t_whgenleg t
  535. WHERE
  536. t.f_originalbilldate &gt; #{map.frontday}
  537. AND t.f_originalbilldate &lt; #{map.nowadays}
  538. GROUP BY
  539. t.f_originalbilldate
  540. ORDER BY
  541. t.f_originalbilldate
  542. </select>
  543. <select id="selectStorageFeeItemList" parameterType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills" resultType="Map">
  544. SELECT
  545. wh.f_id AS fId,
  546. wh.f_originalbillno AS fBillno,
  547. wh.f_goodsid AS fGoodsid,
  548. wh.f_originalbilldate AS fBsdate,
  549. wh.f_billingway AS fBillingway,
  550. wh.f_mblno AS fMblno,
  551. wh.f_chargedate AS fChargedate,
  552. wh.f_originalbilldate AS fOriginalbilldate,
  553. wh.f_marks AS fMarks,
  554. wh.f_cntrno AS fCntrno,
  555. wh.f_volumnblc AS fVolumn,
  556. wh.f_qtyblc AS fQty,
  557. wh.f_grossweightblc AS fGrossweight,
  558. wh.f_netweightblc AS fNetweight,
  559. wh.f_warehouseid AS warehouse,
  560. wh.f_warehouse_locationid AS warehouseLocationid,
  561. "KCZZ" AS fBilltype,
  562. goods.if_cntrno AS ifCntrno,
  563. goods.f_typeid AS fTypeid,
  564. goods.f_name AS fGoodsids
  565. FROM
  566. t_whgenleg wh
  567. LEFT JOIN t_goods goods ON goods.f_id = wh.f_goodsid
  568. LEFT JOIN t_warehouse ware ON ware.f_id = wh.f_warehouseid
  569. <where>
  570. wh.f_corpid = #{warehouse.fCorpid}
  571. and ware.f_charg = 1
  572. and wh.f_chargedate &lt; #{warehouse.fBillingDeadline}
  573. <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and wh.f_goodsid = #{warehouse.fGoodsid}</if>
  574. <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and wh.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
  575. <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and wh.f_warehouseid = #{warehouse.fWarehouseid}</if>
  576. </where>
  577. </select>
  578. <select id="selectStorageFeeItemList1" resultType="java.util.Map" resultMap="StorageFeesInfoResult">
  579. SELECT
  580. wh.f_id,
  581. wh.f_originalbillno AS f_billno,
  582. wh.f_goodsid,
  583. wh.f_originalbilldate AS f_bsdate,
  584. wh.f_billingway,
  585. wh.f_mblno,
  586. wh.f_chargedate,
  587. wh.f_originalbilldate,
  588. wh.f_marks,
  589. wh.f_cntrno,
  590. wh.f_volumnblc AS f_volumn,
  591. wh.f_qtyblc AS f_qty,
  592. wh.f_grossweightblc AS f_grossweight,
  593. wh.f_netweightblc AS f_netweight,
  594. wh.f_warehouseid,
  595. wh.f_warehouse_locationid,
  596. "KCZZ" AS f_billtype,
  597. goods.if_cntrno,
  598. goods.f_typeid AS f_typeid,
  599. goods.f_name AS goods_name
  600. FROM
  601. t_whgenleg wh
  602. LEFT JOIN t_goods goods ON goods.f_id = wh.f_goodsid
  603. LEFT JOIN t_warehouse ware ON ware.f_id = wh.f_warehouseid
  604. <where>
  605. wh.f_corpid = #{warehouse.fCorpid}
  606. and ware.f_charg = 1
  607. and wh.f_chargedate &lt; #{warehouse.fBillingDeadline}
  608. <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and wh.f_goodsid = #{warehouse.fGoodsid}</if>
  609. <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and wh.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
  610. <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and wh.f_warehouseid = #{warehouse.fWarehouseid}</if>
  611. </where>
  612. </select>
  613. <select id="selectInventoryList" parameterType="TWhgenleg" resultType="Map">
  614. select
  615. DISTINCT
  616. leg.f_id AS fId,
  617. leg.f_corpid AS fCorpIds,
  618. leg.f_bsdate AS fBsdate,
  619. corp.f_name AS fCorpid,
  620. ware.f_warehouse_information AS fWarehouseids,
  621. area.f_name AS fWarehouseLocationids,
  622. leg.f_originalbillno AS fOriginalbillno,
  623. leg.f_warehouse_locationid AS fWarehouseLocationid,
  624. dict1.dict_label AS fTrademodeid,
  625. goods.f_name AS fGoodsids,
  626. leg.f_trademodeid AS fTrademodeids,
  627. goods.f_packagespecs AS fPackagespecs,
  628. leg.f_goodsid AS fGoodsid,
  629. leg.f_volumnD AS fVolumnD,
  630. leg.f_qtyD AS fQtyD,
  631. leg.f_mblno AS fMblno,
  632. leg.f_grossweightD AS fGrossweightD,
  633. leg.f_netweightD AS fNetweightD,
  634. leg.f_volumnC AS fVolumnC,
  635. leg.f_volumnblc AS fVolumnblc,
  636. leg.f_qtyC AS fQtyC,
  637. leg.f_business_type AS fBusinessType,
  638. leg.f_grossweightC AS fGrossweightC,
  639. leg.f_netweightC AS fNetweightC,
  640. leg.f_qtyblc AS fQtyblc,
  641. leg.f_billingway AS fBillingway,
  642. leg.f_chargedate AS fChargedate,
  643. leg.f_grossweightblc AS fGrossweightblc,
  644. leg.f_netweightblc AS fNetweightblc,
  645. leg.f_localcntrno AS fLocalcntrno,
  646. dict.dict_label AS fBusinessTypes,
  647. leg.f_marks AS fMarks,
  648. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  649. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  650. leg.f_cntrno AS fCntrno
  651. FROM
  652. t_whgenleg leg
  653. left join sys_user u on leg.create_by = u.user_name
  654. left join sys_dept d on u.dept_id = d.dept_id
  655. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  656. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  657. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  658. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  659. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  660. LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
  661. <where>
  662. dict.status = '0'
  663. AND dict1.status = '0'
  664. AND dict.dict_type = 'storage_type'
  665. AND dict1.dict_type = 'data_trademodes'
  666. AND leg.f_qtyD != 0
  667. AND leg.f_qtyblc != 0
  668. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  669. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  670. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  671. <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
  672. and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
  673. </if>
  674. <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
  675. and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
  676. </if>
  677. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  678. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  679. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  680. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  681. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  682. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  683. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  684. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  685. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  686. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  687. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  688. <if test="fMarks != null and fMarks != ''">and leg.f_marks LIKE concat('%', #{fMarks}, '%')</if>
  689. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  690. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  691. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  692. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  693. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  694. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno LIKE concat('%', #{fCntrno}, '%')</if>
  695. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  696. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  697. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  698. <if test="fLocation != null and fLocation ==1 ">
  699. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  700. </if>
  701. <if test="fLocation != null and fLocation ==0 ">
  702. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  703. </if>
  704. </where>
  705. ${params.dataScope}
  706. </select>
  707. <select id="selectInventoryMapList" parameterType="TWhgenleg" resultType="Map">
  708. select
  709. DISTINCT
  710. leg.f_id AS fId,
  711. leg.f_corpid AS fCorpIds,
  712. corp.f_name AS fCorpid,
  713. ware.f_warehouse_information AS fWarehouseids,
  714. area.f_name AS fWarehouseLocationids,
  715. leg.f_originalbillno AS fOriginalbillno,
  716. leg.f_warehouse_locationid AS fWarehouseLocationid,
  717. dict1.dict_label AS fTrademodeid,
  718. goods.f_name AS fGoodsids,
  719. leg.f_trademodeid AS fTrademodeids,
  720. goods.f_packagespecs AS fPackagespecs,
  721. leg.f_goodsid AS fGoodsid,
  722. IFNULL(SUM(leg.f_volumnD),0) AS fVolumnD,
  723. IFNULL(SUM(leg.f_qtyD),0) AS fQtyD,
  724. leg.f_mblno AS fMblno,
  725. IFNULL(SUM(leg.f_grossweightD),0) AS fGrossweightD,
  726. IFNULL(SUM(leg.f_netweightD),0) AS fNetweightD,
  727. IFNULL(SUM(leg.f_volumnC),0) AS fVolumnC,
  728. IFNULL(SUM(leg.f_volumnblc),0) AS fVolumnblc,
  729. SUM(leg.f_qtyC) AS fQtyC,
  730. leg.f_business_type AS fBusinessType,
  731. IFNULL(SUM(leg.f_grossweightC),0) AS fGrossweightC,
  732. IFNULL(SUM(leg.f_netweightC),0) AS fNetweightC,
  733. IFNULL(SUM(leg.f_qtyblc),0) AS fQtyblc,
  734. leg.f_billingway AS fBillingway,
  735. leg.f_chargedate AS fChargedate,
  736. IFNULL(SUM(leg.f_grossweightblc),0) AS fGrossweightblc,
  737. IFNULL(SUM(leg.f_netweightblc),0) AS fNetweightblc,
  738. dict.dict_label AS fBusinessTypes,
  739. leg.f_marks AS fMarks,
  740. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  741. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  742. leg.f_cntrno AS fCntrno,
  743. leg.f_localcntrno fLocalcntrno
  744. FROM
  745. t_whgenleg leg
  746. left join sys_user u on leg.create_by = u.user_name
  747. left join sys_user u1 on leg.create_by = u1.user_name
  748. left join sys_dept d on u.dept_id = d.dept_id
  749. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  750. LEFT JOIN t_customer_contact tc ON tc.f_pid = corp.f_id
  751. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  752. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  753. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  754. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  755. LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
  756. <where>
  757. dict.status = '0'
  758. AND dict1.status = '0'
  759. AND leg.f_qtyD != 0
  760. AND dict.dict_type = 'storage_type'
  761. AND dict1.dict_type = 'data_trademodes'
  762. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  763. <if test="fTel != null and fTel != ''">and tc.f_tel = #{fTel}</if>
  764. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  765. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  766. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  767. <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
  768. and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
  769. </if>
  770. <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
  771. and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
  772. </if>
  773. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  774. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  775. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  776. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  777. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  778. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  779. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  780. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  781. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  782. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  783. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  784. <if test="fMarks != null and fMarks != ''">and leg.f_marks LIKE concat('%', #{fMarks}, '%')</if>
  785. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  786. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  787. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  788. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  789. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  790. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  791. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  792. <if test="fLocation != null and fLocation ==1 ">
  793. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  794. </if>
  795. <if test="fCntrno != null and fCntrno != ''">
  796. and leg.f_cntrno LIKE concat('%', #{fCntrno}, '%')
  797. </if>
  798. <if test="fLocalcntrno != null and fLocalcntrno != ''">
  799. and leg.f_localcntrno LIKE concat('%', #{fLocalcntrno}, '%')
  800. </if>
  801. <if test="fLocation != null and fLocation ==0 ">
  802. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  803. </if>
  804. GROUP BY leg.f_corpid,leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid
  805. <if test="isCntrno != null and isCntrno == 0 ">
  806. ,leg.f_cntrno
  807. </if>
  808. <if test="isMblno != null and isMblno == 0 ">
  809. ,leg.f_mblno
  810. </if>
  811. </where>
  812. ${params.dataScope}
  813. </select>
  814. <select id="selectWhgenlegMessage" parameterType="TWhgenleg" resultType="com.ruoyi.reportManagement.excel.Whgenleg">
  815. select
  816. DISTINCT
  817. leg.f_id AS fId,
  818. leg.f_corpid AS fCorpIds,
  819. corp.f_name AS fCorpid,
  820. ware.f_warehouse_information AS fWarehouseids,
  821. area.f_name AS fWarehouseLocationids,
  822. leg.f_originalbillno AS fOriginalbillno,
  823. leg.f_warehouse_locationid AS fWarehouseLocationid,
  824. dict1.dict_label AS fTrademodeid,
  825. goods.f_name AS fGoodsids,
  826. leg.f_trademodeid AS fTrademodeids,
  827. goods.f_packagespecs AS fPackagespecs,
  828. leg.f_goodsid AS fGoodsid,
  829. leg.f_volumnD AS fVolumnD,
  830. leg.f_qtyD AS fQtyD,
  831. leg.f_mblno AS fMblno,
  832. leg.f_grossweightD AS fGrossweightD,
  833. leg.f_netweightD AS fNetweightD,
  834. leg.f_volumnC AS fVolumnC,
  835. leg.f_volumnblc AS fVolumnblc,
  836. leg.f_qtyC AS fQtyC,
  837. leg.f_business_type AS fBusinessType,
  838. leg.f_grossweightC AS fGrossweightC,
  839. leg.f_netweightC AS fNetweightC,
  840. leg.f_qtyblc AS fQtyblc,
  841. leg.f_billingway AS fBillingway,
  842. leg.f_chargedate AS fChargedate,
  843. leg.f_grossweightblc AS fGrossweightblc,
  844. leg.f_netweightblc AS fNetweightblc,
  845. leg.f_localcntrno AS fLocalcntrno,
  846. dict.dict_label AS fBusinessTypes,
  847. leg.f_marks AS fMarks,
  848. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  849. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  850. leg.f_cntrno AS fCntrno
  851. FROM
  852. t_whgenleg leg
  853. left join sys_user u on leg.create_by = u.user_name
  854. left join sys_dept d on u.dept_id = d.dept_id
  855. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  856. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  857. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  858. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  859. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  860. LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
  861. <where>
  862. dict.status = '0'
  863. AND dict1.status = '0'
  864. AND dict.dict_type = 'storage_type'
  865. AND dict1.dict_type = 'data_trademodes'
  866. AND leg.f_qtyD != 0
  867. AND leg.f_qtyblc != 0
  868. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  869. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  870. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  871. <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
  872. and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
  873. </if>
  874. <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
  875. and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
  876. </if>
  877. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  878. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  879. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  880. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  881. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  882. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  883. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  884. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  885. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  886. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  887. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  888. <if test="fMarks != null and fMarks != ''">and leg.f_marks LIKE concat('%', #{fMarks}, '%')</if>
  889. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  890. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  891. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  892. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  893. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  894. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno LIKE concat('%', #{fCntrno}, '%')</if>
  895. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  896. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  897. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  898. <if test="fLocation != null and fLocation ==1 ">
  899. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  900. </if>
  901. <if test="fLocation != null and fLocation ==0 ">
  902. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  903. </if>
  904. </where>
  905. ${params.dataScope}
  906. </select>
  907. <select id="selectWhgenlegList" resultType="java.util.Map">
  908. select
  909. DISTINCT
  910. leg.f_id AS fId,
  911. corp.f_name AS fCorpid,
  912. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  913. ware.f_warehouse_information AS fWarehouseids,
  914. leg.f_mblno AS fMblno,
  915. goods.f_name AS fGoodsids,
  916. dict.dict_label AS fBusinessTypes,
  917. leg.f_marks AS fMarks,
  918. leg.f_qtyblc AS fQtyblc,
  919. leg.f_grossweightblc AS fGrossweightblc,
  920. leg.f_netweightblc AS fNetweightblc
  921. FROM
  922. t_whgenleg leg
  923. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  924. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  925. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  926. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  927. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  928. <where>
  929. dict.status = '0'
  930. AND dict.dict_type = 'storage_type'
  931. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  932. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  933. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  934. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  935. <if test='timeStartBsdate != null'>
  936. and leg.f_originalbilldate &gt;= #{timeStartBsdate}
  937. </if>
  938. <if test='timeEndBsdate != null'>
  939. and leg.f_originalbilldate &lt;= #{timeEndBsdate}
  940. </if>
  941. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  942. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  943. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  944. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  945. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  946. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  947. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  948. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  949. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  950. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  951. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  952. <if test="fMarks != null and fMarks != ''">and leg.f_marks = #{fMarks}</if>
  953. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  954. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  955. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  956. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  957. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  958. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno = #{fCntrno}</if>
  959. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  960. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  961. <if test="fLocation != null and fLocation ==1 ">
  962. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  963. </if>
  964. <if test="fLocation != null and fLocation ==0 ">
  965. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  966. </if>
  967. </where>
  968. </select>
  969. <!--根据客户id或加上提单号查询库存不为0的仓库名-->
  970. <select id="getWarehouse" parameterType="TWhgenleg" resultType="Map">
  971. SELECT
  972. DISTINCT
  973. th.f_id AS fId,
  974. th.f_name AS fName
  975. FROM
  976. t_whgenleg tw
  977. LEFT JOIN t_warehouse th ON th.f_id = tw.f_warehouseid
  978. WHERE tw.f_qtyblc > 0
  979. AND f_corpid = #{fCorpid}
  980. AND f_mblno = #{fMblno}
  981. </select>
  982. <select id="queryChangedByFchargedate" resultType="java.lang.Integer">
  983. SELECT
  984. count( f_id )
  985. FROM
  986. t_whgenleg
  987. WHERE
  988. f_chargedate != #{time}
  989. <foreach collection="ids" item="id" open="and f_id in(" separator="," close=")">
  990. #{id}
  991. </foreach>
  992. </select>
  993. <select id="selectStockDetailsList" resultMap="WhgenlegInfoResult">
  994. SELECT
  995. w.f_id, c.f_name, wh.f_mblno, t.f_business_type, t.f_marks, t.f_billtype, w.f_trademodeid,
  996. t.f_qty, t.f_grossweight, t.f_netweight
  997. FROM
  998. t_whgenleg wh
  999. RIGHT JOIN t_corps c ON c.f_id = wh.f_corpid
  1000. RIGHT JOIN t_warehousebills w ON w.f_corpid = wh.f_corpid
  1001. AND w.f_trademodeid = wh.f_trademodeid
  1002. RIGHT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id AND t.f_mblno = wh.f_mblno
  1003. AND t.f_business_type = wh.f_business_type
  1004. AND t.f_marks = wh.f_marks
  1005. AND t.f_goodsid = wh.f_goodsid
  1006. AND t.f_warehouselocid = wh.f_warehouse_locationid
  1007. AND IF(w.f_billtype = 'SJRK', t.f_originalbilldate = wh.f_bsdate, t.f_src_bsdate = wh.f_bsdate)
  1008. WHERE
  1009. wh.f_id = #{fId}
  1010. and w.f_billtype in ('SJRK', 'SJCK')
  1011. GROUP BY t.f_id
  1012. </select>
  1013. <select id="selectOtherDetailsList" resultMap="WhgenlegInfoResult">
  1014. SELECT
  1015. w.f_id, c.f_name, wh.f_mblno, t.f_business_type, t.f_marks, t.f_bsdate, t.f_billtype,
  1016. w.f_trademodeid, t.f_qty, t.f_grossweight, t.f_netweight
  1017. FROM
  1018. t_whgenleg wh
  1019. RIGHT JOIN t_corps c ON c.f_id = wh.f_corpid
  1020. RIGHT JOIN t_warehousebills w ON wh.f_corpid in (w.f_corpid, w.f_tocorpid)
  1021. AND IF ( w.f_billtype = 'HWTG', wh.f_trademodeid IN ( w.f_trademodeid, w.f_new_trademodeid ), w.f_trademodeid = wh.f_trademodeid )
  1022. RIGHT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  1023. AND t.f_mblno = wh.f_mblno
  1024. AND t.f_business_type = wh.f_business_type
  1025. AND t.f_marks = wh.f_marks
  1026. AND t.f_goodsid = wh.f_goodsid
  1027. AND wh.f_warehouse_locationid IN ( t.f_warehouselocid, t.f_transfer_warehouselocid )
  1028. AND wh.f_bsdate IN ( t.f_src_bsdate, t.f_bsdate )
  1029. WHERE
  1030. wh.f_id = #{fId}
  1031. AND w.f_billtype IN ('CKDB','HWTG','HQZY')
  1032. GROUP BY t.f_id
  1033. </select>
  1034. </mapper>