OrderBillsPlansMapper.xml 11 KB

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