TWhgenlegMapper.xml 67 KB

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