TWarehousebillsitemsMapper.xml 46 KB

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