| | |
| | | <if test="status != null and status != ''"> and thisTab.status = #{status}</if> |
| | | <if test="isDeleted != null "> and thisTab.is_deleted = #{isDeleted}</if> |
| | | </sql> |
| | | <sql id="whereCondition2"> |
| | | <if test="dispatchNo != null and dispatchNo != ''"> and ts.DISPATCH_NO = #{dispatchNo}</if> |
| | | <if test="transportMode != null and transportMode != ''"> and ts.TRANSPORT_MODE = #{transportMode}</if> |
| | | <if test="productName != null and productName != ''"> and ts.PRODUCT_ID like concat('%', #{productName}, '%')</if> |
| | | <if test="carrierName != null and carrierName != ''"> and bp.NAME like concat('%', #{carrierName}, '%')</if> |
| | | <if test="departureLocationName != null and departureLocationName != ''"> and location_d.NAME_TREE like concat('%', #{departureLocationName}, '%')</if> |
| | | <if test="arrivalLocationName != null and arrivalLocationName != ''"> and location_a.NAME_TREE like concat('%', #{arrivalLocationName}, '%')</if> |
| | | <if test="licensePlateNumber != null and licensePlateNumber != ''"> and vhc.LICENSE_PLATE_NUMBER = #{licensePlateNumber}</if> |
| | | <if test="vehiclePlateId != null and vehiclePlateId != ''"> and ts.VEHICLE_PLATE_ID = #{vehiclePlateId}</if> |
| | | <if test="mainDriverName != null and mainDriverName != ''"> and driver_m.NAME like concat('%', #{mainDriverName}, '%')</if> |
| | | <if test="assistantDriverName != null and assistantDriverName != ''"> and driver_a.NAME like concat('%', #{assistantDriverName}, '%')</if> |
| | | <if test="pointNum != null "> and ts.POINT_NUM = #{pointNum}</if> |
| | | <if test="quantity != null "> and ts.QUANTITY = #{quantity}</if> |
| | | <if test="actualDepartureTime != null "> and ts.ACTUAL_DEPARTURE_TIME = #{actualDepartureTime}</if> |
| | | <if test="requiredArrivalTime != null "> and ts.REQUIRED_ARRIVAL_TIME = #{requiredArrivalTime}</if> |
| | | <if test="actualArrivalTime != null "> and ts.ACTUAL_ARRIVAL_TIME = #{actualArrivalTime}</if> |
| | | <if test="beReturn != null and beReturn != ''"> and ts.BE_RETURN = #{beReturn}</if> |
| | | <if test="dispatchQuantity != null "> and ts.DISPATCH_QUANTITY = #{dispatchQuantity}</if> |
| | | <if test="dispatchWeight != null "> and ts.DISPATCH_WEIGHT = #{dispatchWeight}</if> |
| | | <if test="dispatchVolume != null "> and ts.DISPATCH_VOLUME = #{dispatchVolume}</if> |
| | | <if test="status != null and status != ''"> and ts.STATUS = #{status}</if> |
| | | </sql> |
| | | |
| | | <!--查询--> |
| | | <select id="selectDispatchOrderById" parameterType="Integer" resultMap="DispatchOrderResult"> |
| | |
| | | ts.DISPATCH_NO as 'dispatch_no', |
| | | ts.TRANSPORT_MODE as 'transport_mode', |
| | | ts.PRODUCT_ID as 'product_name', |
| | | bp.`NAME` as 'carrier_name', |
| | | bp.NAME as 'carrier_name', |
| | | location_d.NAME_TREE as 'departure_location_name', |
| | | -- ts.ARRIVAL_LOCATION_ID '目的地ID', |
| | | location_a.NAME_TREE as 'arrival_location_name', |
| | | -- ts.VEHICLE_ID '运输工具ID', |
| | | vhc.LICENSE_PLATE_NUMBER as 'license_plate_number', |
| | | ts.VEHICLE_PLATE_ID as 'vehicle_plate_id', |
| | | driver_m.`NAME` as 'main_driver_name', |
| | | driver_a.`NAME` as 'assistant_driver_name', |
| | | driver_m.NAME as 'main_driver_name', |
| | | driver_a.NAME as 'assistant_driver_name', |
| | | ts.POINT_NUM as 'point_num', |
| | | -- ts.ELECTRONIC_LOCK '电子锁', |
| | | -- ts.RE_WEIGHING_WEIGHT '复磅重量', |
| | |
| | | -- 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 'status', |
| | | ts.STATUS AS 'status', |
| | | -- ts.ESTIMATED_COST '预估费用', |
| | | -- ts.ESTIMATED_CARRIER_NUM '预估承运商数', |
| | | -- ts.ESTIMATED_COST_SAVING '预估节约费用', |
| | |
| | | -- 地区表 |
| | | left join base_location location_d on location_d.ID =ts.DEPARTURE_LOCATION_ID |
| | | -- where ts.CREATED_TIME >'2025-07-01 00:00:01' |
| | | <!-- <where> |
| | | <include refid="whereCondition"/> |
| | | </where>--> |
| | | <where> |
| | | <include refid="whereCondition2"/> |
| | | </where> |
| | | order by ts.CREATED_TIME desc |
| | | </select> |
| | | <select id="selectDispatchOrderItemByNo" resultType="com.ruoyi.cwgl.domain.DispatchOrderItem"> |
| | | SELECT |
| | | ts.CREATED_TIME as createdTime, |
| | | ts.DISPATCH_NO as dispatchNo, |
| | | ts.TRANSPORT_MODE as transportMode, |
| | | ts.LOAD_MODE as loadMode, |
| | | ts.PRODUCT_ID as productId, |
| | | bp.NAME as carrierName, |
| | | ts.VEHICLE_TYPE_ID as vehicleTypeId, |
| | | vhc.LICENSE_PLATE_NUMBER as licensePlateNumber, |
| | | ts.VEHICLE_PLATE_ID as vehiclePlateId, |
| | | -- ts.MAIN_DRIVER_ID '主驾驶员ID', |
| | | -- ts.ASSISTANT_DRIVER_ID '副驾驶员ID', |
| | | driver_m.NAME as mainDriverName, |
| | | driver_a.NAME as assistantDriverName, |
| | | ts.POINT_NUM as pointNum, |
| | | ts.RE_WEIGHING_WEIGHT as reWeighingWeight, |
| | | ts.QUANTITY as quantity, |
| | | ts.REQUIRED_ARRIVAL_TIME as requiredArrivalTime, |
| | | ts.ACTUAL_DEPARTURE_TIME as actualDepartureTime, |
| | | ts.ACTUAL_ARRIVAL_TIME as actualArrivalTime, |
| | | -- ts.BE_RETURN '是否回程', |
| | | ts.DISPATCH_QUANTITY as dispatchQuantity, |
| | | ts.DISPATCH_WEIGHT as dispatchWeight, |
| | | ts.DISPATCH_VOLUME as dispatchVolume, |
| | | -- bfd.ID '账单明细Id', |
| | | ts.STATUS as status, |
| | | ts.TRANSPORT_LINE as transportLine, |
| | | -- ts.REMARK '调度单备注', |
| | | -- ts.ROUTE_CODE '线路号', |
| | | -- ts.DEPARTURE_LOCATION_ID '出发地ID', |
| | | location_d.NAME_TREE as departureLocationName, |
| | | -- ts.ARRIVAL_LOCATION_ID '目的地ID', |
| | | location_a.NAME_TREE as arrivalLocationName, |
| | | -- bill.id '账单ID', |
| | | fb.type AS billType, |
| | | |
| | | bfd.CREATED_TIME as feeDataCreatedTime, |
| | | -- bfd.BILL_ID '账单明细ID', |
| | | bfd.CHECK_STATUS as checkStatus, |
| | | bfd.CURRENCY_TYPE as currencyType, |
| | | -- bfd.ENTITY_LEVEL2 '二级主体', |
| | | -- bfd.ENTITY_LEVEL3 '三级主体', |
| | | -- bfd.FEE_BOOK_ID '账本ID', |
| | | bfd.FEE_ITEM as feeItem, |
| | | -- bfd.FEE_SOURCE '费用来源', |
| | | bfd.FEE_TIME as feeTime, |
| | | bfd.REMARK as remark, |
| | | bfd.SETTLE_FEE as settleFee, |
| | | bfd.STATUS as feeDataStatus, |
| | | bt.FIELDS as settableFeeItems, |
| | | bill.NAME as billName, |
| | | -- bill.CHECK_ONLINE'在线对账', |
| | | bill.STATUS AS billStatus |
| | | FROM |
| | | -- 账单明细表 |
| | | bms_fee_data bfd |
| | | -- 订单表 |
| | | LEFT JOIN oms_order ord |
| | | ON bfd.ENTITY_ID = ord.DISPATCH_CODE |
| | | -- 调度单表 |
| | | LEFT JOIN tms_shipment ts |
| | | ON ts.DISPATCH_NO = ord.DISPATCH_CODE |
| | | -- 账单主表 |
| | | left join bms_bill bill on bill.id= bfd.BILL_ID |
| | | -- 账册表 |
| | | LEFT JOIN bms_fee_book fb ON fb.id = bill.FEE_BOOK_ID |
| | | -- 运输工具表 |
| | | left join tms_vehicle vhc on ts.VEHICLE_ID=vhc.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 bms_bill_template bt on bt.ID=bill.BILL_TEMPLATE_ID |
| | | WHERE |
| | | bfd.ENTITY_ID = #{no} |
| | | |
| | | </select> |
| | | <select id="selectDispatchOrderAttachment" resultType="com.ruoyi.cwgl.domain.vo.DispatchOrderAttachmentVo"> |
| | | -- 查询调度单号或者调度单ID查附件 |
| | | SELECT |
| | | -- image.PATH, |
| | | CONCAT('https://tms.ygalogisticspark.com/ImageViewServlet?id=',image.id) as imageUrl, |
| | | -- tof.FEE_TYPE_ID '费用类型ID', |
| | | bfi.FEE_TYPE as feeItem, |
| | | tof.account as account, |
| | | case tof.CURRENCY_ID |
| | | when 1 then '港币' |
| | | when 2 then '人民币' |
| | | else '未知' |
| | | end as currency |
| | | |
| | | FROM |
| | | -- 其他费用表 |
| | | Tms_Other_Fee tof |
| | | -- 调度单表 |
| | | LEFT JOIN tms_shipment ts ON tof.dispatch_Order_Id = ts.id |
| | | -- 附件表 |
| | | LEFT JOIN Thorn_Attachment image ON image.OBJ_ID = tof.id |
| | | -- 费用类型表 |
| | | left join base_fee_item bfi on bfi.id=tof.FEE_TYPE_ID |
| | | WHERE |
| | | ts.DISPATCH_NO = #{no} |
| | | AND image.biz_Type = 'com.vtradex.tms.core.model.entity.fee.TmsOtherFee'; |
| | | |
| | | |
| | | </select> |
| | | |
| | | <!-- 新增 --> |
| | | <insert id="insertDispatchOrder" parameterType="com.ruoyi.cwgl.domain.DispatchOrder" useGeneratedKeys="true" keyProperty="id"> |