TWarehousebillsitemsMapper.xml 51 KB

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