OrderBillsPlansMapper.xml 10.0 KB

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