TWarehousebillsitemsMapper.xml 56 KB

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