TWhgenlegMapper.xml 52 KB

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