| | |
| | | <result property="settlementStatus" column="settlement_status" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="isCreate" column="is_create" /> |
| | | <result property="billId" column="bill_id" /> |
| | | <result property="billName" column="bill_name" /> |
| | | <result property="confirmedTotalIncome" column="confirmed_total_income" /> |
| | | <result property="confirmedTotalCost" column="confirmed_total_cost" /> |
| | | <result property="isIncomeMatched" column="is_income_matched" /> |
| | | <result property="isCostMatched" column="is_cost_matched" /> |
| | | <result property="relatedBillStatus" column="related_bill_status" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectPendingSettlementBusinessVo"> |
| | | select thisTab.id, thisTab.booking_no, thisTab.customer_id, thisTab.carrier_id, thisTab.project_name, thisTab.dispatch_no, thisTab.created_time, thisTab.transport_mode, thisTab.product_id, thisTab.customer_name, thisTab.operation_mode, thisTab.carrier_name, thisTab.departure_location, thisTab.arrival_location, thisTab.vehicle_id, thisTab.license_plate_number, thisTab.vehicle_type, thisTab.main_driver, thisTab.assistant_driver, thisTab.point_num, thisTab.business_contact, thisTab.estimated_total_income, thisTab.estimated_total_cost, thisTab.estimated_profit, thisTab.electronic_lock, thisTab.re_weighing_weight, thisTab.quantity, thisTab.actual_departure_time, thisTab.required_arrival_time, thisTab.actual_arrival_time, thisTab.be_return, thisTab.dispatch_quantity, thisTab.dispatch_weight, thisTab.dispatch_volume, thisTab.empty_mileage, thisTab.empty_fuel, thisTab.heavy_mileage, thisTab.heavy_fuel, thisTab.be_scheduled, thisTab.tracking_no, thisTab.seal_no, thisTab.schedule_no, thisTab.transport_status, thisTab.estimated_bill_id, thisTab.settlement_bill_id, thisTab.settlement_status, thisTab.create_time, thisTab.update_time from pending_settlement_business AS thisTab |
| | | select thisTab.id, thisTab.booking_no, thisTab.customer_id, thisTab.carrier_id, thisTab.project_name, thisTab.dispatch_no, thisTab.created_time, thisTab.transport_mode, thisTab.product_id, thisTab.customer_name, thisTab.operation_mode, thisTab.carrier_name, thisTab.departure_location, thisTab.arrival_location, thisTab.vehicle_id, thisTab.license_plate_number, thisTab.vehicle_type, thisTab.main_driver, thisTab.assistant_driver, thisTab.point_num, thisTab.business_contact, thisTab.estimated_total_income, thisTab.estimated_total_cost, thisTab.estimated_profit, thisTab.electronic_lock, thisTab.re_weighing_weight, thisTab.quantity, thisTab.actual_departure_time, thisTab.required_arrival_time, thisTab.actual_arrival_time, thisTab.be_return, thisTab.dispatch_quantity, thisTab.dispatch_weight, thisTab.dispatch_volume, thisTab.empty_mileage, thisTab.empty_fuel, thisTab.heavy_mileage, thisTab.heavy_fuel, thisTab.be_scheduled, thisTab.tracking_no, thisTab.seal_no, thisTab.schedule_no, thisTab.transport_status, thisTab.estimated_bill_id, thisTab.settlement_bill_id, thisTab.bill_id, thisTab.settlement_status, thisTab.create_time, thisTab.update_time, thisTab.is_create, thisTab.bill_name, thisTab.confirmed_total_income, thisTab.confirmed_total_cost, thisTab.is_income_matched, thisTab.is_cost_matched, thisTab.related_bill_status from pending_settlement_business AS thisTab |
| | | </sql> |
| | | <sql id="selectPendingSettlementBusinessVoCount"> |
| | | select count(0) from pending_settlement_business as thisTab |
| | |
| | | <if test="dispatchVolume != null "> and thisTab.dispatch_volume = #{dispatchVolume}</if> |
| | | <if test="emptyMileage != null "> and thisTab.empty_mileage = #{emptyMileage}</if> |
| | | <if test="emptyFuel != null "> and thisTab.empty_fuel = #{emptyFuel}</if> |
| | | <if test="isCreate != null "> and thisTab.is_create = #{isCreate}</if> |
| | | <if test="billId != null "> and thisTab.bill_id = #{billId}</if> |
| | | <if test="heavyMileage != null "> and thisTab.heavy_mileage = #{heavyMileage}</if> |
| | | <if test="heavyFuel != null "> and thisTab.heavy_fuel = #{heavyFuel}</if> |
| | | <if test="confirmedTotalIncome != null "> and thisTab.confirmed_total_income = #{confirmedTotalIncome}</if> |
| | | <if test="confirmedTotalCost != null "> and thisTab.confirmed_total_cost = #{confirmedTotalCost}</if> |
| | | <if test="isIncomeMatched != null "> and thisTab.is_income_matched = #{isIncomeMatched}</if> |
| | | <if test="isCostMatched != null "> and thisTab.is_cost_matched = #{isCostMatched}</if> |
| | | <if test="beScheduled != null and beScheduled != ''"> and thisTab.be_scheduled = #{beScheduled}</if> |
| | | <if test="trackingNo != null and trackingNo != ''"> and thisTab.tracking_no = #{trackingNo}</if> |
| | | <if test="sealNo != null and sealNo != ''"> and thisTab.seal_no = #{sealNo}</if> |
| | |
| | | <include refid="whereCondition"/> |
| | | </where> |
| | | order by thisTab.id desc |
| | | </select> |
| | | <select id="selectPendingSettlement2Cw" resultType="com.ruoyi.cwgl.domain.PendingSettlementBusiness"> |
| | | SELECT |
| | | -- ord.BOOKING_NO '客户订单号', |
| | | -- ord.CUSTOMER_ID, |
| | | -- ts.CARRIER_ID, |
| | | ts.ID as serviceId, |
| | | brd.PROJECT_NAME as projectName, |
| | | ts.DISPATCH_NO as dispatchNo, |
| | | ts.CREATED_TIME as createdTime, |
| | | -- ts.TRANSPORT_MODE '运输方式', |
| | | -- ts.PRODUCT_ID '服务产品', |
| | | customer.NAME as customerName, |
| | | case when ts.CARRIER_ID=50 then |
| | | '自营' |
| | | else '外协' |
| | | end as operationMode, |
| | | bp.NAME as carrierName, |
| | | location_d.NAME_TREE as departureLocation, |
| | | location_a.NAME_TREE as arrivalLocation, |
| | | -- ts.VEHICLE_ID '运输工具ID', |
| | | vhc.LICENSE_PLATE_NUMBER as licensePlateNumber, |
| | | bvt.NAME as vehicleType, |
| | | driver_m.NAME as mainDriver, |
| | | ts.POINT_NUM as pointNum, |
| | | ts.CREATOR as businessContact, |
| | | |
| | | -- ts.ELECTRONIC_LOCK '电子锁', |
| | | -- ts.RE_WEIGHING_WEIGHT '复磅重量', |
| | | ts.QUANTITY as quantity, |
| | | driver_a.NAME as assistantDriver, |
| | | ts.ACTUAL_DEPARTURE_TIME as actualDepartureTime, |
| | | ts.REQUIRED_ARRIVAL_TIME as requiredArrivalTime, |
| | | ts.ACTUAL_ARRIVAL_TIME as actualArrivalTime, |
| | | ts.BE_RETURN as beReturn, |
| | | ts.DISPATCH_QUANTITY as dispatchQuantity, |
| | | ts.DISPATCH_WEIGHT as dispatchWeight, |
| | | ts.DISPATCH_VOLUME as dispatchVolume, |
| | | -- ts.EMPTY_MILEAGE '空载里程(公里)', |
| | | -- ts.EMPTY_FUEL '空载油耗(升)', |
| | | -- ts.HEAVY_MILEAGE '重载里程(公里)', |
| | | -- ts.HEAVY_FUEL '重载油耗(升)', |
| | | -- ts.BE_SCHEDULED '是否按班次', |
| | | -- ts.TRACKING_NO '快递单号', |
| | | -- ts.SEAL_NO '铅封号', |
| | | -- ts.SCHEDULE_NO '班次号', |
| | | CASE ts.STATUS |
| | | WHEN 'A' THEN '生效' |
| | | WHEN 'O' THEN '打开' |
| | | WHEN 'J' THEN '已接单' |
| | | WHEN 'K' THEN '已到库' |
| | | WHEN 'Z' THEN '已装车' |
| | | WHEN 'T' THEN '在途' |
| | | WHEN 'F' THEN '已复磅' |
| | | WHEN 'D' THEN '已运抵' |
| | | ELSE '未知状态' |
| | | END AS transportStatus |
| | | |
| | | |
| | | FROM |
| | | tms_shipment ts |
| | | -- 订单表 |
| | | LEFT JOIN oms_order ord ON ts.DISPATCH_NO = ord.DISPATCH_CODE |
| | | -- 客户表 |
| | | LEFT join base_customer customer on customer.ID=ord.CUSTOMER_ID |
| | | -- 运输工具表 |
| | | left join tms_vehicle vhc on ts.VEHICLE_ID=vhc.id |
| | | -- 车型数据表 |
| | | LEFT JOIN base_vehicle_type bvt on bvt.ID=vhc.VEHICLE_TYPE_ID |
| | | -- 承运商表 |
| | | left join base_provider bp on bp.ID=ts.CARRIER_ID |
| | | -- 司机表 |
| | | left join tms_driver driver_m on driver_m.ID=ts.MAIN_DRIVER_ID |
| | | -- 司机表 |
| | | left join tms_driver driver_a on driver_a.ID=ts.ASSISTANT_DRIVER_ID |
| | | -- 地区表 |
| | | left join base_location location_a on location_a.ID =ts.ARRIVAL_LOCATION_ID |
| | | -- 地区表 |
| | | left join base_location location_d on location_d.ID =ts.DEPARTURE_LOCATION_ID |
| | | -- 路线详情表表 |
| | | left join base_plan_road_detail prd on prd.ID =ts.PLAN_ROAD_DETAIL_ID |
| | | -- 路线表 |
| | | LEFT join base_road_survey brd on brd.ID = prd.ROAD_SURVEY_ID |
| | | |
| | | |
| | | where ts.STATUS='D' |
| | | and ts.IS_SYNC = 0 |
| | | |
| | | |
| | | |
| | | </select> |
| | | <select id="selectReceivableLineTruckPriceRule" |
| | | resultType="com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule"> |
| | | |
| | | SELECT |
| | | rtd.id as id, |
| | | rtd.REFERENCE1 as feeType, |
| | | rtd.REFERENCE2 as customerName, |
| | | rtd.REFERENCE3 as departureCity, |
| | | rtd.REFERENCE4 as departureDistrict, |
| | | rtd.REFERENCE5 as arrivalCity, |
| | | rtd.REFERENCE6 as arrivalDistrict, |
| | | rtd.REFERENCE7 as vehicleType, |
| | | rtd.VALUE1 as freight, |
| | | rtd.CREATED_TIME as createdTime |
| | | FROM |
| | | thorn_rule_table_detail rtd |
| | | LEFT JOIN thorn_rule_version rv ON rtd.VERSION_ID = rv.id |
| | | LEFT JOIN thorn_rule_table rt ON rv.RULE_TABLE_ID = rt.id |
| | | WHERE |
| | | rt.STATUS = 'ACTIVE' |
| | | AND rt.NAME = '应收线路整车价格' and rtd.REFERENCE1='运费' |
| | | |
| | | </select> |
| | | <select id="selectPayableLineTruckPriceRule" |
| | | resultType="com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule"> |
| | | |
| | | SELECT |
| | | rtd.id as id, |
| | | rtd.REFERENCE1 as feeType, |
| | | rtd.REFERENCE2 as customerName, |
| | | rtd.REFERENCE3 as departureCity, |
| | | rtd.REFERENCE4 as departureDistrict, |
| | | rtd.REFERENCE5 as arrivalCity, |
| | | rtd.REFERENCE6 as arrivalDistrict, |
| | | rtd.REFERENCE7 as vehicleType, |
| | | rtd.VALUE1 as freight, |
| | | rtd.CREATED_TIME as createdTime |
| | | FROM |
| | | thorn_rule_table_detail rtd |
| | | LEFT JOIN thorn_rule_version rv ON rtd.VERSION_ID = rv.id |
| | | LEFT JOIN thorn_rule_table rt ON rv.RULE_TABLE_ID = rt.id |
| | | WHERE |
| | | rt.STATUS = 'ACTIVE' |
| | | AND rt.NAME = '应付线路整车价格' and rtd.REFERENCE1='运费' |
| | | </select> |
| | | <select id="selectCustomName" resultType="java.lang.String"> |
| | | SELECT customer_name from pending_settlement_business group by customer_name |
| | | |
| | | </select> |
| | | <select id="selectPendingSettlementBusinessDispatchNos" resultType="java.lang.String"> |
| | | SELECT dispatch_no from pending_settlement_business where bill_id = #{id} |
| | | |
| | | </select> |
| | | <select id="selectPendingSettlementBusinessByNo" |
| | | resultMap="PendingSettlementBusinessResult"> |
| | | <include refid="selectPendingSettlementBusinessVo"/> |
| | | where dispatch_no = #{dispatchNo} |
| | | |
| | | </select> |
| | | |
| | | <!-- 新增 --> |
| | |
| | | <if test="settlementStatus != null">settlement_status,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="isCreate != null">is_create,</if> |
| | | <if test="confirmedTotalIncome != null">confirmed_total_income,</if> |
| | | <if test="confirmedTotalCost != null">confirmed_total_cost,</if> |
| | | <if test="isIncomeMatched != null">is_income_matched,</if> |
| | | <if test="isCostMatched != null">is_cost_matched,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="bookingNo != null">#{bookingNo},</if> |
| | |
| | | <if test="settlementStatus != null">#{settlementStatus},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="isCreate != null">#{isCreate},</if> |
| | | <if test="confirmedTotalIncome != null">#{confirmedTotalIncome},</if> |
| | | <if test="confirmedTotalCost != null">#{confirmedTotalCost},</if> |
| | | <if test="isIncomeMatched != null">#{isIncomeMatched},</if> |
| | | <if test="isCostMatched != null">#{isCostMatched},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <insert id="insertPendingSettlementBusinessBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> |
| | | <insert id="insertPendingSettlementBusinessBatch" parameterType="java.util.List"> |
| | | insert into pending_settlement_business |
| | | <trim prefix="(" suffix=") values" suffixOverrides=","> |
| | | id,booking_no,customer_id,carrier_id,project_name,dispatch_no,created_time,transport_mode,product_id,customer_name,operation_mode,carrier_name,departure_location,arrival_location,vehicle_id,license_plate_number,vehicle_type,main_driver,assistant_driver,point_num,business_contact,estimated_total_income,estimated_total_cost,estimated_profit,electronic_lock,re_weighing_weight,quantity,actual_departure_time,required_arrival_time,actual_arrival_time,be_return,dispatch_quantity,dispatch_weight,dispatch_volume,empty_mileage,empty_fuel,heavy_mileage,heavy_fuel,be_scheduled,tracking_no,seal_no,schedule_no,transport_status,estimated_bill_id,settlement_bill_id,settlement_status,create_time,update_time, |
| | | booking_no,customer_id,carrier_id,project_name,dispatch_no,created_time,transport_mode,product_id,customer_name,operation_mode,carrier_name,departure_location,arrival_location,vehicle_id,license_plate_number,vehicle_type,main_driver,assistant_driver,point_num,business_contact,estimated_total_income,estimated_total_cost,estimated_profit,electronic_lock,re_weighing_weight,quantity,actual_departure_time,required_arrival_time,actual_arrival_time,be_return,dispatch_quantity,dispatch_weight,dispatch_volume,empty_mileage,empty_fuel,heavy_mileage,heavy_fuel,be_scheduled,tracking_no,seal_no,schedule_no,transport_status,estimated_bill_id,settlement_bill_id,settlement_status,create_time,update_time,is_create,is_income_matched,is_cost_matched, |
| | | </trim> |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | <trim prefix="(" suffix=") " suffixOverrides=","> |
| | | #{item.id},#{item.bookingNo},#{item.customerId},#{item.carrierId},#{item.projectName},#{item.dispatchNo},#{item.createdTime},#{item.transportMode},#{item.productId},#{item.customerName},#{item.operationMode},#{item.carrierName},#{item.departureLocation},#{item.arrivalLocation},#{item.vehicleId},#{item.licensePlateNumber},#{item.vehicleType},#{item.mainDriver},#{item.assistantDriver},#{item.pointNum},#{item.businessContact},#{item.estimatedTotalIncome},#{item.estimatedTotalCost},#{item.estimatedProfit},#{item.electronicLock},#{item.reWeighingWeight},#{item.quantity},#{item.actualDepartureTime},#{item.requiredArrivalTime},#{item.actualArrivalTime},#{item.beReturn},#{item.dispatchQuantity},#{item.dispatchWeight},#{item.dispatchVolume},#{item.emptyMileage},#{item.emptyFuel},#{item.heavyMileage},#{item.heavyFuel},#{item.beScheduled},#{item.trackingNo},#{item.sealNo},#{item.scheduleNo},#{item.transportStatus},#{item.estimatedBillId},#{item.settlementBillId},#{item.settlementStatus},#{item.createTime},#{item.updateTime}, |
| | | #{item.bookingNo},#{item.customerId},#{item.carrierId},#{item.projectName},#{item.dispatchNo},#{item.createdTime},#{item.transportMode},#{item.productId},#{item.customerName},#{item.operationMode},#{item.carrierName},#{item.departureLocation},#{item.arrivalLocation},#{item.vehicleId},#{item.licensePlateNumber},#{item.vehicleType},#{item.mainDriver},#{item.assistantDriver},#{item.pointNum},#{item.businessContact},#{item.estimatedTotalIncome},#{item.estimatedTotalCost},#{item.estimatedProfit},#{item.electronicLock},#{item.reWeighingWeight},#{item.quantity},#{item.actualDepartureTime},#{item.requiredArrivalTime},#{item.actualArrivalTime},#{item.beReturn},#{item.dispatchQuantity},#{item.dispatchWeight},#{item.dispatchVolume},#{item.emptyMileage},#{item.emptyFuel},#{item.heavyMileage},#{item.heavyFuel},#{item.beScheduled},#{item.trackingNo},#{item.sealNo},#{item.scheduleNo},#{item.transportStatus},#{item.estimatedBillId},#{item.settlementBillId},#{item.settlementStatus},#{item.createTime},#{item.updateTime},#{item.isCreate},#{item.isIncomeMatched},#{item.isCostMatched}, |
| | | </trim> |
| | | </foreach> |
| | | </insert> |
| | |
| | | <if test="settlementStatus != null">settlement_status = #{settlementStatus},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="isCreate != null">is_create = #{isCreate},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | <if test="item.settlementStatus != null">settlement_status = #{item.settlementStatus},</if> |
| | | <if test="item.createTime != null">create_time = #{item.createTime},</if> |
| | | <if test="item.updateTime != null">update_time = #{item.updateTime},</if> |
| | | <if test="item.isCreate != null">is_create = #{item.isCreate},</if> |
| | | </trim> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | <update id="updeteCwData"> |
| | | update pending_settlement_business set IS_SYNC = 1 |
| | | where ID in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | |
| | | </update> |
| | | <update id="updatePendingSettlementBusinessIsCreate"> |
| | | |
| | | UPDATE pending_settlement_business |
| | | SET is_create = 1 ,bill_id = #{id},bill_name = #{billName},related_bill_status = 1 |
| | | WHERE dispatch_no IN |
| | | <foreach item="item" collection="list" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | <update id="updatePendingSettlementBusinessByBillId"> |
| | | UPDATE pending_settlement_business set bill_name = #{billName} |
| | | where bill_id = #{id} |
| | | |
| | | </update> |
| | | <update id="updateEstimatedReceivableBillStatus"> |
| | | UPDATE pending_settlement_business |
| | | SET related_bill_status = #{status} |
| | | WHERE dispatch_no IN |
| | | <foreach item="item" collection="list" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | <delete id="cancelRelevancy"> |
| | | UPDATE pending_settlement_business set bill_id = null ,bill_name = null,is_create = 0,related_bill_status = 0 |
| | | where id = #{id} |
| | | </delete> |
| | | |
| | | </mapper> |