TWarehousebillsitemsMapper.xml 50 KB

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