TWhgenlegMapper.xml 52 KB

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