TWhgenlegMapper.xml 74 KB

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