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
select count(0) from pending_settlement_business as thisTab
and thisTab.booking_no = #{bookingNo}
and thisTab.customer_id = #{customerId}
and thisTab.carrier_id = #{carrierId}
and thisTab.project_name like concat('%', #{projectName}, '%')
and thisTab.dispatch_no = #{dispatchNo}
and thisTab.created_time = #{createdTime}
and thisTab.transport_mode = #{transportMode}
and thisTab.product_id = #{productId}
and thisTab.customer_name like concat('%', #{customerName}, '%')
and thisTab.operation_mode = #{operationMode}
and thisTab.carrier_name like concat('%', #{carrierName}, '%')
and thisTab.departure_location = #{departureLocation}
and thisTab.arrival_location = #{arrivalLocation}
and thisTab.vehicle_id = #{vehicleId}
and thisTab.license_plate_number = #{licensePlateNumber}
and thisTab.vehicle_type = #{vehicleType}
and thisTab.main_driver = #{mainDriver}
and thisTab.assistant_driver = #{assistantDriver}
and thisTab.point_num = #{pointNum}
and thisTab.business_contact = #{businessContact}
and thisTab.estimated_total_income = #{estimatedTotalIncome}
and thisTab.estimated_total_cost = #{estimatedTotalCost}
and thisTab.estimated_profit = #{estimatedProfit}
and thisTab.electronic_lock = #{electronicLock}
and thisTab.re_weighing_weight = #{reWeighingWeight}
and thisTab.quantity = #{quantity}
and thisTab.actual_departure_time between #{actualDepartureTimeBegin} and #{actualDepartureTimeEnd}
and thisTab.required_arrival_time between #{requiredArrivalTimeBegin} and #{requiredArrivalTimeEnd}
and thisTab.actual_arrival_time between #{actualArrivalTimeBegin} and #{actualArrivalTimeEnd}
and thisTab.be_return = #{beReturn}
and thisTab.dispatch_quantity = #{dispatchQuantity}
and thisTab.dispatch_weight = #{dispatchWeight}
and thisTab.dispatch_volume = #{dispatchVolume}
and thisTab.empty_mileage = #{emptyMileage}
and thisTab.empty_fuel = #{emptyFuel}
and thisTab.is_create = #{isCreate}
and thisTab.bill_id = #{billId}
and thisTab.heavy_mileage = #{heavyMileage}
and thisTab.heavy_fuel = #{heavyFuel}
and thisTab.confirmed_total_income = #{confirmedTotalIncome}
and thisTab.confirmed_total_cost = #{confirmedTotalCost}
and thisTab.is_income_matched = #{isIncomeMatched}
and thisTab.is_cost_matched = #{isCostMatched}
and thisTab.be_scheduled = #{beScheduled}
and thisTab.tracking_no = #{trackingNo}
and thisTab.seal_no = #{sealNo}
and thisTab.schedule_no = #{scheduleNo}
and thisTab.transport_status = #{transportStatus}
and thisTab.estimated_bill_id = #{estimatedBillId}
and thisTab.settlement_bill_id = #{settlementBillId}
and thisTab.settlement_status = #{settlementStatus}
insert into pending_settlement_business
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,
confirmed_total_income,
confirmed_total_cost,
is_income_matched,
is_cost_matched,
#{bookingNo},
#{customerId},
#{carrierId},
#{projectName},
#{dispatchNo},
#{createdTime},
#{transportMode},
#{productId},
#{customerName},
#{operationMode},
#{carrierName},
#{departureLocation},
#{arrivalLocation},
#{vehicleId},
#{licensePlateNumber},
#{vehicleType},
#{mainDriver},
#{assistantDriver},
#{pointNum},
#{businessContact},
#{estimatedTotalIncome},
#{estimatedTotalCost},
#{estimatedProfit},
#{electronicLock},
#{reWeighingWeight},
#{quantity},
#{actualDepartureTime},
#{requiredArrivalTime},
#{actualArrivalTime},
#{beReturn},
#{dispatchQuantity},
#{dispatchWeight},
#{dispatchVolume},
#{emptyMileage},
#{emptyFuel},
#{heavyMileage},
#{heavyFuel},
#{beScheduled},
#{trackingNo},
#{sealNo},
#{scheduleNo},
#{transportStatus},
#{estimatedBillId},
#{settlementBillId},
#{settlementStatus},
#{createTime},
#{updateTime},
#{isCreate},
#{confirmedTotalIncome},
#{confirmedTotalCost},
#{isIncomeMatched},
#{isCostMatched},
insert into pending_settlement_business
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,
#{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},
update pending_settlement_business
booking_no = #{bookingNo},
customer_id = #{customerId},
carrier_id = #{carrierId},
project_name = #{projectName},
dispatch_no = #{dispatchNo},
created_time = #{createdTime},
transport_mode = #{transportMode},
product_id = #{productId},
customer_name = #{customerName},
operation_mode = #{operationMode},
carrier_name = #{carrierName},
departure_location = #{departureLocation},
arrival_location = #{arrivalLocation},
vehicle_id = #{vehicleId},
license_plate_number = #{licensePlateNumber},
vehicle_type = #{vehicleType},
main_driver = #{mainDriver},
assistant_driver = #{assistantDriver},
point_num = #{pointNum},
business_contact = #{businessContact},
estimated_total_income = #{estimatedTotalIncome},
estimated_total_cost = #{estimatedTotalCost},
estimated_profit = #{estimatedProfit},
electronic_lock = #{electronicLock},
re_weighing_weight = #{reWeighingWeight},
quantity = #{quantity},
actual_departure_time = #{actualDepartureTime},
required_arrival_time = #{requiredArrivalTime},
actual_arrival_time = #{actualArrivalTime},
be_return = #{beReturn},
dispatch_quantity = #{dispatchQuantity},
dispatch_weight = #{dispatchWeight},
dispatch_volume = #{dispatchVolume},
empty_mileage = #{emptyMileage},
empty_fuel = #{emptyFuel},
heavy_mileage = #{heavyMileage},
heavy_fuel = #{heavyFuel},
be_scheduled = #{beScheduled},
tracking_no = #{trackingNo},
seal_no = #{sealNo},
schedule_no = #{scheduleNo},
transport_status = #{transportStatus},
estimated_bill_id = #{estimatedBillId},
settlement_bill_id = #{settlementBillId},
settlement_status = #{settlementStatus},
create_time = #{createTime},
update_time = #{updateTime},
is_create = #{isCreate},
where id = #{id}
update pending_settlement_business
booking_no = #{item.bookingNo},
customer_id = #{item.customerId},
carrier_id = #{item.carrierId},
project_name = #{item.projectName},
dispatch_no = #{item.dispatchNo},
created_time = #{item.createdTime},
transport_mode = #{item.transportMode},
product_id = #{item.productId},
customer_name = #{item.customerName},
operation_mode = #{item.operationMode},
carrier_name = #{item.carrierName},
departure_location = #{item.departureLocation},
arrival_location = #{item.arrivalLocation},
vehicle_id = #{item.vehicleId},
license_plate_number = #{item.licensePlateNumber},
vehicle_type = #{item.vehicleType},
main_driver = #{item.mainDriver},
assistant_driver = #{item.assistantDriver},
point_num = #{item.pointNum},
business_contact = #{item.businessContact},
estimated_total_income = #{item.estimatedTotalIncome},
estimated_total_cost = #{item.estimatedTotalCost},
estimated_profit = #{item.estimatedProfit},
electronic_lock = #{item.electronicLock},
re_weighing_weight = #{item.reWeighingWeight},
quantity = #{item.quantity},
actual_departure_time = #{item.actualDepartureTime},
required_arrival_time = #{item.requiredArrivalTime},
actual_arrival_time = #{item.actualArrivalTime},
be_return = #{item.beReturn},
dispatch_quantity = #{item.dispatchQuantity},
dispatch_weight = #{item.dispatchWeight},
dispatch_volume = #{item.dispatchVolume},
empty_mileage = #{item.emptyMileage},
empty_fuel = #{item.emptyFuel},
heavy_mileage = #{item.heavyMileage},
heavy_fuel = #{item.heavyFuel},
be_scheduled = #{item.beScheduled},
tracking_no = #{item.trackingNo},
seal_no = #{item.sealNo},
schedule_no = #{item.scheduleNo},
transport_status = #{item.transportStatus},
estimated_bill_id = #{item.estimatedBillId},
settlement_bill_id = #{item.settlementBillId},
settlement_status = #{item.settlementStatus},
create_time = #{item.createTime},
update_time = #{item.updateTime},
is_create = #{item.isCreate},
where id = #{item.id}
update tms_shipment set IS_SYNC = 1
where ID in
#{id}
UPDATE pending_settlement_business
SET
is_create = 1,
bill_id = #{id},
bill_name = #{billName},
related_bill_status = 1
WHERE dispatch_no IN
#{item}
UPDATE pending_settlement_business p
JOIN estimated_receivable e ON p.dispatch_no = e.dispatch_no
SET
p.bill_name = #{billName},
e.related_bill_name = #{billName}
WHERE p.bill_id = #{id}
UPDATE pending_settlement_business
SET related_bill_status = #{status}
WHERE dispatch_no IN
#{item}
delete from pending_settlement_business where id = #{id}
delete from pending_settlement_business where id in
#{id}
UPDATE pending_settlement_business p
LEFT JOIN estimated_receivable e ON p.dispatch_no = e.dispatch_no
SET
p.bill_id = NULL,
p.bill_name = NULL,
p.is_create = 0,
p.related_bill_status = 0,
e.related_bill_name = NULL
WHERE p.id = #{id}