TWarehousebillsitemsMapper.xml 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  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.warehouseBusiness.mapper.TWarehousebillsitemsMapper">
  6. <resultMap type="TWarehousebillsitems" id="TWarehousebillsitemsResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fSrcid" column="f_srcid"/>
  10. <result property="fLineno" column="f_lineno"/>
  11. <result property="fBillno" column="f_billno"/>
  12. <result property="fShipper" column="f_shipper"/>
  13. <result property="fGoodsid" column="f_goodsid"/>
  14. <result property="fSrcBsdate" column="f_src_bsdate"/>
  15. <result property="fMblno" column="f_mblno"/>
  16. <result property="fOriginalbillno" column="f_originalbillno"/>
  17. <result property="fTransferWarehouselocid" column="f_transfer_warehouselocid"/>
  18. <result property="fWarehouselocid" column="f_warehouselocid"/>
  19. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  20. <result property="fBsdate" column="f_bsdate"/>
  21. <result property="fBillingway" column="f_billingway"/>
  22. <result property="fChargedate" column="f_chargedate"/>
  23. <result property="fBoxno" column="f_boxno"/>
  24. <result property="fGoodsval" column="f_goodsval"/>
  25. <result property="fCntqty" column="f_cntqty"/>
  26. <result property="fPackagespecs" column="f_packagespecs"/>
  27. <result property="fCntrtype" column="f_cntrtype"/>
  28. <result property="fPlanvolumn" column="f_planvolumn"/>
  29. <result property="fPlanqty" column="f_planqty"/>
  30. <result property="fPlangrossweight" column="f_plangrossweight"/>
  31. <result property="fPlannetweight" column="f_plannetweight"/>
  32. <result property="fVolumn" column="f_volumn"/>
  33. <result property="fQty" column="f_qty"/>
  34. <result property="fGrossweight" column="f_grossweight"/>
  35. <result property="fNetweight" column="f_netweight"/>
  36. <result property="fCntrno" column="f_cntrno"/>
  37. <result property="fTruckno" column="f_truckno"/>
  38. <result property="fMarks" column="f_marks"/>
  39. <result property="fActualWeight" column="f_actual_weight"/>
  40. <result property="fBillstatus" column="f_billstatus"/>
  41. <result property="delFlag" column="del_flag"/>
  42. <result property="createBy" column="create_by"/>
  43. <result property="createTime" column="create_time"/>
  44. <result property="updateBy" column="update_by"/>
  45. <result property="updateTime" column="update_time"/>
  46. <result property="remark" column="remark"/>
  47. <result property="fInventoryDays" column="f_inventory_days"/>
  48. <result property="fStorageFeeDeadline" column="f_storage_fee_deadline"/>
  49. <result property="fAmt" column="f_amt"/>
  50. <result property="fBillingDays" column="f_billing_days"/>
  51. <result property="fDriverName" column="f_driver_name"/>
  52. <result property="fDriverTel" column="f_driver_tel"/>
  53. <result property="fDriverIdCar" column="f_driver_id_car"/>
  54. <result property="fSerialNumber" column="f_serial_number"/>
  55. <result property="fIsPass" column="f_is_pass"/>
  56. <result property="fBilltype" column="f_billtype"/>
  57. <result property="fBillingQty" column="f_billing_qty"/>
  58. <result property="fBillingDeadline" column="f_billing_deadline"/>
  59. <result property="fBusinessType" column="f_business_type"/>
  60. <result property="fIsInventory" column="f_is_inventory"/>
  61. <result property="fWarehouseInformation" column="f_warehouse_information"/>
  62. <result property="fOrgwarehouseInformation" column="f_orgwarehouse_information"/>
  63. <result property="fLabour" column="f_labour"/>
  64. <result property="fFleet" column="f_fleet"/>
  65. <result property="fStevedore" column="f_stevedore"/>
  66. <result property="fLntype" column="f_lntype"/>
  67. <result property="fForkliftman" column="f_forkliftman"/>
  68. <result property="fLocalcntrno" column="f_localcntrno"/>
  69. <result property="fSealno" column="f_sealno"/>
  70. <result property="fNowCarton" column="f_now_carton" />
  71. <result property="fItemstatus" column="f_itemstatus" />
  72. <result property="fCartypeId" column="f_cartype_id" />
  73. <result property="fDc" column="f_dc" />
  74. <result property="fTocorpid" column="f_tocorpid" />
  75. <result property="isCalculateStorageFees" column="is_calculate_storage_fees" />
  76. </resultMap>
  77. <resultMap type="WarehouseTimeIntervalVO" id="WarehouseTimeIntervalResult">
  78. <result property="sumQty" column="f_qty" />
  79. <result property="warehouseId" column="f_warehouseid" />
  80. </resultMap>
  81. <resultMap type="CalculateStorageFeesInfoVO" id="StorageFeesInfoResult">
  82. <result property="warehouse" column="f_warehouseid"/>
  83. <result property="fId" column="f_id"/>
  84. <result property="warehouse" column="f_warehouseid"/>
  85. <result property="fBillno" column="f_billno"/>
  86. <result property="fGoodsid" column="f_goodsid"/>
  87. <result property="fBsdate" column="f_bsdate"/>
  88. <result property="fBillingway" column="f_billingway"/>
  89. <result property="fChargedate" column="f_chargedate"/>
  90. <result property="fSrcBsdate" column="f_src_bsdate"/>
  91. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  92. <result property="fMblno" column="f_mblno"/>
  93. <result property="fVolumn" column="f_volumn"/>
  94. <result property="fMarks" column="f_marks"/>
  95. <result property="fBillingDays" column="f_billing_days"/>
  96. <result property="fIsInventory" column="f_is_inventory"/>
  97. <result property="fQty" column="f_qty"/>
  98. <result property="fOrgwarehouseInformation" column="f_orgwarehouse_information"/>
  99. <result property="fGrossweight" column="f_grossweight"/>
  100. <result property="fNetweight" column="f_netweight"/>
  101. <result property="fBilltype" column="f_billtype"/>
  102. <result property="fTypeid" column="f_typeid"/>
  103. <result property="goodsName" column="f_name"/>
  104. </resultMap>
  105. <sql id="selectTWarehousebillsitemsVo">
  106. select f_id, f_pid, f_srcid, f_lineno, f_billno, f_shipper, f_goodsid, f_mblno, f_src_bsdate, f_originalbillno, f_transfer_warehouselocid, f_warehouselocid,
  107. f_originalbilldate, f_bsdate, f_billingway, f_chargedate, f_boxno, f_goodsval, f_cntqty, f_packagespecs, f_cntrtype, f_planvolumn,
  108. f_planqty, f_plangrossweight, f_plannetweight, f_volumn, f_qty, f_grossweight, f_netweight, f_cntrno, f_truckno, f_marks, f_actual_weight, f_billstatus,
  109. del_flag, create_by, create_time, update_by, update_time, remark, f_inventory_days, f_storage_fee_deadline, f_amt, f_billing_days,
  110. f_driver_name, f_driver_tel, f_driver_id_car, f_serial_number, f_is_pass, f_billtype, f_billing_qty, f_billing_deadline, f_business_type,
  111. f_is_inventory, f_warehouse_information, f_orgwarehouse_information, f_labour, f_fleet, f_stevedore, f_lntype, f_forkliftman,
  112. f_localcntrno, f_sealno,f_now_carton,f_itemstatus,f_cartype_id,f_dc,is_calculate_storage_fees from t_warehousebillsitems
  113. </sql>
  114. <select id="selectTWarehousebillsitemsList" parameterType="TWarehousebillsitems"
  115. resultMap="TWarehousebillsitemsResult">
  116. <include refid="selectTWarehousebillsitemsVo"/>
  117. <where>
  118. <if test="fPid != null ">and f_pid = #{fPid}</if>
  119. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  120. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  121. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  122. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  123. <if test="fShipper != null and fShipper != ''">and f_shipper like concat('%', #{fShipper}, '%')</if>
  124. <if test="fSrcBsdate != null ">and f_src_bsdate = #{fSrcBsdate}</if>
  125. <if test="fWarehouselocid != null ">and f_warehouselocid = #{fWarehouselocid}</if>
  126. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  127. <if test="fLabour != null ">and f_labour = #{fLabour}</if>
  128. <if test="fLabour != null ">and f_labour = #{fLabour}</if>
  129. <if test="fFleet != null ">and f_fleet = #{fFleet}</if>
  130. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  131. <if test="fBoxno != null and fBoxno != ''">and f_boxno = #{fBoxno}</if>
  132. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  133. <if test="fStorageFeeDeadline != null "> and f_storage_fee_deadline = #{fStorageFeeDeadline}</if>
  134. <if test="fTransferWarehouselocid != null "> and f_transfer_warehouselocid = #{fTransferWarehouselocid}</if>
  135. <if test="fCntqty != null ">and f_cntqty = #{fCntqty}</if>
  136. <if test="fGoodsval != null ">and f_goodsval = #{fGoodsval}</if>
  137. <if test="fCntrtype != null and fCntrtype != ''">and f_cntrtype = #{fCntrtype}</if>
  138. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  139. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  140. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  141. <if test="fIsInventory != null ">and f_is_inventory = #{fIsInventory}</if>
  142. <if test="fPackagespecs != null ">and f_packagespecs = #{fPackagespecs}</if>
  143. <if test="fBusinessType != null "> and f_business_type = #{fBusinessType}</if>
  144. <if test="fWarehouseInformation != null "> and f_warehouse_information = #{fWarehouseInformation}</if>
  145. <if test="fOrgwarehouseInformation != null "> and f_orgwarehouse_information = #{fOrgwarehouseInformation}</if>
  146. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  147. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  148. <if test="fQty != null ">and f_qty = #{fQty}</if>
  149. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  150. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  151. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  152. <if test="fCntrno != null and fCntrno != ''">and f_cntrno = #{fCntrno}</if>
  153. <if test="fTruckno != null and fTruckno != ''">and f_truckno = #{fTruckno}</if>
  154. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  155. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  156. <if test="fActualWeight != null and fActualWeight != ''">and f_actual_weight = #{fActualWeight}</if>
  157. <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
  158. <if test="fAmt != null ">and f_amt = #{fAmt}</if>
  159. <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
  160. <if test="fDriverName != null and fDriverName != ''">and f_driver_name like concat('%',
  161. #{fDriverName},'%')
  162. </if>
  163. <if test="fDriverTel != null and fDriverTel != ''">and f_driver_tel = #{fDriverTel}</if>
  164. <if test="fDriverIdCar != null and fDriverIdCar != ''">and f_driver_id_car = #{fDriverIdCar}</if>
  165. <if test="fSerialNumber != null and fSerialNumber != ''">and f_serial_number = #{fSerialNumber}</if>
  166. <if test="fIsPass != null and fIsPass != ''">and f_is_pass = #{fIsPass}</if>
  167. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  168. </where>
  169. </select>
  170. <select id="selectTWarehousebillsitemsListByPidToType" parameterType="TWarehousebillsitems"
  171. resultMap="TWarehousebillsitemsResult">
  172. <include refid="selectTWarehousebillsitemsVo"/>
  173. where
  174. f_pid = #{fPid}
  175. and
  176. f_billtype = #{fBilltype}
  177. </select>
  178. <select id="selectGoodsTransferitemsList" parameterType="TWarehousebillsitems" resultType="Map">
  179. SELECT DISTINCT
  180. item.f_id AS fId,
  181. item.f_pid AS fPid,
  182. item.f_srcid AS fSrcid,
  183. item.f_lineno AS fLineno,
  184. item.f_billno AS fBillno,
  185. item.f_shipper AS fShipper,
  186. item.f_goodsid AS fGoodsid,
  187. goods.f_name AS fGoodsids,
  188. goods.if_cntrno AS ifCntrno,
  189. item.f_warehouselocid AS fWarehouselocid,
  190. area.f_name AS fWarehouselocids,
  191. ware.f_name AS fWarehouseids,
  192. item.f_is_pass AS fIsPass,
  193. item.f_originalbillno AS fOriginalbillno,
  194. item.f_src_bsdate AS fSrcBsdate,
  195. item.f_mblno AS fMblno,
  196. item.f_bsdate AS fBsdate,
  197. item.f_boxno AS fBoxno,
  198. item.f_cntqty AS fCntqty,
  199. item.f_goodsval AS fGoodsval,
  200. item.f_cntrtype AS fCntrtype,
  201. item.f_planqty AS fPlanqty,
  202. item.f_planvolumn AS fPlanvolumn,
  203. item.f_billingway AS fBillingway,
  204. item.f_chargedate AS fChargedate,
  205. item.f_packagespecs AS fPackagespecs,
  206. item.f_plangrossweight AS fPlangrossweight,
  207. item.f_originalbilldate AS fOriginalbilldate,
  208. item.f_plannetweight AS fPlannetweight,
  209. item.f_transfer_warehouselocid AS fTransferWarehouselocid,
  210. w.f_storekeeper fStorekeeper,
  211. item.f_qty AS fQty,
  212. item.f_volumn AS fVolumn,
  213. item.f_driver_name AS fDriverName,
  214. item.f_driver_tel AS fDriverTel,
  215. item.f_driver_id_car AS fDriverIdCar,
  216. item.f_serial_number AS fSerialNumber,
  217. item.f_marks AS fMarks,
  218. item.f_actual_weight AS fActualWeight,
  219. item.f_grossweight AS fGrossweight,
  220. item.f_is_inventory AS fIsInventory,
  221. item.f_business_type AS fBusinessType,
  222. item.f_netweight AS fNetweight,
  223. item.f_cntrno AS fCntrno,
  224. item.f_truckno AS fTruckno,
  225. item.f_billstatus AS fBillstatus,
  226. item.f_itemstatus AS fItemstatus,
  227. item.remark,
  228. b.f_name AS fLabours,
  229. item.f_labour AS fLabour,
  230. f.f_name AS fFleets,
  231. item.f_fleet AS fFleet,
  232. item.f_stevedore AS fStevedore,
  233. item.f_forkliftman AS fForkliftman,
  234. item.f_localcntrno AS fLocalcntrno,
  235. l.dict_label AS fLntypes,
  236. item.f_lntype AS fLntype,
  237. item.f_sealno AS fSealno,
  238. item.f_warehouse_information AS fWarehouseInformation,
  239. item.f_orgwarehouse_information AS fOrgwarehouseInformation,
  240. item.f_now_carton AS fNowCarton,
  241. item.f_cartype_id AS fCartypeId,
  242. item.f_dc AS fDc,
  243. item.create_time AS createTime,
  244. tf.f_accbilldate AS fAccbilldate,
  245. tf.invoice_no AS invoiceNo,
  246. tf.f_apply_money AS fApplyMoney
  247. FROM
  248. t_warehousebills w
  249. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  250. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  251. LEFT JOIN t_warehouse_area area ON area.f_id = item.f_warehouselocid
  252. LEFT JOIN t_warehouse ware ON ware.f_id = area.f_warehouseid
  253. LEFT JOIN t_corps b ON b.f_id = item.f_labour
  254. LEFT JOIN t_corps f ON f.f_id = item.f_fleet
  255. LEFT JOIN sys_dict_data l ON l.dict_value = item.f_lntype
  256. AND l.dict_type = 'ln_way'
  257. Left join t_fee tf on tf.t_mblno = w.f_mblno
  258. WHERE
  259. item.f_pid = #{fPid}
  260. </select>
  261. <select id="selectTWarehousebillsitemsById" parameterType="Long" resultMap="TWarehousebillsitemsResult">
  262. <include refid="selectTWarehousebillsitemsVo"/>
  263. where f_id = #{fId}
  264. </select>
  265. <insert id="insertTWarehousebillsitems" parameterType="TWarehousebillsitems" useGeneratedKeys="true" keyProperty="fId">
  266. insert into t_warehousebillsitems
  267. <trim prefix="(" suffix=")" suffixOverrides=",">
  268. <if test="fId != null">f_id,</if>
  269. <if test="fPid != null">f_pid,</if>
  270. <if test="fSrcid != null">f_srcid,</if>
  271. <if test="fLineno != null">f_lineno,</if>
  272. <if test="fBillno != null">f_billno,</if>
  273. <if test="fShipper != null">f_shipper,</if>
  274. <if test="fGoodsid != null">f_goodsid,</if>
  275. <if test="fMblno != null">f_mblno,</if>
  276. <if test="fSrcBsdate != null">f_src_bsdate,</if>
  277. <if test="fOriginalbillno != null">f_originalbillno,</if>
  278. <if test="fTransferWarehouselocid != null">f_transfer_warehouselocid,</if>
  279. <if test="fWarehouselocid != null">f_warehouselocid,</if>
  280. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  281. <if test="fBsdate != null">f_bsdate,</if>
  282. <if test="fBillingway != null">f_billingway,</if>
  283. <if test="fChargedate != null">f_chargedate,</if>
  284. <if test="fBoxno != null">f_boxno,</if>
  285. <if test="fGoodsval != null">f_goodsval,</if>
  286. <if test="fCntqty != null">f_cntqty,</if>
  287. <if test="fPackagespecs != null">f_packagespecs,</if>
  288. <if test="fCntrtype != null">f_cntrtype,</if>
  289. <if test="fPlanvolumn != null">f_planvolumn,</if>
  290. <if test="fPlanqty != null">f_planqty,</if>
  291. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  292. <if test="fPlannetweight != null">f_plannetweight,</if>
  293. <if test="fVolumn != null">f_volumn,</if>
  294. <if test="fQty != null">f_qty,</if>
  295. <if test="fGrossweight != null">f_grossweight,</if>
  296. <if test="fNetweight != null">f_netweight,</if>
  297. <if test="fCntrno != null">f_cntrno,</if>
  298. <if test="fTruckno != null">f_truckno,</if>
  299. <if test="fMarks != null">f_marks,</if>
  300. <if test="fActualWeight != null">f_actual_weight,</if>
  301. <if test="fBillstatus != null">f_billstatus,</if>
  302. <if test="delFlag != null">del_flag,</if>
  303. <if test="createBy != null">create_by,</if>
  304. <if test="createTime != null">create_time,</if>
  305. <if test="updateBy != null">update_by,</if>
  306. <if test="updateTime != null">update_time,</if>
  307. <if test="remark != null">remark,</if>
  308. <if test="fInventoryDays != null">f_inventory_days,</if>
  309. <if test="fStorageFeeDeadline != null">f_storage_fee_deadline,</if>
  310. <if test="fAmt != null">f_amt,</if>
  311. <if test="fBillingDays != null">f_billing_days,</if>
  312. <if test="fDriverName != null">f_driver_name,</if>
  313. <if test="fDriverTel != null">f_driver_tel,</if>
  314. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  315. <if test="fSerialNumber != null">f_serial_number,</if>
  316. <if test="fIsPass != null">f_is_pass,</if>
  317. <if test="fBilltype != null">f_billtype,</if>
  318. <if test="fBillingQty != null">f_billing_qty,</if>
  319. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  320. <if test="fBusinessType != null">f_business_type,</if>
  321. <if test="fIsInventory != null">f_is_inventory,</if>
  322. <if test="fWarehouseInformation != null">f_warehouse_information,</if>
  323. <if test="fOrgwarehouseInformation != null">f_orgwarehouse_information,</if>
  324. <if test="fLabour != null">f_labour,</if>
  325. <if test="fFleet != null">f_fleet,</if>
  326. <if test="fStevedore != null">f_stevedore,</if>
  327. <if test="fLntype != null">f_lntype,</if>
  328. <if test="fForkliftman != null">f_forkliftman,</if>
  329. <if test="fLocalcntrno != null">f_localcntrno,</if>
  330. <if test="fSealno != null">f_sealno,</if>
  331. <if test="fNowCarton != null">f_now_carton,</if>
  332. <if test="fItemstatus != null">f_itemstatus,</if>
  333. <if test="fCartypeId != null">f_cartype_id,</if>
  334. <if test="fDc != null">f_dc,</if>
  335. <if test="isCalculateStorageFees != null">is_calculate_storage_fees,</if>
  336. </trim>
  337. <trim prefix="values (" suffix=")" suffixOverrides=",">
  338. <if test="fId != null">#{fId},</if>
  339. <if test="fPid != null">#{fPid},</if>
  340. <if test="fSrcid != null">#{fSrcid},</if>
  341. <if test="fLineno != null">#{fLineno},</if>
  342. <if test="fBillno != null">#{fBillno},</if>
  343. <if test="fShipper != null">#{fShipper},</if>
  344. <if test="fGoodsid != null">#{fGoodsid},</if>
  345. <if test="fMblno != null">#{fMblno},</if>
  346. <if test="fSrcBsdate != null">#{fSrcBsdate},</if>
  347. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  348. <if test="fTransferWarehouselocid != null">#{fTransferWarehouselocid},</if>
  349. <if test="fWarehouselocid != null">#{fWarehouselocid},</if>
  350. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  351. <if test="fBsdate != null">#{fBsdate},</if>
  352. <if test="fBillingway != null">#{fBillingway},</if>
  353. <if test="fChargedate != null">#{fChargedate},</if>
  354. <if test="fBoxno != null">#{fBoxno},</if>
  355. <if test="fGoodsval != null">#{fGoodsval},</if>
  356. <if test="fCntqty != null">#{fCntqty},</if>
  357. <if test="fPackagespecs != null">#{fPackagespecs},</if>
  358. <if test="fCntrtype != null">#{fCntrtype},</if>
  359. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  360. <if test="fPlanqty != null">#{fPlanqty},</if>
  361. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  362. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  363. <if test="fVolumn != null">#{fVolumn},</if>
  364. <if test="fQty != null">#{fQty},</if>
  365. <if test="fGrossweight != null">#{fGrossweight},</if>
  366. <if test="fNetweight != null">#{fNetweight},</if>
  367. <if test="fCntrno != null">#{fCntrno},</if>
  368. <if test="fTruckno != null">#{fTruckno},</if>
  369. <if test="fMarks != null">#{fMarks},</if>
  370. <if test="fActualWeight != null">#{fActualWeight},</if>
  371. <if test="fBillstatus != null">#{fBillstatus},</if>
  372. <if test="delFlag != null">#{delFlag},</if>
  373. <if test="createBy != null">#{createBy},</if>
  374. <if test="createTime != null">#{createTime},</if>
  375. <if test="updateBy != null">#{updateBy},</if>
  376. <if test="updateTime != null">#{updateTime},</if>
  377. <if test="remark != null">#{remark},</if>
  378. <if test="fInventoryDays != null">#{fInventoryDays},</if>
  379. <if test="fStorageFeeDeadline != null">#{fStorageFeeDeadline},</if>
  380. <if test="fAmt != null">#{fAmt},</if>
  381. <if test="fBillingDays != null">#{fBillingDays},</if>
  382. <if test="fDriverName != null">#{fDriverName},</if>
  383. <if test="fDriverTel != null">#{fDriverTel},</if>
  384. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  385. <if test="fSerialNumber != null">#{fSerialNumber},</if>
  386. <if test="fIsPass != null">#{fIsPass},</if>
  387. <if test="fBilltype != null">#{fBilltype},</if>
  388. <if test="fBillingQty != null">#{fBillingQty},</if>
  389. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  390. <if test="fBusinessType != null">#{fBusinessType},</if>
  391. <if test="fIsInventory != null">#{fIsInventory},</if>
  392. <if test="fWarehouseInformation != null">#{fWarehouseInformation},</if>
  393. <if test="fOrgwarehouseInformation != null">#{fOrgwarehouseInformation},</if>
  394. <if test="fLabour != null">#{fLabour},</if>
  395. <if test="fFleet != null">#{fFleet},</if>
  396. <if test="fStevedore != null">#{fStevedore},</if>
  397. <if test="fLntype != null">#{fLntype},</if>
  398. <if test="fForkliftman != null">#{fForkliftman},</if>
  399. <if test="fLocalcntrno != null">#{fLocalcntrno},</if>
  400. <if test="fSealno != null">#{fSealno},</if>
  401. <if test="fNowCarton != null">#{fNowCarton},</if>
  402. <if test="fItemstatus != null">#{fItemstatus},</if>
  403. <if test="fCartypeId != null">#{fCartypeId},</if>
  404. <if test="fDc != null">#{fDc},</if>
  405. <if test="isCalculateStorageFees != null">#{isCalculateStorageFees},</if>
  406. </trim>
  407. </insert>
  408. <update id="updateTWarehousebillsitems" parameterType="TWarehousebillsitems">
  409. update t_warehousebillsitems
  410. <trim prefix="SET" suffixOverrides=",">
  411. <if test="fPid != null">f_pid = #{fPid},</if>
  412. <if test="fSrcid != null">f_srcid = #{fSrcid},</if>
  413. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  414. <if test="fBillno != null">f_billno = #{fBillno},</if>
  415. <if test="fShipper != null">f_shipper = #{fShipper},</if>
  416. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  417. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  418. <if test="fSrcBsdate != null">f_src_bsdate = #{fSrcBsdate},</if>
  419. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  420. <if test="fTransferWarehouselocid != null">f_transfer_warehouselocid = #{fTransferWarehouselocid},</if>
  421. <if test="fWarehouselocid != null">f_warehouselocid = #{fWarehouselocid},</if>
  422. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  423. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  424. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  425. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  426. <if test="fBoxno != null">f_boxno = #{fBoxno},</if>
  427. <if test="fGoodsval != null">f_goodsval = #{fGoodsval},</if>
  428. <if test="fCntqty != null">f_cntqty = #{fCntqty},</if>
  429. <if test="fPackagespecs != null">f_packagespecs = #{fPackagespecs},</if>
  430. <if test="fCntrtype != null">f_cntrtype = #{fCntrtype},</if>
  431. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  432. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  433. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  434. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  435. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  436. <if test="fQty != null">f_qty = #{fQty},</if>
  437. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  438. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  439. <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
  440. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  441. <if test="fMarks != null">f_marks = #{fMarks},</if>
  442. <if test="fActualWeight != null">f_actual_weight = #{fActualWeight},</if>
  443. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  444. <if test="delFlag != null">del_flag = #{delFlag},</if>
  445. <if test="createBy != null">create_by = #{createBy},</if>
  446. <if test="createTime != null">create_time = #{createTime},</if>
  447. <if test="updateBy != null">update_by = #{updateBy},</if>
  448. <if test="updateTime != null">update_time = #{updateTime},</if>
  449. <if test="remark != null">remark = #{remark},</if>
  450. <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
  451. <if test="fStorageFeeDeadline != null">f_storage_fee_deadline = #{fStorageFeeDeadline},</if>
  452. <if test="fAmt != null">f_amt = #{fAmt},</if>
  453. <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
  454. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  455. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  456. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  457. <if test="fSerialNumber != null">f_serial_number = #{fSerialNumber},</if>
  458. <if test="fIsPass != null">f_is_pass = #{fIsPass},</if>
  459. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  460. <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
  461. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  462. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  463. <if test="fIsInventory != null">f_is_inventory = #{fIsInventory},</if>
  464. <if test="fWarehouseInformation != null">f_warehouse_information = #{fWarehouseInformation},</if>
  465. <if test="fOrgwarehouseInformation != null">f_orgwarehouse_information = #{fOrgwarehouseInformation},</if>
  466. <if test="fLabour != null">f_labour = #{fLabour},</if>
  467. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  468. <if test="fStevedore != null">f_stevedore = #{fStevedore},</if>
  469. <if test="fLntype != null">f_lntype = #{fLntype},</if>
  470. <if test="fForkliftman != null">f_forkliftman = #{fForkliftman},</if>
  471. <if test="fLocalcntrno != null">f_localcntrno = #{fLocalcntrno},</if>
  472. <if test="fSealno != null">f_sealno = #{fSealno},</if>
  473. <if test="fNowCarton != null">f_now_carton = #{fNowCarton},</if>
  474. <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
  475. <if test="fCartypeId != null">f_cartype_id = #{fCartypeId},</if>
  476. <if test="fDc != null">f_dc = #{fDc},</if>
  477. <if test="isCalculateStorageFees != null">is_calculate_storage_fees = #{isCalculateStorageFees},</if>
  478. </trim>
  479. where f_id = #{fId}
  480. </update>
  481. <update id="agreementApprovalRejected" parameterType="TWarehousebillsitems">
  482. UPDATE
  483. t_warehousebillsitems
  484. SET f_storage_fee_deadline = null, f_chargedate = #{fChargedate},
  485. is_calculate_storage_fees = #{isCalculateStorageFees}
  486. WHERE
  487. f_id = #{fId}
  488. </update>
  489. <delete id="deleteTWarehousebillsitemsById" parameterType="Long">
  490. delete from t_warehousebillsitems where f_id = #{fId}
  491. </delete>
  492. <delete id="deleteTWarehousebillsitemsByIds" parameterType="String">
  493. delete from t_warehousebillsitems where f_id in
  494. <foreach item="fId" collection="array" open="(" separator="," close=")">
  495. #{fId}
  496. </foreach>
  497. </delete>
  498. <delete id="deleteByFPid" parameterType="Long">
  499. delete from t_warehousebillsitems where f_pid = #{fId}
  500. </delete>
  501. <select id="selectStorageFeeItemList" parameterType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills"
  502. resultType="Map">
  503. SELECT
  504. ware.f_warehouseid AS warehouse,
  505. item.f_id AS fId,
  506. item.f_billno AS fBillno,
  507. item.f_shipper AS fShipper,
  508. item.f_goodsid AS fGoodsid,
  509. item.f_bsdate AS fBsdate,
  510. item.f_billingway AS fBillingway,
  511. item.f_chargedate AS fChargedate,
  512. item.f_originalbilldate AS fOriginalbilldate,
  513. item.f_src_bsdate AS fSrcBsdate,
  514. item.f_mblno AS fMblno,
  515. item.f_volumn AS fVolumn,
  516. item.f_marks AS fMarks,
  517. item.f_billing_days AS fBillingDays,
  518. item.f_is_inventory AS fIsInventory,
  519. item.f_qty AS fQty,
  520. item.f_orgwarehouse_information AS fOrgwarehouseInformation,
  521. item.f_grossweight AS fGrossweight,
  522. item.f_netweight AS fNetweight,
  523. item.f_billtype AS fBilltype,
  524. goods.f_typeid AS fTypeid,
  525. goods.f_name AS fGoodsids
  526. FROM
  527. t_warehousebills ware
  528. LEFT JOIN t_warehousebillsitems item ON item.f_pid = ware.f_id
  529. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  530. LEFT JOIN t_warehouse wa ON wa.f_id = ware.f_warehouseid
  531. LEFT JOIN t_whgenleg leg ON leg.f_id = item.f_srcid
  532. <where>
  533. ware.f_corpid = #{warehouse.fCorpid}
  534. <if test="warehouse.fId != null">and item.f_id = #{warehouse.fId}</if>
  535. and ware.f_billtype in ('HQZY', 'SJCK')
  536. and wa.f_charg = 1
  537. and item.f_storage_fee_deadline IS NULL
  538. and item.f_bsdate &lt;= #{warehouse.fBillingDeadline}
  539. and IF(ware.f_billtype = 'SJCK', item.f_billstatus = 40, item.f_billstatus = 6)
  540. and IF(item.f_billingway = '7', leg.f_qtyblc = 0, leg.f_qtyblc &gt;= 0)
  541. <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and item.f_goodsid = #{warehouse.fGoodsid}</if>
  542. <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and ware.f_warehouseid = #{warehouse.fWarehouseid}</if>
  543. <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and item.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
  544. <if test="warehouse.fShipper != null and warehouse.fShipper != ''">and item.f_shipper like concat('%',#{warehouse.fShipper},'%')</if>
  545. </where>
  546. </select>
  547. <select id="selectStorageFeeItemList1" resultMap="StorageFeesInfoResult">
  548. SELECT
  549. ware.f_warehouseid,
  550. item.f_id,
  551. item.f_billno,
  552. item.f_shipper,
  553. item.f_goodsid,
  554. item.f_bsdate,
  555. item.f_billingway,
  556. item.f_chargedate,
  557. item.f_src_bsdate,
  558. item.f_originalbilldate,
  559. item.f_mblno,
  560. item.f_volumn,
  561. item.f_marks,
  562. item.f_billing_days,
  563. item.f_is_inventory,
  564. item.f_qty,
  565. item.f_orgwarehouse_information,
  566. item.f_grossweight,
  567. item.f_netweight,
  568. item.f_billtype,
  569. goods.f_typeid,
  570. goods.f_name
  571. FROM
  572. t_warehousebills ware
  573. LEFT JOIN t_warehousebillsitems item ON item.f_pid = ware.f_id
  574. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  575. LEFT JOIN t_warehouse wa ON wa.f_id = ware.f_warehouseid
  576. LEFT JOIN t_whgenleg leg ON leg.f_id = item.f_srcid
  577. <where>
  578. ware.f_corpid = #{warehouse.fCorpid}
  579. <if test="warehouse.fId != null">and item.f_id = #{warehouse.fId}</if>
  580. and ware.f_billtype in ('HQZY', 'SJCK')
  581. and wa.f_charg = 1
  582. and item.f_storage_fee_deadline IS NULL
  583. and item.f_bsdate &lt;= #{warehouse.fBillingDeadline}
  584. and IF(ware.f_billtype = 'SJCK', item.f_billstatus = 40, item.f_billstatus = 6)
  585. and IF(item.f_billingway = '7', leg.f_qtyblc = 0, leg.f_qtyblc &gt;= 0)
  586. <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and item.f_goodsid = #{warehouse.fGoodsid}</if>
  587. <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and ware.f_warehouseid = #{warehouse.fWarehouseid}</if>
  588. <if test="warehouse.fTrademodeid != null and warehouse.fTrademodeid != ''">and ware.f_trademodeid = #{warehouse.fTrademodeid}</if>
  589. <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and item.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
  590. <if test="warehouse.fShipper != null and warehouse.fShipper != ''">and item.f_shipper like concat('%',#{warehouse.fShipper},'%')</if>
  591. </where>
  592. </select>
  593. <select id="warehousebillsitemsWarehouselocidSize" resultType="java.lang.Integer">
  594. SELECT
  595. COUNT( 1 )
  596. FROM
  597. t_warehousebillsitems
  598. WHERE
  599. f_warehouselocid = #{fWarehouselocid}
  600. </select>
  601. <select id="inStock" resultType="java.lang.Integer">
  602. SELECT
  603. COUNT(f_id)
  604. FROM
  605. t_warehousebillsitems
  606. WHERE
  607. f_billtype = 'SJRK'
  608. AND
  609. f_billstatus in (20,30)
  610. </select>
  611. <select id="outStock" resultType="java.lang.Integer">
  612. SELECT
  613. COUNT(f_id)
  614. FROM
  615. t_warehousebillsitems
  616. WHERE
  617. f_billtype = 'SJCK'
  618. AND
  619. f_billstatus in (20,30)
  620. </select>
  621. <select id="monthInStock" resultType="java.lang.Integer">
  622. SELECT
  623. COUNT(f_id)
  624. FROM
  625. t_warehousebillsitems
  626. WHERE
  627. f_billtype = 'SJRK'
  628. AND
  629. f_billstatus =40
  630. AND
  631. f_bsdate &gt;= #{timeInterval[0]}
  632. AND
  633. f_bsdate &lt;= #{timeInterval[1]}
  634. </select>
  635. <select id="monthOutStock" resultType="java.lang.Integer">
  636. SELECT
  637. COUNT(f_id)
  638. FROM
  639. t_warehousebillsitems
  640. WHERE
  641. f_billtype = 'SJCK'
  642. AND
  643. f_billstatus =40
  644. AND
  645. f_bsdate &gt;= #{timeInterval[0]}
  646. AND
  647. f_bsdate &lt;= #{timeInterval[1]}
  648. </select>
  649. <select id="selectWarehouseBusinesInList" resultType="java.util.Map">
  650. SELECT
  651. items.f_id AS fId,
  652. items.f_pid AS fPid,
  653. c.f_name AS fName,
  654. items.f_mblno AS fMblno,
  655. items.f_bsdate AS fBsdate,
  656. items.f_is_pass AS fIsPass,
  657. CASE
  658. WHEN items.f_billstatus = 20 THEN
  659. '待入库'
  660. WHEN items.f_billstatus = 30 THEN
  661. '入库中'
  662. END AS fBillstatus,
  663. g.f_name AS fGoodsid,
  664. items.f_driver_tel AS fDriverTel,
  665. dict.dict_label AS fBusinessType,
  666. items.f_marks AS fMarks,
  667. items.f_warehouse_information AS fWarehouseInformation,
  668. items.f_qty AS fQty,
  669. items.f_grossweight AS fGrossweight,
  670. items.f_netweight AS fNetweight
  671. FROM
  672. t_warehousebillsitems items
  673. LEFT JOIN t_warehousebills t ON items.f_pid = t.f_id
  674. LEFT JOIN t_corps c ON t.f_corpid = c.f_id
  675. LEFT JOIN t_goods g ON items.f_goodsid = g.f_id
  676. LEFT JOIN sys_dict_data dict ON dict.dict_type = 'storage_type'
  677. AND dict.dict_value = items.f_business_type
  678. WHERE
  679. items.f_billtype = 'SJRK'
  680. AND items.f_billstatus IN ( 20, 30 )
  681. <if test="timeStartBsdate != null">AND items.f_bsdate &gt;= #{timeStartBsdate}</if>
  682. <if test="timeEndBsdate != null">AND items.f_bsdate &lt;= #{timeEndBsdate}</if>
  683. <if test="fBillstatus != null">AND items.f_billstatus = #{fBillstatus}</if>
  684. <if test="fMblno != null and fMblno != '' ">AND items.f_mblno like concat('%',#{fMblno},'%') </if>
  685. </select>
  686. <select id="selectWarehouseBusinesOutList" resultType="java.util.Map">
  687. SELECT
  688. items.f_id AS fId,
  689. items.f_pid AS fPid,
  690. c.f_name AS fName,
  691. items.f_mblno AS fMblno,
  692. items.f_bsdate AS fBsdate,
  693. items.f_is_pass AS fIsPass,
  694. CASE
  695. WHEN items.f_billstatus = 20 THEN
  696. '待出库'
  697. WHEN items.f_billstatus = 30 THEN
  698. '出库中'
  699. END AS fBillstatus,
  700. g.f_name AS fGoodsid,
  701. items.f_driver_tel AS fDriverTel,
  702. dict.dict_label AS fBusinessType ,
  703. items.f_marks AS fMarks,
  704. items.f_warehouse_information AS fWarehouseInformation,
  705. items.f_qty AS fQty,
  706. items.f_grossweight AS fGrossweight,
  707. items.f_netweight AS fNetweight
  708. FROM
  709. t_warehousebillsitems items
  710. LEFT JOIN t_warehousebills t ON items.f_pid = t.f_id
  711. LEFT JOIN t_corps c ON t.f_corpid = c.f_id
  712. LEFT JOIN t_goods g ON items.f_goodsid = g.f_id
  713. LEFT JOIN sys_dict_data dict ON dict.dict_type = 'storage_type'
  714. AND dict.dict_value = items.f_business_type
  715. WHERE
  716. items.f_billtype = 'SJCK'
  717. AND items.f_billstatus IN ( 20, 30 )
  718. <if test="timeStartBsdate != null">AND items.f_bsdate &gt;= #{timeStartBsdate}</if>
  719. <if test="timeEndBsdate != null">AND items.f_bsdate &lt;= #{timeEndBsdate}</if>
  720. <if test="fBillstatus != null">AND items.f_billstatus = #{fBillstatus}</if>
  721. <if test="fMblno != null and fMblno != '' ">AND items.f_mblno like concat('%',#{fMblno},'%') </if>
  722. order by items.f_bsdate desc
  723. </select>
  724. <select id="selectWarehouseItemsByPId" parameterType="long" resultType="Map">
  725. SELECT
  726. t.f_id fId,
  727. t.f_pid fPid,
  728. t.f_shipper fShipper,
  729. t.f_bsdate fBsdate,
  730. corp.f_name corpName,
  731. t.f_mblno fMblno,
  732. stor.dict_label businessType,
  733. t.f_marks fMarks,
  734. t.f_labour fLabour,
  735. g.f_name goodsName,
  736. fleet.f_name fleetName,
  737. t.f_warehouse_information fWarehouseInformation,
  738. t.f_warehouselocid fWarehouselocid,
  739. t.f_forkliftman fForkliftman,
  740. t.f_truckno fTruckno,
  741. cntr.f_name cntrtypes,
  742. t.f_cntrtype fCntrtype,
  743. t.f_cntqty fCntqty,
  744. t.f_cntrno fCntrno,
  745. t.f_qty fQty,
  746. t.f_truckno fTruckno,
  747. t.f_driver_name fDriverName,
  748. t.f_originalbilldate fOriginalbilldate,
  749. t.f_grossweight fGrossweight,
  750. t.f_netweight fNetweight,
  751. t.f_driver_tel fDriverTel,
  752. t.f_stevedore fStevedore,
  753. CASE
  754. WHEN t.f_billstatus = '10' THEN '计划'
  755. WHEN t.f_billstatus = '20' THEN
  756. IF(w.f_billtype = 'SJRK', '待入库', IF(w.f_billtype = 'SJCK','待出库', IF(w.f_billtype = 'CKDB', '待调拨',IF(w.f_billtype = 'HWTG', '待通关', IF(w.f_billtype = 'HQZY', '待转移', '无')))))
  757. WHEN t.f_billstatus = '30' THEN
  758. IF(w.f_billtype = 'SJRK', '入库中', IF(w.f_billtype = 'SJCK','出库中', IF(w.f_billtype = 'CKDB', '调拨中',IF(w.f_billtype = 'HWTG', '通关中', IF(w.f_billtype = 'HQZY', '转移中', '无')))))
  759. WHEN t.f_billstatus = '40' THEN
  760. IF(w.f_billtype = 'SJRK', '已入库', IF(w.f_billtype = 'SJCK','已出库', IF(w.f_billtype = 'CKDB', '已调拨',IF(w.f_billtype = 'HWTG', '已通关', IF(w.f_billtype = 'HQZY', '已转移', '无')))))
  761. END billstatus,
  762. t.remark
  763. FROM
  764. t_warehousebills w
  765. LEFT JOIN t_warehousebillsitems t ON w.f_id = t.f_pid
  766. LEFT JOIN sys_dict_data stor ON stor.dict_value = t.f_business_type
  767. AND stor.dict_type = 'storage_type'
  768. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  769. LEFT JOIN t_corps fleet ON fleet.f_id = t.f_fleet
  770. LEFT JOIN t_corps corp ON corp.f_id = w.f_corpid
  771. LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype
  772. where
  773. t.f_id = #{fId}
  774. </select>
  775. <select id="selectItemFStatusByFPid" resultType="java.lang.Integer">
  776. SELECT
  777. IFNULL( COUNT( w.f_id ), 0 )
  778. FROM
  779. t_warehousebills w
  780. LEFT JOIN t_warehousebillsitems i ON i.f_pid = w.f_id
  781. WHERE
  782. w.f_id = #{fId}
  783. AND i.f_billstatus = 40
  784. </select>
  785. <select id="selectItemQtyByFPid" resultType="com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems">
  786. SELECT
  787. IFNULL( SUM( f_qty ), 0 ) fQty,
  788. IFNULL( SUM( f_grossweight ), 0 ) fGrossweight,
  789. IFNULL( SUM( f_netweight ), 0 ) fNetweight
  790. FROM
  791. t_warehousebillsitems
  792. WHERE
  793. f_pid = #{fPid}
  794. AND f_billstatus = 40
  795. </select>
  796. <select id="selecMinBsDateByFPid" resultType="java.util.Date">
  797. SELECT
  798. MIN( f_bsdate )
  799. FROM
  800. t_warehousebillsitems
  801. WHERE
  802. f_pid = #{fId}
  803. </select>
  804. <select id="selectItemsStatusByPid" resultMap="TWarehousebillsitemsResult" parameterType="long">
  805. SELECT
  806. f_id,
  807. f_billno,
  808. f_billstatus,
  809. f_itemstatus
  810. FROM
  811. t_warehousebillsitems
  812. WHERE
  813. f_pid = #{fId}
  814. </select>
  815. <update id="warehouseItemFollowUpdate" parameterType="Long">
  816. update
  817. t_warehousebillsitems
  818. SET f_billstatus = IF
  819. ( f_billtype = 'SJCK' || f_billtype = 'SJRK', 40, #{fettle} )
  820. where
  821. f_pid = #{fPid}
  822. </update>
  823. <select id="getFchargedate" parameterType="Long" resultType="date">
  824. SELECT
  825. f_chargedate
  826. FROM
  827. t_warehousebillsitems
  828. WHERE f_chargedate IS NOT NULL
  829. and f_pid = #{fPid}
  830. ORDER BY f_chargedate
  831. LIMIT 1
  832. </select>
  833. <update id="warehouseItemfChargedate" parameterType="Long">
  834. update
  835. t_warehousebillsitems
  836. SET f_chargedate = #{fChargedate}
  837. where
  838. f_pid = #{fPid}
  839. </update>
  840. <update id="warehouseItemfItemstatus" parameterType="Long">
  841. update
  842. t_warehousebillsitems
  843. SET f_itemstatus = #{fItemstatus}
  844. where
  845. f_pid = #{fPid}
  846. </update>
  847. <update id="updatefStorageFeeDeadline" parameterType="TWarehousebillsitems">
  848. UPDATE
  849. t_warehousebillsitems
  850. SET f_storage_fee_deadline = null
  851. WHERE
  852. f_pid = #{fPid}
  853. and f_id not in
  854. <foreach item="fId" collection="fId" open="(" separator="," close=")">
  855. #{fId}
  856. </foreach>
  857. </update>
  858. <update id="updatefStorageFeeDeadlinefPid" parameterType="TWarehousebillsitems">
  859. UPDATE
  860. t_warehousebillsitems
  861. SET f_storage_fee_deadline = null
  862. WHERE
  863. f_pid = #{fPid}
  864. </update>
  865. <select id="selectStorageFeeItemfTruckNo" parameterType="string" resultType="Map">
  866. SELECT
  867. DISTINCT
  868. f_truckno AS fTruckno
  869. FROM
  870. t_warehousebillsitems
  871. WHERE f_truckno IS NOT NULL
  872. AND f_truckno != ''
  873. ORDER BY CONVERT(f_truckno USING gbk) asc
  874. </select>
  875. <select id="queryChangedByFchargedate" resultType="java.lang.Integer">
  876. SELECT
  877. count( f_id )
  878. FROM
  879. t_warehousebillsitems
  880. WHERE
  881. <foreach collection="ids" item="id" open="f_id in(" separator="," close=")">
  882. #{id}
  883. </foreach>
  884. and f_chargedate != #{time}
  885. </select>
  886. <select id="queryChangedByFstorageFeeDeadline" resultType="java.lang.Integer">
  887. SELECT
  888. count( f_id )
  889. FROM
  890. t_warehousebillsitems
  891. WHERE
  892. <foreach collection="ids" item="id" open="f_id in(" separator="," close=")">
  893. #{id}
  894. </foreach>
  895. and f_storage_fee_deadline != #{time}
  896. </select>
  897. <select id="selectIsCalculateStorageFeesByIdsOrType" resultType="java.lang.Integer">
  898. SELECT
  899. count( f_id )
  900. FROM
  901. t_warehousebillsitems
  902. WHERE
  903. <foreach collection="ids" item="id" open="f_id in(" separator="," close=")">
  904. #{id}
  905. </foreach>
  906. and is_calculate_storage_fees = #{type}
  907. </select>
  908. <select id="selectIsCalculateStorageFeesByIds" resultType="java.lang.Integer">
  909. SELECT
  910. count( f_id )
  911. FROM
  912. t_warehousebillsitems
  913. WHERE
  914. <foreach collection="ids" item="id" open="f_id in(" separator="," close=")">
  915. #{id}
  916. </foreach>
  917. and f_storage_fee_deadline IS NOT NULL
  918. </select>
  919. <select id="selectByBsDateList" resultMap="TWarehousebillsitemsResult">
  920. select
  921. *
  922. from
  923. t_warehousebillsitems
  924. where
  925. f_bsdate between #{starDate}, #{endDate}
  926. </select>
  927. <select id="selectListByCorpId" resultMap="TWarehousebillsitemsResult">
  928. select t.f_tocorpid, item.f_id, item.f_shipper, item.f_goodsid, item.f_mblno, item.f_originalbillno, item.f_transfer_warehouselocid,
  929. item.f_warehouselocid, item.f_originalbilldate, item.f_bsdate, item.f_billingway, item.f_chargedate, item.f_boxno, item.f_goodsval,
  930. item.f_cntqty, item.f_volumn, item.f_qty, item.f_grossweight, item.f_netweight, item.f_cntrno, item.f_marks, item.f_billtype
  931. from t_warehousebills t LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  932. where
  933. item.f_id IS NOT NULL
  934. and (t.f_corpid = #{bills.fCorpid} or t.f_tocorpid = #{bills.fCorpid})
  935. and item.f_bsdate BETWEEN #{bills.itemBsDateList[0]} and #{bills.itemBsDateList[1]}
  936. and IF(item.f_billtype = "HQZY", item.f_billstatus = 6, item.f_billstatus = 40)
  937. <if test="bills.fGoodsid != null and bills.fGoodsid != ''">and item.f_goodsid = #{bills.fGoodsid}</if>
  938. <if test="bills.fMblno != null and bills.fMblno != ''">and item.f_mblno like concat('%',#{bills.fMblno},'%')</if>
  939. </select>
  940. <select id="selectWarehouseItemsByfPid" parameterType="TWarehousebillsitems" resultMap="TWarehousebillsitemsResult">
  941. SELECT
  942. t.f_id fId,
  943. t.f_pid fPid,
  944. t.f_shipper fShipper,
  945. t.f_bsdate fBsdate,
  946. corp.f_name corpName,
  947. t.f_mblno fMblno,
  948. stor.dict_label businessType,
  949. t.f_marks fMarks,
  950. t.f_labour fLabour,
  951. g.f_name goodsName,
  952. fleet.f_name fleetName,
  953. t.f_warehouse_information fWarehouseInformation,
  954. t.f_warehouselocid fWarehouselocid,
  955. t.f_forkliftman fForkliftman,
  956. t.f_truckno fTruckno,
  957. cntr.f_name cntrtypes,
  958. t.f_cntrtype fCntrtype,
  959. t.f_cntqty fCntqty,
  960. t.f_cntrno fCntrno,
  961. t.f_qty fQty,
  962. t.f_truckno fTruckno,
  963. t.f_driver_name fDriverName,
  964. t.f_originalbilldate fOriginalbilldate,
  965. t.f_grossweight fGrossweight,
  966. t.f_netweight fNetweight,
  967. t.f_driver_tel fDriverTel,
  968. t.f_stevedore fStevedore,
  969. CASE
  970. WHEN t.f_billstatus = '10' THEN '计划'
  971. WHEN t.f_billstatus = '20' THEN
  972. IF(w.f_billtype = 'SJRK', '待入库', IF(w.f_billtype = 'SJCK','待出库', IF(w.f_billtype = 'CKDB', '待调拨',IF(w.f_billtype = 'HWTG', '待通关', IF(w.f_billtype = 'HQZY', '待转移', '无')))))
  973. WHEN t.f_billstatus = '30' THEN
  974. IF(w.f_billtype = 'SJRK', '入库中', IF(w.f_billtype = 'SJCK','出库中', IF(w.f_billtype = 'CKDB', '调拨中',IF(w.f_billtype = 'HWTG', '通关中', IF(w.f_billtype = 'HQZY', '转移中', '无')))))
  975. WHEN t.f_billstatus = '40' THEN
  976. IF(w.f_billtype = 'SJRK', '已入库', IF(w.f_billtype = 'SJCK','已出库', IF(w.f_billtype = 'CKDB', '已调拨',IF(w.f_billtype = 'HWTG', '已通关', IF(w.f_billtype = 'HQZY', '已转移', '无')))))
  977. END billstatus,
  978. t.remark
  979. FROM
  980. t_warehousebills w
  981. LEFT JOIN t_warehousebillsitems t ON w.f_id = t.f_pid
  982. LEFT JOIN sys_dict_data stor ON stor.dict_value = t.f_business_type
  983. AND stor.dict_type = 'storage_type'
  984. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  985. LEFT JOIN t_corps fleet ON fleet.f_id = t.f_fleet
  986. LEFT JOIN t_corps corp ON corp.f_id = w.f_corpid
  987. LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype
  988. where
  989. t.f_pid = #{fPid}
  990. </select>
  991. <select id="selectInboundQtyByTime" resultMap="WarehouseTimeIntervalResult">
  992. SELECT w.f_warehouseid, sum(item.f_qty) f_qty
  993. FROM t_warehousebills w LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  994. WHERE
  995. item.f_billtype = #{dto.warehouseType}
  996. and item.f_bsdate between #{dto.timeList[0]} and #{dto.timeList[1]}
  997. GROUP BY w.f_warehouseid;
  998. </select>
  999. <update id="updateItemStorageFeeDeadlineByPId">
  1000. UPDATE t_warehousebillsitems
  1001. SET f_storage_fee_deadline = #{time}
  1002. WHERE f_pid = #{pId}
  1003. </update>
  1004. <select id="inAndOutStockStatistics" resultType="map">
  1005. select
  1006. <if test="mode == null or mode == ''">round(ifnull(sum(ts.f_grossweight) / 1000, 0)) as total</if>
  1007. <if test="mode != null and mode != ''">
  1008. case #{mode}
  1009. when '3' then round(ifnull(sum(ts.f_volumn), 0))
  1010. when '2' then round(ifnull(sum(
  1011. case tb.f_billingway
  1012. when 3 then ts.f_netweight
  1013. else ts.f_grossweight
  1014. end
  1015. ) / 1000, 0))
  1016. else ifnull(sum(ts.f_qty), 0)
  1017. end as total
  1018. </if>
  1019. from t_warehousebillsitems ts
  1020. left join t_warehousebills tb on ts.f_mblno = tb.f_mblno and ts.f_billno = tb.f_billno
  1021. where
  1022. ts.f_billstatus = '40'
  1023. <if test="billType != null and billType != ''">and ts.f_billtype = #{billType}</if>
  1024. <if test="beginDate != null and beginDate != ''">and ts.f_bsdate &gt;= #{beginDate}</if>
  1025. <if test="endDate != null and endDate != ''">and ts.f_bsdate &lt;= #{endDate}</if>
  1026. <if test="external != null and external != ''">
  1027. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1028. </if>
  1029. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1030. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1031. </select>
  1032. <select id="inAndOutStockTeuStatistics" resultType="map">
  1033. select
  1034. ifnull(sum(twc.f_cntrcount * tr.f_teu), 0) as total
  1035. from t_warehousebills_cntr twc
  1036. left join t_warehousebills tb on twc.f_pid = tb.f_id
  1037. left join t_cntr tr on twc.f_cntrid = tr.f_id
  1038. where tb.f_items_status = '4'
  1039. <if test="billType != null and billType != ''">and tb.f_billtype = #{billType}</if>
  1040. <if test="beginDate != null and beginDate != ''">and tb.f_bsdate &gt;= #{beginDate}</if>
  1041. <if test="endDate != null and endDate != ''">and tb.f_bsdate &lt;= #{endDate}</if>
  1042. <if test="external != null and external != ''">
  1043. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1044. </if>
  1045. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1046. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1047. </select>
  1048. <select id="biInAndOutStockList" resultType="map">
  1049. select
  1050. ifnull(tc.f_cname, tc.f_name) as customerName,
  1051. ifnull(ifnull(ts.f_shipper, tc.f_cname), tc.f_name) as shipper,
  1052. ts.f_warehouse_information as warehouseName,
  1053. tg.f_name as goodsName,
  1054. concat(ts.f_qty, '/',
  1055. case tb.f_billingway
  1056. when 3 then round(ts.f_netweight / 1000)
  1057. else round(ts.f_grossweight / 1000)
  1058. end, '/', round(ifnull(ts.f_volumn, 0))) as quantity,
  1059. date_format(ts.f_bsdate, '%Y-%m-%d') as businessTime
  1060. from t_warehousebillsitems ts
  1061. left join t_warehousebills tb on ts.f_pid = tb.f_id
  1062. left join t_corps tc on tb.f_corpid = tc.f_id
  1063. left join t_goods tg on ts.f_goodsid = tg.f_id
  1064. where
  1065. ts.f_billstatus = '40'
  1066. <if test="billType != null and billType != ''">and ts.f_billtype = #{billType}</if>
  1067. <if test="external != null and external != ''">
  1068. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  1069. </if>
  1070. <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
  1071. <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
  1072. order by ts.f_bsdate desc
  1073. </select>
  1074. </mapper>