OrderBillsPlansMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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.system.mapper.OrderBillsPlansMapper">
  6. <insert id="insertLoadFeeItems">
  7. Insert Into LoadFeeItems (SysID, EntityID, LineNo, CarID, ItemID, ItemProp, ItemAuditType, Dc, Qty, Price, Amt, AMT1, AMT2, AMTORG,
  8. OpUserID, OpUserName, SrcActID, SrcEntityID, SrcLineNo)
  9. values (1, #{o.loadBillsEntityId}, #{i.lineNo}, #{o.carId}, #{i.itemId}, #{i.itemProp}, #{i.auditType}, 'C', 1,
  10. #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt},
  11. #{e.EmplId}, #{e.empl}, #{o.actId}, #{o.entityId}, #{o.lineNo})
  12. </insert>
  13. <insert id="insertAttachMngs">
  14. insert into AttachMngs (SYSID, ENTITYID, ACTID, LINENO, USERNAME,ATTACHNAME)
  15. values (#{loadBillsSysId}, #{loadBillsEntityId}, #{actId}, #{lineNo}, #{userName}, #{attachName})
  16. </insert>
  17. <update id="updateOrderBillsPlansByid">
  18. update OrderBillsPlans
  19. set LoadQty = #{loadQty},
  20. LoadDate = #{loadDate},
  21. UnLoadQty = #{unLoadQty},
  22. UnLoadDate = #{unLoadDate},
  23. EMPTYADDR1 = #{emptyaddr1},
  24. ODOMETERSTART = #{odometerstart},
  25. EMPTYADDR2 = #{emptyaddr2},
  26. ODOMETEREND = #{odometerend},
  27. LOADMILE = #{loadmile},
  28. driverassdesc = #{driverassdesc}
  29. where sysId = '1'
  30. and OrderNo = #{orderNo}
  31. </update>
  32. <update id="updateOrderBillsPlansByOrderNo">
  33. update OrderBillsPlans
  34. set loadetc = #{loadetc},
  35. loadtoll = #{loadtoll},
  36. oilhomeQty = #{oilhomeQty},
  37. oilhomeAmt = #{oilhomeAmt},
  38. oilappoint1Qty = #{oilappoint1Qty},
  39. oilappoint1Amt = #{oilappoint1Amt},
  40. oilappoint2Qty = #{oilappoint2Qty},
  41. oilappoint2Amt = #{oilappoint2Amt},
  42. oilcash1Qty = #{oilcash1Qty},
  43. oilcash1Amt = #{oilcash1Amt},
  44. oilcardQty = #{oilcardQty},
  45. oilcardAmt = #{oilcardAmt},
  46. oilcard1Qty = #{oilcardQty},
  47. oilcard1Amt = #{oilcardAmt},
  48. driverassdesc = #{driverassdesc}
  49. where orderNo = #{orderNo}
  50. </update>
  51. <update id="updateOrderBillsPlansBySysidEntityidLineno">
  52. update LoadFeeItems
  53. set Price = #{amt},
  54. Amt = #{amt},
  55. AMT1 = #{amt},
  56. AMT2 = #{amt},
  57. AMTORG = #{amt},
  58. remarks = #{remarks}
  59. where sysId = '1'
  60. AND entityid = #{entityId}
  61. and lineno = #{lineNo}
  62. </update>
  63. <update id="updateLoadBillsByEntityID">
  64. update LoadBills
  65. set gasstation1 = #{gasstation1},
  66. gasstation2 = #{gasstation2}
  67. where SrcEntityID = #{entityId}
  68. </update>
  69. <delete id="deleteLoadFeeItemsByEntityId">
  70. delete from LoadFeeItems where sysid = 1 and entityid = #{entityId}
  71. </delete>
  72. <delete id="deleteTmsAttachMngsByAttachId">
  73. delete from AttachMngs where attachId = #{attachId}
  74. </delete>
  75. <select id="getOrderBillsPlansLsit" parameterType="Map" resultType="com.ruoyi.system.domain.WfTaskList">
  76. Select Distinct p.SysID sysId
  77. , p.EntityID entityId
  78. , p.LineNo lineNo
  79. , p.OrderNo orderNo
  80. ,p.CarID carID
  81. , p.CarRegNo carRegNo
  82. ,p.PlanLoadDate planLoadDate
  83. , p.LoadDate loadDate
  84. , p.LoadAddr loadAddr
  85. , p.EMPTYADDR1 emptyAddr1
  86. , p.EMPTYADDR2 emptyAddr2
  87. ,p.PlanUnLoadDate planUnLoadDate
  88. , p.UnLoadDate unLoadDate
  89. , p.UnLoadAddr unLoadAddr
  90. , p.Remarks remarks
  91. ,t.TaskID taskId
  92. , t.Status status
  93. ,t.AuditStatus auditStatus
  94. , t.ActID wfActId
  95. ,c.SName corpSName
  96. , c.CName corpCName
  97. , g.CName goodsCName
  98. ,l.SName loadFactory
  99. , ul.SName unLoadFactory
  100. ,dr1.Empl driver1Name
  101. ,dr1.mobile driver1mobile
  102. , sp.Empl sUPERCARGOName
  103. ,e.Empl transact
  104. , b.BillDate billDate
  105. , p.rightqty
  106. , b.billStatus
  107. ,t.Status status317
  108. , tt.Status status376
  109. from wf_TaskList t
  110. Left join wf_TaskList tt on (tt.SysID=t.SysID and tt.ActID=#{actId, jdbcType=VARCHAR} and
  111. tt.EntityID=t.EntityID)
  112. Left join LoadBills b on (b.SysID=t.SysID and b.EntityID=t.EntityID)
  113. Left join OrderBillsPlans p on (p.SysID=b.SysID and p.EntityID=b.SrcEntityID and p.LineNo=b.SrcLineNo)
  114. Left join Empls e on (e.SysID=b.SysID and e.EmplID=b.TransactID)
  115. Left join Empls dr1 on (dr1.SysID=b.SysID and dr1.EmplID=p.DRIVER1ID)
  116. Left join Empls sp on (sp.SysID=b.SysID and sp.EmplID=p.SUPERCARGOID)
  117. Left join Corps c on (c.SysID=p.SysID and c.CorpID=p.CorpID)
  118. Left join Corps l on (l.SysID=p.SysID and l.CorpID=p.LoadFactoryID)
  119. Left join Corps ul on (ul.SysID=b.SysID and ul.CorpID=p.UnLoadFactoryID)
  120. Left join Goods g on (g.SysID=b.SysID and g.GoodsID=b.GoodsID)
  121. <where>
  122. t.SysID=1 and t.ActID=317 and (t.Status = 2 or t.Status = 6)
  123. and ((b.CarID=-1) or ((b.CarID &lt;&gt; -1)))
  124. <if test="dataStart != null and dataStart != '' and dataEnd != null and dataEnd != ''">
  125. and b.BillDate >= #{dataStart, jdbcType=VARCHAR} and b.BillDate &lt;= #{dataEnd, jdbcType=VARCHAR}
  126. </if>
  127. and p.IFORDER1ED='T'
  128. and ((p.DRIVER1ID=#{emplId, jdbcType=VARCHAR}) or (p.SUPERCARGOID=#{emplId, jdbcType=VARCHAR}))
  129. <if test="orderNo != null and orderNo != ''">
  130. and p.orderNo like #{orderNo}
  131. </if>
  132. </where>
  133. ORDER BY b.BillDate DESC ROWS #{head} TO #{tail}
  134. </select>
  135. <select id="getOrderBillsPlansByid" resultType="com.ruoyi.system.domain.OrderBillsPlans">
  136. Select g.CName goodsCName
  137. , p.LoadAddr loadAddr
  138. , l.SName loadFactory
  139. , p.LoadAttn loadAttn
  140. , p.LoadAttnTel loadAttnTel
  141. , p.UnLoadAddr unLoadAddr
  142. , ul.SName unLoadFactory
  143. , p.UnLoadAttn unLoadAttn
  144. , p.UNLoadAttnTel unLoadAttnTel
  145. , p.planRemarks
  146. , p.orderNo
  147. , p.loadQty
  148. , p.loadDate
  149. , p.unLoadQty
  150. , p.unLoadDate
  151. , p.emptyaddr1
  152. , p.odometerstart
  153. , p.emptyaddr2
  154. , p.odometerend
  155. , p.loadmile
  156. , p.remarks
  157. , p.driverassdesc
  158. , dr1.Empl driver1Name
  159. , dr1.mobile driver1mobile
  160. , p.sysId
  161. , b.entityId loadBillsEntityId
  162. , b.sysId loadBillsSysId
  163. , b.billStatus
  164. from OrderBillsPlans p
  165. Left join Empls e on (e.SysID = p.SysID and e.EmplID = p.TransactID)
  166. Left join Empls dr1 on (dr1.SysID = p.SysID and dr1.EmplID = p.DRIVER1ID)
  167. Left join Empls sp on (sp.SysID = p.SysID and sp.EmplID = p.SUPERCARGOID)
  168. Left join Corps c on (c.SysID = p.SysID and c.CorpID = p.CorpID)
  169. Left join Corps l on (l.SysID = p.SysID and l.CorpID = p.LoadFactoryID)
  170. Left join Corps ul on (ul.SysID = p.SysID and ul.CorpID = p.UnLoadFactoryID)
  171. Left join Goods g on (g.SysID = p.SysID and g.GoodsID = p.GoodsID)
  172. INNER JOIN LoadBills b
  173. ON
  174. p.SysID = b.SysID
  175. AND p.EntityID = b.SrcEntityID
  176. AND p.LineNo = b.SrcLineNo
  177. where p.SysID = 1
  178. and p.OrderNo = #{orderNo}
  179. </select>
  180. <select id="getItemsList" resultType="com.ruoyi.system.domain.vo.ItemsVo">
  181. select itemId, cName, itemProp, auditType from Items where SysID=1 and itemProp='F' order by zorder
  182. </select>
  183. <select id="getLoadFeeitemsMapByentityIdKeyItemId" resultType="java.util.Map">
  184. select itemId, atm1, entityId from LoadFeeItems where entityId = #{entityId}
  185. </select>
  186. <select id="getGasStations" resultType="com.ruoyi.system.domain.GasStations">
  187. select gasStationId, cName from GasStations
  188. </select>
  189. <select id="getOrderBillsPlansByOrder" resultType="com.ruoyi.system.domain.vo.OrderBillsPlansVo">
  190. select o.loadetc
  191. , o.loadtoll
  192. , o.oilhomeQty
  193. , o.oilhomeAmt
  194. , o.oilappoint1Qty
  195. , o.oilappoint1Amt
  196. , o.oilappoint2Qty
  197. , o.oilappoint2Amt
  198. , o.oilcash1Qty
  199. , o.oilcash1Amt
  200. , o.oilcardQty
  201. , o.oilcardAmt
  202. , b.gasstation1
  203. , b.gasstation2
  204. , o.entityId
  205. , o.orderNo
  206. , o.carId
  207. , o.lineNo
  208. , o.actId
  209. , b.entityID loadBillsEntityId
  210. , dr1.Empl driver1Name
  211. , dr1.mobile driver1mobile
  212. , b.billStatus
  213. , b.entityId loadBillsEntityId
  214. , b.sysId loadBillsSysId
  215. , o.driverassdesc
  216. FROM OrderBillsPlans o
  217. INNER JOIN LoadBills b
  218. ON
  219. o.SysID = b.SysID
  220. AND o.EntityID = b.SrcEntityID
  221. AND o.LineNo = b.SrcLineNo
  222. Left join Empls dr1 on dr1.EmplID = o.DRIVER1ID
  223. where o.orderNo = #{orderNo}
  224. and dr1.SysID = 1
  225. </select>
  226. <select id="getLoadFeeItemsByEntityId" resultType="com.ruoyi.system.domain.LoadFeeItems">
  227. select l.itemid, l.amt, i.cName, i.itemProp, i.auditType, l.lineNo, l.entityid, l.remarks
  228. from LoadFeeItems l
  229. inner join Items i on l.ItemID = i.ItemID
  230. where l.sysid = 1
  231. and l.entityId = #{entityId} order by l.lineno
  232. </select>
  233. <select id="getAttachMngsBySysIdEntityId" resultType="java.lang.Long">
  234. select MAX(lineNo) from AttachMngs where sysId = #{loadBillsSysId} and entityId = #{loadBillsEntityId}
  235. </select>
  236. <select id="getAttachMngsAttachtypeIdBySysIdAndEntityIdAndLineNo" resultType="java.lang.Long">
  237. select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and LineNo = #{lineNo}
  238. </select>
  239. <select id="getAttachMngsAttachIdBySysIdAndEntityIdAndActId" resultType="java.lang.Long">
  240. select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and ActID = #{actId}
  241. </select>
  242. <select id="getLoadBillsByOrderNo">
  243. select *
  244. FROM OrderBillsPlans o
  245. INNER JOIN LoadBills b
  246. ON
  247. o.SysID = b.SysID
  248. AND o.EntityID = b.SrcEntityID
  249. AND o.LineNo = b.SrcLineNo
  250. </select>
  251. </mapper>