123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.system.mapper.OrderBillsPlansMapper">
- <insert id="insertLoadFeeItems">
- Insert Into LoadFeeItems (SysID, EntityID, LineNo, CarID, ItemID, ItemProp, ItemAuditType, Dc, Qty, Price, Amt, AMT1, AMT2, AMTORG,
- OpUserID, OpUserName, SrcActID, SrcEntityID, SrcLineNo)
- values (1, #{o.loadBillsEntityId}, #{i.lineNo}, #{o.carId}, #{i.itemId}, #{i.itemProp}, #{i.auditType}, 'C', 1,
- #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt},
- #{e.EmplId}, #{e.empl}, #{o.actId}, #{o.entityId}, #{o.lineNo})
- </insert>
- <insert id="insertAttachMngs">
- insert into AttachMngs (SYSID, ENTITYID, ACTID, LINENO, USERNAME,ATTACHNAME)
- values (#{loadBillsSysId}, #{loadBillsEntityId}, #{actId}, #{lineNo}, #{userName}, #{attachName})
- </insert>
- <update id="updateOrderBillsPlansByid">
- update OrderBillsPlans
- set LoadQty = #{loadQty},
- LoadDate = #{loadDate},
- UnLoadQty = #{unLoadQty},
- UnLoadDate = #{unLoadDate},
- <if test="ifDetour != null and ifDetour != ''">
- ifDetour = #{ifDetour},
- <if test="detourEmptyMile != null and detourEmptyMile != '' or detourEmptyMile == 0">
- detourEmptyMile = #{detourEmptyMile},
- </if>
- <if test="detourLoadMile != null and detourLoadMile != '' or detourLoadMile == 0">
- detourLoadMile = #{detourLoadMile},
- </if>
- detourDesc = #{detourDesc},
- </if>
- driverassdesc = #{driverassdesc}
- where sysId = '1'
- and OrderNo = #{orderNo}
- </update>
- <update id="updateOrderBillsPlansByOrderNo">
- update OrderBillsPlans
- set loadetc = #{loadetc},
- loadtoll = #{loadtoll},
- oilhomeQty = #{oilhomeQty},
- oilhomeAmt = #{oilhomeAmt},
- oilappoint1Qty = #{oilappoint1Qty},
- oilappoint1Amt = #{oilappoint1Amt},
- oilappoint2Qty = #{oilappoint2Qty},
- oilappoint2Amt = #{oilappoint2Amt},
- oilappoint3Qty = #{oilappoint3Qty},
- oilappoint3Amt = #{oilappoint3Amt},
- oilcash1Qty = #{oilcash1Qty},
- oilcash1Amt = #{oilcash1Amt},
- oilcardQty = #{oilcardQty},
- oilcardAmt = #{oilcardAmt},
- oilcard1Qty = #{oilcardQty},
- oilcard1Amt = #{oilcardAmt},
- driverassdesc = #{driverassdesc}
- where orderNo = #{orderNo}
- </update>
- <update id="updateOrderBillsPlansBySysidEntityidLineno">
- update LoadFeeItems
- set Price = #{amt},
- Amt = #{amt},
- AMT1 = #{amt},
- AMT2 = #{amt},
- AMTORG = #{amt},
- remarks = #{remarks}
- where sysId = '1'
- AND entityid = #{entityId}
- and lineno = #{lineNo}
- </update>
- <update id="updateLoadBillsByEntityID">
- update LoadBills
- set gasstation1 = #{gasstation1},
- gasstation2 = #{gasstation2},
- gasstation3 = #{gasstation3}
- where SrcEntityID = #{entityId} and SrcLineNo = #{lineNo}
- </update>
- <update id="submitAudit">
- update OrderBillsPlans
- set IfStarted = 'S',
- startDate = CURRENT_TIMESTAMP
- where sysId = '1'
- and OrderNo = #{orderNo}
- </update>
- <update id="approved">
- update OrderBillsPlans
- set IfStarted = 'A',
- order4Date = CURRENT_TIMESTAMP
- where sysId = '1'
- and OrderNo = #{orderNo}
- </update>
- <update id="theAuditFailed">
- update OrderBillsPlans
- set IfStarted = 'B',
- order4Date = CURRENT_TIMESTAMP
- where sysId = '1'
- and OrderNo = #{orderNo}
- </update>
- <update id="approvedTaskList">
- UPDATE wf_TaskList SET status= 2 WHERE SYSID = '1' AND ACTID =#{actId} AND ENTITYID = #{entityId}
- </update>
- <update id="theAuditFailedTaskList">
- UPDATE wf_TaskList SET status= 0 WHERE SYSID = '1' AND ACTID =#{actId} AND ENTITYID = #{entityId}
- </update>
- <update id="upReceipts">
- update OrderBillsPlans set IfOrder2ed = 'S' where sysId = '1' and OrderNo = #{orderNo}
- </update>
- <update id="addAReviewComment">
- update loadbills set audit2Desc = #{audit2Desc} where SrcEntityID = #{entityId} and SrcLineNo = #{lineNo}
- </update>
- <delete id="deleteLoadFeeItemsByEntityId">
- delete from LoadFeeItems where sysid = 1 and entityid = #{entityId}
- </delete>
- <delete id="deleteTmsAttachMngsByAttachId">
- delete from AttachMngs where attachId = #{attachId}
- </delete>
- <select id="getOrderBillsPlansLsit" parameterType="Map" resultType="com.ruoyi.system.domain.WfTaskList">
- Select Distinct p.SysID sysId
- , p.EntityID entityId
- , p.LineNo lineNo
- , p.OrderNo orderNo
- ,p.CarID carID
- , p.CarRegNo carRegNo
- ,p.PlanLoadDate planLoadDate
- , p.LoadDate loadDate
- , p.LoadAddr loadAddr
- , p.EMPTYADDR1 emptyAddr1
- , p.EMPTYADDR2 emptyAddr2
- ,p.PlanUnLoadDate planUnLoadDate
- , p.UnLoadDate unLoadDate
- , p.UnLoadAddr unLoadAddr
- , p.Remarks remarks
- ,t.TaskID taskId
- , t.Status status
- ,t.AuditStatus auditStatus
- , t.ActID wfActId
- ,c.SName corpSName
- , c.CName corpCName
- , g.CName goodsCName
- ,l.SName loadFactory
- , ul.SName unLoadFactory
- ,dr1.Empl driver1Name
- ,dr1.mobile driver1mobile
- , sp.Empl sUPERCARGOName
- ,e.Empl transact
- , b.BillDate billDate
- , p.rightqty
- , b.billStatus
- , p.ifLoaded ifLoaded
- , p.ifUnLoaded ifUnLoaded
- , p.ifStarted ifStarted
- , p.ifOrder2ed ifOrder2ed
- from wf_TaskList t
- Left join LoadBills b on (b.SysID=t.SysID and b.EntityID=t.EntityID)
- Left join OrderBillsPlans p on (p.SysID=b.SysID and p.EntityID=b.SrcEntityID and p.LineNo=b.SrcLineNo)
- Left join Empls e on (e.SysID=b.SysID and e.EmplID=b.TransactID)
- Left join Empls dr1 on (dr1.SysID=b.SysID and dr1.EmplID=p.DRIVER1ID)
- Left join Empls sp on (sp.SysID=b.SysID and sp.EmplID=p.SUPERCARGOID)
- Left join Corps c on (c.SysID=p.SysID and c.CorpID=p.CorpID)
- Left join Corps l on (l.SysID=p.SysID and l.CorpID=p.LoadFactoryID)
- Left join Corps ul on (ul.SysID=b.SysID and ul.CorpID=p.UnLoadFactoryID)
- Left join Goods g on (g.SysID=b.SysID and g.GoodsID=b.GoodsID)
- <where>
- t.SysID=1
- <if test="type == 'BD'">
- and t.ActID=317
- <if test="flowType == '未装车'">
- and p.ifLoaded = 'F' and p.ifUnLoaded = 'F' and (p.ifOrder2ed = 'F' or p.ifOrder2ed = 'T')
- </if>
- <if test="flowType == '未卸车'">
- and p.ifLoaded = 'T' and p.ifUnLoaded = 'F' and (p.ifOrder2ed = 'F' or p.ifOrder2ed = 'T')
- </if>
- <if test="flowType == '已卸车'">
- and p.ifLoaded = 'T' and p.ifUnLoaded = 'T' and (p.ifOrder2ed = 'F' or p.ifOrder2ed = 'T')
- </if>
- <if test="flowType == '已提交'">
- and p.ifLoaded = 'T' and p.ifUnLoaded = 'T' and p.ifOrder2ed = 'S'
- </if>
- <if test="flowType == '已审核'">
- and p.ifLoaded = 'T' and p.ifUnLoaded = 'T' and p.IfOrder2ed = 'O'
- </if>
- </if>
- <if test="type == 'BX'">
- and t.ActID = #{actId, jdbcType=VARCHAR}
- <if test="flowType == '未提交'">
- and p.ifStarted = 'F'
- </if>
- <if test="flowType == '已提交'">
- and p.ifStarted = 'S'
- </if>
- <if test="flowType == '已通过'">
- and p.ifStarted = 'A'
- </if>
- <if test="flowType == '已退回'">
- and p.ifStarted = 'B'
- </if>
- </if>
- and ((b.CarID=-1) or ((b.CarID <> -1)))
- <if test="dataStart != null and dataStart != '' and dataEnd != null and dataEnd != ''">
- and b.BillDate >= #{dataStart, jdbcType=VARCHAR} and b.BillDate <= #{dataEnd, jdbcType=VARCHAR}
- </if>
- <if test="role == 0">
- and p.DeptUserID = #{emplId, jdbcType=VARCHAR}
- </if>
- <if test="role == 1">
- and ((p.DRIVER1ID=#{emplId, jdbcType=VARCHAR}) or (p.SUPERCARGOID=#{emplId, jdbcType=VARCHAR}))
- </if>
- <if test="orderNo != null and orderNo != ''">
- and (p.CarRegNo like #{orderNo}
- or p.loadAddr like #{orderNo}
- or p.unLoadAddr like #{orderNo}
- or g.CName like #{orderNo})
- </if>
- </where>
- ORDER BY b.BillDate DESC ROWS #{head} TO #{tail}
- </select>
- <select id="getOrderBillsPlansByid" resultType="com.ruoyi.system.domain.OrderBillsPlans">
- Select g.CName goodsCName
- , p.LoadAddr loadAddr
- , l.SName loadFactory
- , p.LoadAttn loadAttn
- , p.LoadAttnTel loadAttnTel
- , p.UnLoadAddr unLoadAddr
- , ul.SName unLoadFactory
- , p.UnLoadAttn unLoadAttn
- , p.UNLoadAttnTel unLoadAttnTel
- , p.planRemarks
- , p.orderNo
- , p.loadQty
- , p.loadDate
- , p.unLoadQty
- , p.unLoadDate
- , p.emptyaddr1
- , p.odometerstart
- , p.emptyaddr2
- , p.odometerend
- , p.loadmile
- , p.remarks
- , p.driverassdesc
- , dr1.Empl driver1Name
- , dr1.mobile driver1mobile
- , p.sysId
- , b.entityId loadBillsEntityId
- , b.sysId loadBillsSysId
- , b.billStatus
- , p.detourEmptyMile detourEmptyMile
- , p.detourLoadMile detourLoadMile
- , p.detourDesc detourDesc
- , p.ifDetour ifDetour
- , p.CarRegNo carRegNo
- , p.ifLoaded ifLoaded
- , p.ifUnLoaded ifUnLoaded
- , p.ifStarted ifStarted
- , p.ifOrder2ed ifOrder2ed
- from OrderBillsPlans p
- Left join Empls e on (e.SysID = p.SysID and e.EmplID = p.TransactID)
- Left join Empls dr1 on (dr1.SysID = p.SysID and dr1.EmplID = p.DRIVER1ID)
- Left join Empls sp on (sp.SysID = p.SysID and sp.EmplID = p.SUPERCARGOID)
- Left join Corps c on (c.SysID = p.SysID and c.CorpID = p.CorpID)
- Left join Corps l on (l.SysID = p.SysID and l.CorpID = p.LoadFactoryID)
- Left join Corps ul on (ul.SysID = p.SysID and ul.CorpID = p.UnLoadFactoryID)
- Left join Goods g on (g.SysID = p.SysID and g.GoodsID = p.GoodsID)
- INNER JOIN LoadBills b
- ON
- p.SysID = b.SysID
- AND p.EntityID = b.SrcEntityID
- AND p.LineNo = b.SrcLineNo
- where p.SysID = 1
- and p.OrderNo = #{orderNo}
- </select>
- <select id="getItemsList" resultType="com.ruoyi.system.domain.vo.ItemsVo">
- select itemId, cName, itemProp, auditType from Items where SysID=1 and itemProp='F' order by zorder
- </select>
- <select id="getLoadFeeitemsMapByentityIdKeyItemId" resultType="java.util.Map">
- select itemId, atm1, entityId from LoadFeeItems where entityId = #{entityId}
- </select>
- <select id="getGasStations" resultType="com.ruoyi.system.domain.GasStations">
- select gasStationId, cName from GasStations
- </select>
- <select id="getOrderBillsPlansByOrder" resultType="com.ruoyi.system.domain.vo.OrderBillsPlansVo">
- select o.loadetc
- , o.loadtoll
- , o.oilhomeQty
- , o.oilhomeAmt
- , o.oilappoint1Qty
- , o.oilappoint1Amt
- , o.oilappoint2Qty
- , o.oilappoint2Amt
- , o.oilcash1Qty
- , o.oilcash1Amt
- , o.oilcardQty
- , o.oilcardAmt
- , b.gasstation1
- , b.gasstation2
- , o.entityId
- , o.orderNo
- , o.carId
- , o.lineNo
- , o.actId
- , b.entityID loadBillsEntityId
- , dr1.Empl driver1Name
- , dr1.mobile driver1mobile
- , b.billStatus
- , b.entityId loadBillsEntityId
- , b.sysId loadBillsSysId
- , o.driverassdesc
- , o.ifLoaded ifLoaded
- , o.ifUnLoaded ifUnLoaded
- , o.ifStarted ifStarted
- , o.CarRegNo carRegNo
- , o.loadAddr loadAddr
- , o.unLoadAddr unLoadAddr
- , g.CName goodsCName
- , o.loadQty loadQty
- , o.loadDate loadDate
- , o.unLoadQty unLoadQty
- , o.unLoadDate unLoadDate
- , o.ifOrder2ed ifOrder2ed
- FROM OrderBillsPlans o
- INNER JOIN LoadBills b
- ON
- o.SysID = b.SysID
- AND o.EntityID = b.SrcEntityID
- AND o.LineNo = b.SrcLineNo
- Left join Empls dr1 on dr1.EmplID = o.DRIVER1ID
- Left join Goods g on (g.SysID=b.SysID and g.GoodsID=b.GoodsID)
- where o.orderNo = #{orderNo}
- and dr1.SysID = 1
- </select>
- <select id="getLoadFeeItemsByEntityId" resultType="com.ruoyi.system.domain.LoadFeeItems">
- select l.itemid, l.amt, i.cName, i.itemProp, i.auditType, l.lineNo, l.entityid, l.remarks
- from LoadFeeItems l
- inner join Items i on l.ItemID = i.ItemID
- where l.sysid = 1
- and l.entityId = #{entityId} order by l.lineno
- </select>
- <select id="getAttachMngsBySysIdEntityId" resultType="java.lang.Long">
- select MAX(lineNo) from AttachMngs where sysId = #{loadBillsSysId} and entityId = #{loadBillsEntityId}
- </select>
- <select id="getAttachMngsAttachtypeIdBySysIdAndEntityIdAndLineNo" resultType="java.lang.Long">
- select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and LineNo = #{lineNo}
- </select>
- <select id="getAttachMngsAttachIdBySysIdAndEntityIdAndActId" resultType="java.lang.Long">
- select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and ActID = #{actId}
- </select>
- <select id="getLoadBillsByOrderNo">
- select *
- FROM OrderBillsPlans o
- INNER JOIN LoadBills b
- ON
- o.SysID = b.SysID
- AND o.EntityID = b.SrcEntityID
- AND o.LineNo = b.SrcLineNo
- </select>
- <select id="getIsMileageOrderBillsPlansByOrder" resultType="com.ruoyi.system.domain.WfTaskList">
- SELECT
- t.SYSID,
- p.orderNo
- FROM
- wf_TaskList t
- LEFT JOIN LoadBills b ON
- (b.SysID = t.SysID
- AND b.EntityID = t.EntityID)
- LEFT JOIN OrderBillsPlans p ON
- (p.SysID = b.SysID
- AND p.EntityID = b.SrcEntityID
- AND p.LineNo = b.SrcLineNo)
- LEFT JOIN Empls e ON
- (e.SysID = b.SysID
- AND e.EmplID = b.TransactID)
- LEFT JOIN Empls dr1 ON
- (dr1.SysID = b.SysID
- AND dr1.EmplID = p.DRIVER1ID)
- LEFT JOIN Empls sp ON
- (sp.SysID = b.SysID
- AND sp.EmplID = p.SUPERCARGOID)
- LEFT JOIN Corps c ON
- (c.SysID = p.SysID
- AND c.CorpID = p.CorpID)
- LEFT JOIN Corps l ON
- (l.SysID = p.SysID
- AND l.CorpID = p.LoadFactoryID)
- LEFT JOIN Corps ul ON
- (ul.SysID = b.SysID
- AND ul.CorpID = p.UnLoadFactoryID)
- LEFT JOIN Goods g ON
- (g.SysID = b.SysID
- AND g.GoodsID = b.GoodsID)
- WHERE
- t.SysID = 1
- AND p.orderNo = #{orderNo}
- AND t.ActID = 317
- AND t.Status = 2
- and p.ifLoaded != 'T'
- and p.ifUnLoaded != 'T'
- </select>
- </mapper>
|