TWhgenlegMapper.xml 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353
  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. f_qtyD != 0
  1176. and f_qtyblc != 0
  1177. <if test="beginDate != null and beginDate != ''">and f_bsdate &gt;= #{beginDate}</if>
  1178. <if test="endDate != null and endDate != ''">and f_bsdate &lt;= #{endDate}</if>
  1179. <if test="external != null and external != ''">
  1180. and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1181. </if>
  1182. <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
  1183. <if test="customerId != null"> and f_corpid = #{customerId}</if>
  1184. </select>
  1185. <select id="stockTeuStatistics" resultType="map">
  1186. select
  1187. ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
  1188. ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
  1189. from t_warehousebills_cntr twc
  1190. left join t_warehousebills tb on twc.f_pid = tb.f_id
  1191. left join t_cntr tr on twc.f_cntrid = tr.f_id
  1192. where tb.f_items_status = '4'
  1193. <if test="beginDate != null and beginDate != ''">and tb.f_bsdate &gt;= #{beginDate}</if>
  1194. <if test="endDate != null and endDate != ''">and tb.f_bsdate &lt;= #{endDate}</if>
  1195. <if test="external != null and external != ''">
  1196. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1197. </if>
  1198. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1199. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1200. </select>
  1201. <select id="stockDays" resultType="map">
  1202. select datediff(date_format(now(),'%Y-%m-%d'),date_format(min(f_bsdate),'%Y-%m-%d')) as stockDays
  1203. from t_whgenleg
  1204. where
  1205. f_qtyD != 0
  1206. and f_qtyblc != 0
  1207. <if test="external != null and external != ''">
  1208. and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1209. </if>
  1210. <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
  1211. <if test="customerId != null"> and f_corpid = #{customerId}</if>
  1212. </select>
  1213. <select id="stockAfterMonthList" resultType="map">
  1214. select
  1215. tw.f_mblno as fMblno,
  1216. tg.f_name as goodsName,
  1217. tw.f_bsdate as fBsdate,
  1218. tc.f_name as customerName,
  1219. round(ifnull(tw.f_grossweightblc, 0) / 1000, 2) as fGrossweight
  1220. from t_whgenleg tw
  1221. left join t_goods tg on tg.f_id = tw.f_goodsid
  1222. left join t_corps tc on tw.f_corpid = tc.f_id
  1223. where
  1224. tw.f_qtyD != 0
  1225. and tw.f_qtyblc != 0
  1226. and datediff(date_format(now(),'%Y-%m-%d'),date_format(tw.f_bsdate,'%Y-%m-%d')) &gt; 30
  1227. <if test="external != null and external != ''">
  1228. and tw.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1229. </if>
  1230. order by tw.f_bsdate
  1231. </select>
  1232. <select id="biCustomerInfo" resultType="map">
  1233. select
  1234. ifnull(tw.f_shipper, tc.f_cname) as customerName,
  1235. <if test="mode == null or mode == ''">round(ifnull(sum(tw.f_grossweightblc), 0) / 1000) as quantity</if>
  1236. <if test="mode != null and mode != ''">
  1237. case #{mode}
  1238. when '3' then round(ifnull(sum(tw.f_volumnblc), 0))
  1239. when '2' then round(ifnull(sum(tw.f_grossweightblc) / 1000, 0))
  1240. else ifnull(sum(tw.f_qtyblc), 0)
  1241. end as quantity
  1242. </if>
  1243. from t_whgenleg tw left join t_corps tc on tw.f_corpid = tc.f_id
  1244. where
  1245. tw.f_qtyD != 0
  1246. and tw.f_qtyblc != 0
  1247. <if test="warehouseId != null"> and tw.f_warehouseid = #{warehouseId}</if>
  1248. <if test="external != null and external != ''">
  1249. and tw.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1250. </if>
  1251. <if test="customerId != null"> and tw.f_corpid = #{customerId}</if>
  1252. group by customerName
  1253. order by quantity desc limit 10
  1254. </select>
  1255. <select id="biWarehouseInfo" resultType="map">
  1256. select
  1257. t.f_cname as customerName,
  1258. <if test="mode == null or mode == ''">round(ifnull(sum(tw.f_grossweightblc), 0) / 1000) as quantity</if>
  1259. <if test="mode != null and mode != ''">
  1260. case #{mode}
  1261. when '3' then round(ifnull(sum(tw.f_volumnblc), 0))
  1262. when '2' then round(ifnull(sum(tw.f_grossweightblc) / 1000, 0))
  1263. else ifnull(sum(tw.f_qtyblc), 0)
  1264. end as quantity
  1265. </if>
  1266. from t_whgenleg tw left join t_warehouse t on tw.f_warehouseid = t.f_id
  1267. where
  1268. tw.f_qtyD != 0
  1269. and tw.f_qtyblc != 0
  1270. <if test="external != null and external != ''">
  1271. and tw.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1272. </if>
  1273. <if test="customerId != null"> and tw.f_corpid = #{customerId}</if>
  1274. group by customerName
  1275. order by quantity desc limit 10
  1276. </select>
  1277. <select id="biCustomerTeuInfo" resultType="map">
  1278. select
  1279. ifnull(tb.f_shipper, tc.f_cname) as customerName,
  1280. ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
  1281. ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
  1282. from t_warehousebills_cntr twc
  1283. left join t_warehousebills tb on twc.f_pid = tb.f_id
  1284. left join t_corps tc on tb.f_corpid = tc.f_id
  1285. left join t_cntr tr on twc.f_cntrid = tr.f_id
  1286. where tb.f_items_status = '4'
  1287. <if test="external != null and external != ''">
  1288. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1289. </if>
  1290. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1291. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1292. group by customerName
  1293. order by quantity desc limit 10
  1294. </select>
  1295. <select id="biWarehouseTeuInfo" resultType="map">
  1296. select
  1297. t.f_cname as customerName,
  1298. ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
  1299. ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
  1300. from t_warehousebills_cntr twc
  1301. left join t_warehousebills tb on twc.f_pid = tb.f_id
  1302. left join t_warehouse t on tb.f_warehouseid = t.f_id
  1303. left join t_cntr tr on twc.f_cntrid = tr.f_id
  1304. where tb.f_items_status = '4'
  1305. <if test="external != null and external != ''">
  1306. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1307. </if>
  1308. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1309. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1310. group by customerName
  1311. order by quantity desc limit 10
  1312. </select>
  1313. </mapper>