emis-service/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml

3880 lines
266 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.xdadan.erp.emis.mapper.EmisWaybillMapper">
<resultMap type="EmisWaybill" id="BaseEmisWaybillResult" >
<result property="id" column="id" />
<result property="orderSn" column="order_sn" />
<result property="custOrderId" column="cust_order_id" />
<result property="billCode" column="bill_code" />
<result property="billCodeSub" column="bill_code_sub" />
<result property="orderStatus" column="order_status" />
<result property="waybillStatus" column="waybill_status" />
<result property="startSiteCode" column="start_site_code" />
<result property="startSiteName" column="start_site_name" />
<result property="orderType" column="order_type" />
<result property="orderDate" column="order_date" />
<result property="userId" column="user_id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="openId" column="open_id" />
<result property="receiveName" column="receive_name" />
<result property="receiveCompany" column="receive_company" />
<result property="receiveMobile" column="receive_mobile" />
<result property="receiveTel" column="receive_tel" />
<result property="receiveCountry" column="receive_country" />
<result property="receiveProvince" column="receive_province" />
<result property="receiveCity" column="receive_city" />
<result property="receiveCounty" column="receive_county" />
<result property="receiveTown" column="receive_town" />
<result property="receiveAddress" column="receive_address" />
<result property="receivePostcode" column="receive_postcode" />
<result property="receivePcd" column="receive_pcd" />
<result property="sendName" column="send_name" />
<result property="sendCompany" column="send_company" />
<result property="sendMobile" column="send_mobile" />
<result property="sendTel" column="send_tel" />
<result property="sendCountry" column="send_country" />
<result property="sendProvince" column="send_province" />
<result property="sendCity" column="send_city" />
<result property="sendCounty" column="send_county" />
<result property="sendTown" column="send_town" />
<result property="sendAddress" column="send_address" />
<result property="sendPostcode" column="send_postcode" />
<result property="sendPcd" column="send_pcd" />
<result property="paymentType" column="payment_type" />
<result property="calcFeeType" column="calc_fee_type" />
<result property="custNo" column="cust_no" />
<result property="custName" column="cust_name" />
<result property="siteBatchStatus" column="site_batch_status" />
<result property="transLineType" column="trans_line_type" />
<result property="productType" column="product_type" />
<result property="timeType" column="time_type" />
<result property="meterType" column="meter_type" />
<result property="carryType" column="carry_type" />
<result property="customsClear" column="customs_clear" />
<result property="customsEclaration" column="customs_eclaration" />
<result property="estimateDate" column="estimate_date" />
<result property="packType" column="pack_type" />
<result property="dispatchMethod" column="dispatch_method" />
<result property="pickupMethod" column="pickup_method" />
<result property="pickStartDate" column="pick_start_date" />
<result property="pickFinishDate" column="pick_finish_date" />
<result property="pickFailReason" column="pick_fail_reason" />
<result property="intoWarehouseCode" column="into_warehouse_code" />
<result property="intoWarehouseName" column="into_warehouse_name" />
<result property="intoWarehouseAddress" column="into_warehouse_address" />
<result property="intoWarehouseContact" column="into_warehouse_contact" />
<result property="intoWarehousePhone" column="into_warehouse_phone" />
<result property="intoWarehouseBillCode" column="into_warehouse_bill_code" />
<result property="warehouseInNo" column="warehouse_in_no" />
<result property="customerDeliveryBeginTime" column="customer_delivery_begin_time" />
<result property="customerDeliveryEndTime" column="customer_delivery_end_time" />
<result property="goodsType" column="goods_type" />
<result property="goodsInfo" column="goods_info" />
<result property="goodsPics" column="goods_pics" />
<result property="blPrepareInFreight" column="bl_prepare_in_freight" />
<result property="prepareInEstFee" column="prepare_in_est_fee" />
<result property="prepareInRealFee" column="prepare_in_real_fee" />
<result property="prepareInExpress" column="prepare_in_express" />
<result property="prepareInBillCode" column="prepare_in_bill_code" />
<result property="prepareInRemark" column="prepare_in_remark" />
<result property="prepareInSupplier" column="prepare_in_supplier" />
<result property="totalWeight" column="total_weight" />
<result property="totalVolume" column="total_volume" />
<result property="parcelQty" column="parcel_qty" />
<result property="billWeight" column="bill_weight" />
<result property="volumeWeight" column="volume_weight" />
<result property="currency" column="currency" />
<result property="settlementWeight" column="settlement_weight" />
<result property="scanWeight" column="scan_weight" />
<result property="feeWeight" column="fee_weight" />
<result property="freight" column="freight" />
<result property="realPaymentType" column="real_payment_type" />
<result property="realFee" column="real_fee" />
<result property="blSpecialQuote" column="bl_special_quote" />
<result property="blOverLong" column="bl_over_long" />
<result property="blBill" column="bl_bill" />
<result property="blBillText" column="bl_bill_text" />
<result property="blOverWeight" column="bl_over_weight" />
<result property="overWeightNumber" column="over_weight_number" />
<result property="feeRemark" column="fee_remark" />
<result property="thirdCode" column="third_code" />
<result property="realValue" column="real_value" />
<result property="blInsure" column="bl_insure" />
<result property="insureValue" column="insure_value" />
<result property="insureValueCurrency" column="insure_value_currency" />
<result property="insureFeeCurrency" column="insure_fee_currency" />
<result property="insureFee" column="insure_fee" />
<result property="insureRemark" column="insure_remark" />
<result property="insureSiteCode" column="insure_site_code" />
<result property="insureDate" column="insure_date" />
<result property="blCod" column="bl_cod" />
<result property="codFee" column="cod_fee" />
<result property="codFeeCurrency" column="cod_fee_currency" />
<result property="codFeeDesc" column="cod_fee_desc" />
<result property="blPrint" column="bl_print" />
<result property="printManCode" column="print_man_code" />
<result property="printSite" column="print_site" />
<result property="printDate" column="print_date" />
<result property="printCount" column="print_count" />
<result property="blDispFd" column="bl_disp_fd" />
<result property="transferCode" column="transfer_code" />
<result property="transferBillcode" column="transfer_billcode" />
<result property="dispFdDate" column="disp_fd_date" />
<result property="dispFdReason" column="disp_fd_reason" />
<result property="currentSiteCode" column="current_site_code" />
<result property="nextSiteCode" column="next_site_code" />
<result property="lastSiteCode" column="last_site_code" />
<result property="registerSiteCode" column="register_site_code" />
<result property="registerDate" column="register_date" />
<result property="registerManCode" column="register_man_code" />
<result property="takePieceEmployeeCode" column="take_piece_employee_code" />
<result property="sendSiteCode" column="send_site_code" />
<result property="sendCenterCode" column="send_center_code" />
<result property="sendDate" column="send_date" />
<result property="dispatchManCode" column="dispatch_man_code" />
<result property="dispatchDate" column="dispatch_date" />
<result property="dispatchSiteCode" column="dispatch_site_code" />
<result property="produceBillDate" column="produce_bill_date" />
<result property="produceBillSiteCode" column="produce_bill_site_code" />
<result property="produceBillManCode" column="produce_bill_man_code" />
<result property="destinationCode" column="destination_code" />
<result property="destinationProvince" column="destination_province" />
<result property="destinationCity" column="destination_city" />
<result property="destinationCounty" column="destination_county" />
<result property="dispatchUnderlingSiteCode" column="dispatch_underling_site_code" />
<result property="destinationCenterCode" column="destination_center_code" />
<result property="marketManCode" column="market_man_code" />
<result property="payee" column="payee" />
<result property="salesmen" column="salesmen" />
<result property="operateEmployeeCode" column="operate_employee_code" />
<result property="blIsQuestion" column="bl_is_question" />
<result property="problemType" column="problem_type" />
<result property="problemCause" column="problem_cause" />
<result property="problemDelayDays" column="problem_delay_days" />
<result property="blMessage" column="bl_message" />
<result property="blAcceptMessage" column="bl_accept_message" />
<result property="blGenSubbill" column="bl_gen_subbill" />
<result property="blSign" column="bl_sign" />
<result property="signMan" column="sign_man" />
<result property="signManCode" column="sign_man_code" />
<result property="signSiteCode" column="sign_site_code" />
<result property="signDate" column="sign_date" />
<result property="timezoneOffset" column="timezone_offset" />
<result property="paymentStatus" column="payment_status" />
<result property="paymentDate" column="payment_date" />
<result property="paymentRemark" column="payment_remark" />
<result property="orderRemark" column="order_remark" />
<result property="dataFrom" column="data_from" />
<result property="blSpecialGoods" column="bl_special_goods" />
<result property="extInfo" column="ext_info" />
<result property="ladingBillCode" column="lading_bill_code" />
<result property="companyCode" column="company_code" />
<result property="departurePort" column="departure_port" />
<result property="destinationPort" column="destination_port" />
<result property="departurePortName" column="departure_port_name" />
<result property="destinationPortName" column="destination_port_name" />
<result property="boxQuantity" column="box_quantity" />
<!-- 扩展属性 -->
<result property="receiveCountryName" column="receive_country_name" />
<result property="receiveProvinceName" column="receive_province_name" />
<result property="receiveCityName" column="receive_city_name" />
<result property="receiveCountyName" column="receive_county_name" />
<result property="sendCountryName" column="send_country_name" />
<result property="sendProvinceName" column="send_province_name" />
<result property="sendCityName" column="send_city_name" />
<result property="sendCountyName" column="send_county_name" />
<result property="productTypeName" column="product_type_name" />
<result property="transLineTypeName" column="trans_line_type_name" />
<result property="sendSiteName" column="send_site_name" />
<result property="sendCenterName" column="send_center_name" />
<result property="destinationCenterName" column="destination_center_name" />
<result property="dispatchUnderlingSiteName" column="dispatch_underling_site_name" />
<result property="destinationName" column="destination_name" />
<result property="dispatchSiteName" column="dispatch_site_name" />
<result property="dispatchManName" column="dispatch_man_name" />
<result property="printSiteName" column="print_site_name" />
<result property="printManName" column="print_man_name" />
<result property="takePieceEmployeeName" column="take_piece_employee_name" />
<result property="operateEmployeeName" column="operate_employee_name" />
<result property="registerSiteName" column="register_site_name" />
<result property="registerManName" column="register_man_name" />
<result property="currentSiteName" column="current_site_name" />
<result property="nextSiteName" column="next_site_name" />
<result property="lastSiteName" column="last_site_name" />
<result property="problemTypeName" column="problem_type_name" />
<result property="billPicSendRmk" column="bill_pic_send_rmk" />
<result property="billPicDispatchRmk" column="bill_pic_dispatch_rmk" />
<result property="billPicGoodsRmk" column="goods_pics" />
<result property="customerPhone" column="customer_phone" />
<result property="customerNickName" column="customer_nick_name" />
<result property="customerAvatar" column="customer_avatar" />
<result property="blVirtual" column="bl_virtual" />
<result property="masterBillCode" column="master_bill_code" />
<result property="virtualRemark" column="virtual_remark" />
<result property="transType" column="trans_type" />
</resultMap>
<resultMap id="EmisWaybillResult" extends="BaseEmisWaybillResult" type="EmisWaybill">
<!-- 获取订单最后一条扫描记录 -->
<!-- <association property="lastScanRecord" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisTmsScanRecordMapper.selectLastRecordBaseInfoByBillCode"/>-->
</resultMap>
<!-- 获取运单统计条数-->
<select id="selectWaybillStatByEmpCode" parameterType="String" resultType="map">
select waybill_status as waybillStatus,count(1) as cnt from emis_waybill
<where>
del_flag='0'
<if test="empCode != null and empCode != ''">
and take_piece_employee_code=#{empCode}
</if>
<if test="waybillStatus != null and waybillStatus != ''">
and waybill_status=#{waybillStatus}
</if>
</where>
group by waybill_status
</select>
<!-- 检查主运单号是否存在 -->
<select id="checkDbWaybillIsExists" resultType="int">
select count(1) as cnt from emis_waybill
where bill_code=#{billCode}
limit 1
</select>
<!-- 检查子单号是否存在 -->
<select id="checkDbSubBillIsExists" resultType="int">
select count(1) as cnt from emis_waybill
where bill_code=#{billCode} and bl_gen_subbill='1' and #{subNum} <![CDATA[ >= ]]> 1 and #{subNum} <![CDATA[ <= ]]> parcel_qty
limit 1
</select>
<!-- 检查运单号是否签收 -->
<select id="checkWaybillIsSign" parameterType="String" resultType="int">
select count(1) as cnt from emis_waybill where bill_code=#{billCode} and bl_sign='1' limit 1
</select>
<!-- 检查运单号是否已接单 -->
<select id="checkWaybillIsGot" parameterType="String" resultType="int">
select count(1) as cnt from emis_waybill where bill_code=#{billCode} and order_status='1' limit 1
</select>
<select id="selectCommissionStatData" parameterType="String" resultType="map">
select waybill_status as waybillStatus,count(1) as cnt from emis_waybill
where take_piece_employee_code is not null
group by waybill_status
</select>
<!-- 其他基本信息 a.bill_code_sub, 列表中不要显示子单 -->
<sql id="selectEmisWaybillVo">
select
a.id,a.order_sn, a.cust_order_id, a.bill_code, a.order_status, a.waybill_status,
a.order_type, a.order_date, a.user_id, a.customer_code, a.customer_name, a.open_id, a.receive_name,
a.receive_company, a.receive_mobile, a.receive_tel, a.receive_country, a.receive_province, a.receive_city,
a.receive_county, a.receive_town, a.receive_address, a.receive_postcode, a.receive_pcd, a.send_name, a.send_company,a.start_site_code,
a.send_mobile, a.send_tel, a.send_country, a.send_province, a.send_city, a.send_county, a.send_town, a.send_address,
a.send_postcode, a.send_pcd, a.payment_type, a.calc_fee_type, a.cust_no, a.cust_name, a.trans_line_type, a.product_type,
a.time_type, a.meter_type, a.carry_type, a.customs_clear, a.customs_eclaration, a.estimate_date, a.pack_type, a.dispatch_method,
a.pickup_method, a.pick_start_date, a.pick_finish_date, a.pick_fail_reason, a.into_warehouse_code,
a.into_warehouse_name, a.into_warehouse_address, a.into_warehouse_contact, a.into_warehouse_phone,
a.into_warehouse_bill_code, a.warehouse_in_no, a.customer_delivery_begin_time, a.customer_delivery_end_time,
a.goods_type, a.goods_info, a.goods_pics, a.bl_prepare_in_freight, a.prepare_in_est_fee,
a.prepare_in_real_fee, a.prepare_in_express, a.prepare_in_bill_code, a.prepare_in_remark,
a.prepare_in_supplier, a.total_weight, a.total_volume, a.parcel_qty, a.bill_weight, a.volume_weight, a.currency,
a.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,a.bl_virtual,a.master_bill_code,a.virtual_remark,
a.bl_over_long, a.bl_bill, a.bl_bill_text, a.bl_over_weight, a.over_weight_number, a.fee_remark, a.third_code,
a.real_value, a.bl_insure, a.insure_value, a.insure_value_currency, a.insure_fee_currency, a.insure_fee, a.insure_remark,
a.insure_site_code, a.insure_date, a.bl_print, a.print_man_code, a.print_site, a.print_date, a.print_count, a.bl_disp_fd,
a.transfer_code, a.transfer_billcode, a.disp_fd_date, a.disp_fd_reason, a.current_site_code, a.next_site_code, a.last_site_code,
a.register_site_code, a.register_date, a.register_man_code, a.take_piece_employee_code, a.send_site_code, a.send_center_code,
a.send_date, a.dispatch_man_code, a.dispatch_date, a.dispatch_site_code, a.produce_bill_date, a.produce_bill_site_code,
a.produce_bill_man_code, a.destination_code, a.destination_province, a.destination_city, a.destination_county,
a.dispatch_underling_site_code, a.destination_center_code, a.market_man_code, a.payee, a.salesmen, a.operate_employee_code,
a.bl_is_question, a.problem_type, a.problem_cause, a.problem_delay_days, a.bl_message, a.bl_accept_message, a.bl_gen_subbill,
a.bl_sign, a.sign_man, a.sign_man_code, a.sign_site_code, a.sign_date, a.bill_pic_send_rmk, a.bill_pic_dispatch_rmk, a.timezone_offset,
a.payment_status, a.payment_date, a.payment_remark, a.order_remark, a.data_from, a.bl_special_goods,a.ext_info,
a.remark, a.del_flag, a.create_by,
a.create_time, a.update_by, a.update_time, a.create_site, a.update_site,
a.cod_fee_desc, a.lading_bill_code, a.company_code, a.departure_port, a.destination_port, a.box_quantity,
seaway1.site_name as departure_port_name,seaway2.site_name as destination_port_name,
b.name as receive_country_name,c.name as send_country_name,
d.region_name as receive_province_name,e.region_name as receive_city_name,f.region_name as receive_county_name,
g.region_name as send_province_name,h.region_name as send_city_name,i.region_name as send_county_name,
j.prod_name as product_type_name,k.line_name as trans_line_type_name,
l.site_name as send_site_name,m.site_name as dispatch_underling_site_name,
n.dest_name as destination_name,o.site_name as dispatch_site_name,
a1.site_name as send_center_name,
a2.site_name as destination_center_name,
a3.phone as customer_phone,
a3.nick_name as customer_nick_name,
a3.avatar as customer_avatar,
p.emp_name as dispatch_man_name,q.site_name as print_site_name,
r.emp_name as print_man_name,
s.emp_name as take_piece_employee_name,
t.emp_name as operate_employee_name,
u.site_name as register_site_name,
v.emp_name as register_man_name,
w.site_name as current_site_name,
x.site_name as next_site_name,
y.site_name as last_site_name,
start.site_name as start_site_name,
z.type_name as problem_type_name,
k.trans_type as trans_type
from emis_waybill a
left join emis_country b on a.receive_country=b.code and b.del_flag='0'
left join emis_country c on a.send_country=c.code and c.del_flag='0'
left join emis_region d on a.receive_province=d.region_code and d.del_flag='0'
left join emis_region e on a.receive_city=e.region_code and e.del_flag='0'
left join emis_region f on a.receive_county=f.region_code and f.del_flag='0'
left join emis_region g on a.send_province=g.region_code and g.del_flag='0'
left join emis_region h on a.send_city=h.region_code and h.del_flag='0'
left join emis_region i on a.send_county=i.region_code and i.del_flag='0'
left join emis_trans_product j on a.product_type=j.prod_code and j.del_flag='0'
left join emis_trans_line k on a.trans_line_type=k.line_code and k.del_flag='0'
left join emis_site l on a.send_site_code=l.site_code and l.del_flag=0 and l.del_flag='0'
left join emis_site m on a.dispatch_underling_site_code=m.site_code and m.del_flag=0
left join emis_destination n on a.destination_code=n.dest_code and n.del_flag='0'
left join emis_site o on a.dispatch_site_code=o.site_code and o.del_flag='0'
left join sys_user p on a.dispatch_man_code=p.emp_code and p.del_flag='0'
left join emis_site q on a.print_site=q.site_code and q.del_flag='0'
left join sys_user r on a.print_man_code=r.emp_code and r.del_flag='0'
left join sys_user s on a.take_piece_employee_code=s.emp_code and s.del_flag='0'
left join sys_user t on a.operate_employee_code=t.emp_code and t.del_flag='0'
left join emis_site u on a.register_site_code=u.site_code and u.del_flag='0'
left join sys_user v on a.register_man_code=v.emp_code and v.del_flag='0'
left join emis_site w on a.current_site_code=w.site_code and w.del_flag='0'
left join emis_site x on a.next_site_code=x.site_code and x.del_flag='0'
left join emis_site y on a.last_site_code=y.site_code and y.del_flag='0'
left join emis_problem_type z on a.problem_type=z.id and z.del_flag='0'
left join emis_site a1 on a.send_center_code=a1.site_code and a1.del_flag='0'
left join emis_site a2 on a.destination_center_code=a2.site_code and a2.del_flag='0'
left join emis_site start on a.start_site_code=start.site_code and start.del_flag='0'
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
</sql>
<!-- 单个对象可以返回子单数据 -->
<sql id="selectEmisWaybillDetailVo">
select
a.id,a.order_sn, a.cust_order_id, a.bill_code,a.bill_code_sub, a.order_status, a.waybill_status,a.bl_virtual,a.master_bill_code,a.virtual_remark,a.start_site_code,
a.order_type, a.order_date, a.user_id, a.customer_code, a.customer_name, a.open_id, a.receive_name,
a.receive_company, a.receive_mobile, a.receive_tel, a.receive_country, a.receive_province, a.receive_city,
a.receive_county, a.receive_town, a.receive_address, a.receive_postcode, a.receive_pcd, a.send_name, a.send_company,
a.send_mobile, a.send_tel, a.send_country, a.send_province, a.send_city, a.send_county, a.send_town, a.send_address,
a.send_postcode, a.send_pcd, a.payment_type, a.calc_fee_type, a.cust_no, a.cust_name, a.trans_line_type, a.product_type,
a.time_type, a.meter_type, a.carry_type, a.customs_clear, a.customs_eclaration, a.estimate_date, a.pack_type, a.dispatch_method,
a.pickup_method, a.pick_start_date, a.pick_finish_date, a.pick_fail_reason, a.into_warehouse_code,
a.into_warehouse_name, a.into_warehouse_address, a.into_warehouse_contact, a.into_warehouse_phone,
a.into_warehouse_bill_code, a.warehouse_in_no, a.customer_delivery_begin_time, a.customer_delivery_end_time,
a.goods_type, a.goods_info, a.goods_pics, a.bl_prepare_in_freight, a.prepare_in_est_fee,
a.prepare_in_real_fee, a.prepare_in_express, a.prepare_in_bill_code, a.prepare_in_remark,
a.prepare_in_supplier, a.total_weight, a.total_volume, a.parcel_qty, a.bill_weight, a.volume_weight, a.currency,
a.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,
a.bl_over_long, a.bl_bill, a.bl_bill_text, a.bl_over_weight, a.over_weight_number, a.fee_remark, a.third_code,
a.real_value, a.bl_insure, a.insure_value, a.insure_value_currency, a.insure_fee_currency, a.insure_fee, a.insure_remark,
a.insure_site_code, a.insure_date, a.bl_print, a.print_man_code, a.print_site, a.print_date, a.print_count, a.bl_disp_fd,
a.transfer_code, a.transfer_billcode, a.disp_fd_date, a.disp_fd_reason, a.current_site_code, a.next_site_code, a.last_site_code,
a.register_site_code, a.register_date, a.register_man_code, a.take_piece_employee_code, a.send_site_code, a.send_center_code,
a.send_date, a.dispatch_man_code, a.dispatch_date, a.dispatch_site_code, a.produce_bill_date, a.produce_bill_site_code,
a.produce_bill_man_code, a.destination_code, a.destination_province, a.destination_city, a.destination_county,
a.dispatch_underling_site_code, a.destination_center_code, a.market_man_code, a.payee, a.salesmen, a.operate_employee_code,
a.bl_is_question, a.problem_type, a.problem_cause, a.problem_delay_days, a.bl_message, a.bl_accept_message, a.bl_gen_subbill,
a.bl_sign, a.sign_man, a.sign_man_code, a.sign_site_code, a.sign_date, a.bill_pic_send_rmk, a.bill_pic_dispatch_rmk, a.timezone_offset,
a.payment_status, a.payment_date, a.payment_remark, a.order_remark, a.data_from, a.bl_special_goods,a.ext_info,
a.remark, a.del_flag, a.create_by,
a.create_time, a.update_by, a.update_time, a.create_site, a.update_site,
a.cod_fee_desc, a.lading_bill_code, a.company_code, a.departure_port, a.destination_port, a.box_quantity,
seaway1.site_name as departure_port_name,seaway2.site_name as destination_port_name,
b.name as receive_country_name,c.name as send_country_name,
d.region_name as receive_province_name,e.region_name as receive_city_name,f.region_name as receive_county_name,
g.region_name as send_province_name,h.region_name as send_city_name,i.region_name as send_county_name,
j.prod_name as product_type_name,k.line_name as trans_line_type_name,
l.site_name as send_site_name,m.site_name as dispatch_underling_site_name,
n.dest_name as destination_name,o.site_name as dispatch_site_name,
a1.site_name as send_center_name,
a2.site_name as destination_center_name,
a3.phone as customer_phone,
a3.nick_name as customer_nick_name,
a3.avatar as customer_avatar,
p.emp_name as dispatch_man_name,q.site_name as print_site_name,
r.emp_name as print_man_name,
s.emp_name as take_piece_employee_name,
t.emp_name as operate_employee_name,
u.site_name as register_site_name,
v.emp_name as register_man_name,
w.site_name as current_site_name,
x.site_name as next_site_name,
y.site_name as last_site_name,
z.type_name as problem_type_name,
start.site_name as start_site_name,
k.trans_type as trans_type
from emis_waybill a
left join emis_country b on a.receive_country=b.code and b.del_flag='0'
left join emis_country c on a.send_country=c.code and c.del_flag='0'
left join emis_region d on a.receive_province=d.region_code and d.del_flag='0'
left join emis_region e on a.receive_city=e.region_code and e.del_flag='0'
left join emis_region f on a.receive_county=f.region_code and f.del_flag='0'
left join emis_region g on a.send_province=g.region_code and g.del_flag='0'
left join emis_region h on a.send_city=h.region_code and h.del_flag='0'
left join emis_region i on a.send_county=i.region_code and i.del_flag='0'
left join emis_trans_product j on a.product_type=j.prod_code and j.del_flag='0'
left join emis_trans_line k on a.trans_line_type=k.line_code and k.del_flag='0'
left join emis_site l on a.send_site_code=l.site_code and l.del_flag=0 and l.del_flag='0'
left join emis_site m on a.dispatch_underling_site_code=m.site_code and m.del_flag=0
left join emis_destination n on a.destination_code=n.dest_code and n.del_flag='0'
left join emis_site o on a.dispatch_site_code=o.site_code and o.del_flag='0'
left join sys_user p on a.dispatch_man_code=p.emp_code and p.del_flag='0'
left join emis_site q on a.print_site=q.site_code and q.del_flag='0'
left join sys_user r on a.print_man_code=r.emp_code and r.del_flag='0'
left join sys_user s on a.take_piece_employee_code=s.emp_code and s.del_flag='0'
left join sys_user t on a.operate_employee_code=t.emp_code and t.del_flag='0'
left join emis_site u on a.register_site_code=u.site_code and u.del_flag='0'
left join sys_user v on a.register_man_code=v.emp_code and v.del_flag='0'
left join emis_site w on a.current_site_code=w.site_code and w.del_flag='0'
left join emis_site x on a.next_site_code=x.site_code and x.del_flag='0'
left join emis_site y on a.last_site_code=y.site_code and y.del_flag='0'
left join emis_problem_type z on a.problem_type=z.id and z.del_flag='0'
left join emis_site a1 on a.send_center_code=a1.site_code and a1.del_flag='0'
left join emis_site a2 on a.destination_center_code=a2.site_code and a2.del_flag='0'
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
left join emis_site start on a.start_site_code=start.site_code and start.del_flag='0'
</sql>
<!--根据运单号获取运单信息 or FIND_IN_SET(#{billCode},bill_code_sub)-->
<select id="selectEmisWaybillByBillCode" parameterType="String" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillDetailVo"/>
<where>
bill_code = #{billCode}
</where>
limit 1
</select>
<!--根据运单号获取运单信息 or FIND_IN_SET(#{billCode},bill_code_sub)-->
<select id="selectMasterWaybillByBillCode" parameterType="String" resultMap="EmisWaybillResult">
select
a.* FROM emis_waybill a
<where>
a.bill_code = #{billCode}
</where>
limit 1
</select>
<!-- 提供给扫描记录 查询使用, 简化的,不包含扫描记录-->
<select id="selectWaybillBaseInfoByBillCode" parameterType="String" resultMap="BaseEmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
bill_code = #{billCode}
</where>
limit 1
</select>
<!-- 根据订单号查询 -->
<select id="selectEmisWaybillByOrderSn" parameterType="String" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillDetailVo"/>
<where>
order_sn = #{orderSn}
</where>
</select>
<!-- 根据客户订单号查询 -->
<select id="selectEmisWaybillByCustOrderId" parameterType="String" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillDetailVo"/>
<where>
cust_order_id = #{custOrderId}
</where>
</select>
<!-- 多个运单查询-->
<select id="selectEmisWaybillByMutiBillCode" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
where a.del_flag='0'
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and a.`bill_code`=#{billCode}
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.orderSnSortList != null and params.orderSnSortList.size >0 ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null">
ORDER BY a.send_date desc
</if>
</select>
<select id="selectMasterEmisWaybills" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
where a.del_flag = '0'
-- and a.send_date >= date_sub(curdate(), interval 3 day)
<if test="transLineType != null and transLineType != ''">
and a.trans_line_type = #{transLineType}
</if>
<if test="productType != null and productType != ''">
and a.product_type=#{productType}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
and a.send_site_code=#{sendSiteCode}
</if>
and (a.bl_virtual is null or a.bl_virtual != '1')
<if test="billCode != null and billCode != ''">
and a.bill_code like concat('%', #{billCode}, '%')
</if>
and a.order_status != '0'
and a.order_status != '2'
<!-- <if test="params.privSiteCode != null and params.privSiteCode != '88888'">-->
<!-- and (-->
<!-- a.send_site_code=#{params.privSiteCode}-->
<!-- or a.dispatch_underling_site_code=#{params.privSiteCode}-->
<!-- )-->
<!-- </if>-->
order by a.send_date desc
limit 10
</select>
<select id="selectWaitGotOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0' and a.order_type='0' and a.waybill_status='0' and a.order_status in('0','3')
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''">
and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') )
</if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and order_type=#{orderType}</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and payment_type=#{paymentType}</if>
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type like concat('%', #{meterType}, '%')</if>
<if test="carryType != null and carryType != ''"> and carry_type like concat('%', #{carryType}, '%')</if>
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
<if test="freight != null "> and freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and payment_status =#{paymentStatus}</if>
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
and a.send_site_code=#{sendSiteCode}
</if>
<if test="blSign != null and blSign !=''">
and a.bl_sign=#{blSign}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
)
</if>
</where>
<if test="params.orderSnSortList != null and params.orderSnSortList.size >0 ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 0 ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null ">
ORDER BY a.send_date desc
</if>
</select>
<select id="selectOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0' and a.order_type='0'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(a.`order_sn`,#{orderSn}) or a.order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="orderType != null and orderType != ''"> and a.order_type=#{orderType}</if>
<if test="custOrderId != null and custOrderId != ''"> and a.cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and a.bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and a.order_status=#{orderStatus}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and a.waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and a.order_type=#{orderType}</if>
<if test="orderDate != null "> and a.order_date = #{orderDate}</if>
<if test="userId != null "> and a.user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and a.customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and a.customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and a.open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and a.receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and a.receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and a.receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and a.receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and a.receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and a.receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and a.receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and a.receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and a.receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and a.receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and a.receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and a.receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and a.send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and a.send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and a.send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and a.send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and a.send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and a.send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and a.send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and a.send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and a.send_town=#{sendTown}</if>
<if test="sendAddress != null and sendAddress != ''"> and a.send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and a.send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and a.payment_type=#{paymentType}</if>
<if test="calcFeeType != null and calcFeeType != ''"> and a.calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and a.cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and a.trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and a.product_type=#{productType}</if>
<if test="timeType != null and timeType != ''"> and a.time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and a.meter_type like concat('%', #{meterType}, '%')</if>
<if test="carryType != null and carryType != ''"> and a.carry_type like concat('%', #{carryType}, '%')</if>
<if test="customsClear != null and customsClear != ''"> and a.customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and a.customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and a.estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},a.pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and a.dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and a.pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and a.pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and a.pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and a.pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and a.into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and a.into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and a.into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and a.into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and a.into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and a.into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and a.warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and a.customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and a.customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and a.goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and a.bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and a.prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and a.prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and a.prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and a.prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and a.prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and a.prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and a.total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and a.total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and a.parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and a.bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and a.volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and a.currency= #{currency}</if>
<if test="settlementWeight != null "> and a.settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and a.scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and a.fee_weight = #{feeWeight}</if>
<if test="freight != null "> and a.freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and a.real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and a.real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and a.bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and a.bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and a.bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and a.bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and a.bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and a.over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and a.fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and a.third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and a.real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and a.bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and a.insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and a.insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and a.insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and a.insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and a.insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and a.insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and a.bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and a.print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and a.print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and a.print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and a.bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and a.transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and a.transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and a.disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and a.disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and a.current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and a.next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and a.last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and a.register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and a.register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and a.register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and a.take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="sendDate != null "> and a.send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and a.dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and a.dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and a.produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and a.produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and a.produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and a.destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and a.destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and a.destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and a.destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and a.dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and a.destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and a.market_man_code = #{marketManCode}</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and a.operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and a.bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and a.problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and a.problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and a.problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and a.bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and a.bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and a.bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and a.sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and a.sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and a.sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status =#{paymentStatus}</if>
<if test="paymentDate != null "> and a.payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and a.payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and a.order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="dataFrom != null and dataFrom != ''">and a.data_from = #{dataFrom} </if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
and exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
and not exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 1">
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 2">
and a.waybill_status!='0' and a.order_status!='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 3">
and a.order_status='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
<!-- 转单 -->
<if test="params.waybillStatType != null and params.waybillStatType == 4">
and a.order_status in('0','3') and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
and a.send_site_code=#{sendSiteCode}
</if>
<if test="blSign != null and blSign != ''">
and a.bl_sign=#{blSign}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="salesmen == null and params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode}
)
</if>
</where>
<if test="params.orderSnSortList != null and params.orderSnSortList.size >0 ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 0 ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null ">
ORDER BY a.send_date desc
</if>
</select>
<select id="selectEmisWaybillList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and order_type=#{orderType}</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
<if test="blVirtual ==1"> and bl_virtual=#{blVirtual}</if>
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type=#{meterType}</if>
<if test="carryType != null and carryType != ''">and FIND_IN_SET(a.carry_type,#{carryType})</if>
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
<if test="freight != null "> and freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
<if test="payee != null and payee != ''"> and a.payee=#{payee}</if>
<if test="salesmen != null and salesmen != ''"> and a.salesmen like concat('%', #{salesmen}, '%')</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and FIND_IN_SET(payment_status,#{paymentStatus})</if>
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''">and (a.send_site_code=#{sendSiteCode} or a.start_site_code=#{sendSiteCode})
</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
and exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
and not exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 1">
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 2">
and a.waybill_status!='0' and a.order_status!='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 3">
and a.order_status='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
<!-- 转单 -->
<if test="params.waybillStatType != null and params.waybillStatType == 4">
and a.order_status in('0','3') and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="blSign != null and blSign != ''">
and a.bl_sign=#{blSign}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 1">
and a.goods_pics is not null
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 0">
and a.goods_pics is null
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.expireNotSign != null and params.expireNotSign == 1">
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
</if>
<if test="params.printFlag != null ">
and a.bl_print=#{params.printFlag}
</if>
<if test="params.isNeedPack != null and params.isNeedPack == 1">
and not EXISTS ( select 1 from emis_tms_pack_dtl etp where etp.del_flag='0' and etp.main_bill_code=a.bill_code )
and a.trans_line_type in(
select line_code from emis_trans_line etl where etl.trans_type=1
)
and bl_sign!='1' and waybill_status!='40'
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and a.current_site_code=#{params.privSiteCode}
</if>
<if test="params.isNeedBatch != null and params.isNeedBatch == 1">
and a.bill_code = #{billCode}
<!--
and a.bill_code not in(
select etsbd.bill_code from emis_tms_site_batch_dtl etsbd,emis_tms_site_batch etsb
where etsbd.batch_no=etsb.batch_no and etsbd.del_flag='0' and etsb.del_flag='0' and etsb.batch_type=#{params.batchType}
)
-->
</if>
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) > 10
</if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if>
<if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " >
<if test="(salesmen == null or salesmen=='') and params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.dispatch_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
</if>
<if test="custNo != null and custNo != ''">
or EXISTS (
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
)
</if>
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</if>
</where>
<if test="params.orderSnSortList != null ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null ">
ORDER BY a.send_date desc
</if>
</select>
<select id="selectLatestMonthCreateOrderMapList" parameterType="EmisWaybill" resultType="map">
SELECT
DATE_FORMAT( create_time, '%Y-%m-%d' ) AS createDay,
count( 1 ) AS totalNum
FROM
emis_waybill a
WHERE
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
and create_time <![CDATA[ >= ]]> DATE_SUB( CURDATE(), INTERVAL 1 MONTH )
and a.bill_code not in (
select bill_code from emis_waybill_problem_info ewpi where ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, '173,170,151' )
)
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or
a.dispatch_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
</if>
<if test="custNo != null and custNo != ''">
or EXISTS (
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
)
</if>
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
GROUP BY
createDay
</select>
<select id="selectEmisWaybillListByExternal" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and order_type=#{orderType}</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type=#{meterType}</if>
<if test="carryType != null and carryType != ''">and FIND_IN_SET(a.carry_type,#{carryType})</if>
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
<if test="freight != null "> and freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
<if test="payee != null and payee != ''"> and a.payee=#{payee}</if>
<if test="salesmen != null and salesmen != ''"> and a.salesmen like concat('%', #{salesmen}, '%')</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and FIND_IN_SET(payment_status,#{paymentStatus})</if>
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and FIND_IN_SET(`send_site_code`,#{sendSiteCode})</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
and exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
and not exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 1">
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 2">
and a.waybill_status!='0' and a.order_status!='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 3">
and a.order_status='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
<!-- 转单 -->
<if test="params.waybillStatType != null and params.waybillStatType == 4">
and a.order_status in('0','3') and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="blSign != null and blSign != ''">
and a.bl_sign=#{blSign}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 1">
and a.goods_pics is not null
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 0">
and a.goods_pics is null
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.expireNotSign != null and params.expireNotSign == 1">
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
</if>
<if test="params.printFlag != null ">
and a.bl_print=#{params.printFlag}
</if>
<if test="params.isNeedPack != null and params.isNeedPack == 1">
and not EXISTS ( select 1 from emis_tms_pack_dtl etp where etp.del_flag='0' and etp.main_bill_code=a.bill_code )
and a.trans_line_type in(
select line_code from emis_trans_line etl where etl.trans_type=1
)
and bl_sign!='1' and waybill_status!='40'
and a.send_site_code=#{params.privSiteCode} and a.current_site_code=#{params.privSiteCode}
</if>
<if test="params.isNeedBatch != null and params.isNeedBatch == 1">
and a.bill_code = #{billCode}
<!--
and a.bill_code not in(
select etsbd.bill_code from emis_tms_site_batch_dtl etsbd,emis_tms_site_batch etsb
where etsbd.batch_no=etsb.batch_no and etsbd.del_flag='0' and etsb.del_flag='0' and etsb.batch_type=#{params.batchType}
)
-->
</if>
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) > 10
</if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if>
<if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " >
<if test="(salesmen == null or salesmen=='') and params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
or a.dispatch_site_code=#{params.privSiteCode}
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
</if>
<if test="custNo != null and custNo != ''">
or EXISTS (
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
)
</if>
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</if>
</where>
<if test="params.orderSnSortList != null ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null ">
ORDER BY a.send_date desc
</if>
</select>
<!-- 寄件网点寄件统计-->
<select id="getSiteSendStatInfoMap" parameterType="EmisWaybill" resultType="map">
select
date_format(a.send_date,'%Y-%m-%d') as sendDate,
a.send_site_code as sendSiteCode,
a.send_center_code as sendCenterCode,
b.site_name as sendSiteName,
c.site_name as sendCenterName,
count(1) as totalNum,
sum(a.parcel_qty) as totalParcelQty,
round(sum(a.bill_weight),2) as totalBillWeight,
round(sum(a.total_volume),5) as totalVolume,
round(sum(a.volume_weight),2) as totalVolumeWeight,
round(sum(a.settlement_weight),2) as totalSettlementWeight,
round(sum(a.freight),2) as totalFreight
from emis_waybill a
left join emis_site b on a.send_site_code = b.site_code and b.del_flag='0'
left join emis_site c on a.send_center_code = c.site_code and c.del_flag='0'
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="sendCenterCode != null and sendCenterCode != ''"> and a.send_center_code= #{sendCenterCode}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">
and a.dispatch_underling_site_code= #{dispatchUnderlingSiteCode}
</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">
and a.destination_center_code= #{destinationCenterCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
or
a.dispatch_underling_site_code=#{params.privSiteCode}
)
</if>
</where>
group by sendSiteCode,sendDate
order by sendDate desc
</select>
<!-- 目的网点运单统计-->
<select id="getSiteDestStatInfoMap" parameterType="EmisWaybill" resultType="map">
select
date_format(send_date,'%Y-%m-%d') as sendDate,
dispatch_underling_site_code as dispatchUnderlingSiteCode,
destination_center_code as destinationCenterCode,
b.site_name as dispatchUnderlingSiteName,
c.site_name as destinationCenterName,
count(1) as totalNum,
sum(a.parcel_qty) as totalParcelQty,
round(sum(bill_weight),2) as totalBillWeight,
round(sum(total_volume),5) as totalVolume,
round(sum(volume_weight),2) as totalVolumeWeight,
round(sum(settlement_weight),2) as totalSettlementWeight,
round(sum(freight),2) as totalFreight
from emis_waybill a
left join emis_site b on a.dispatch_underling_site_code = b.site_code and b.del_flag='0'
left join emis_site c on a.destination_center_code = c.site_code and c.del_flag='0'
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="sendCenterCode != null and sendCenterCode != ''"> and a.send_center_code= #{sendCenterCode}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">
and a.dispatch_underling_site_code= #{dispatchUnderlingSiteCode}
</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">
and a.destination_center_code= #{destinationCenterCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
or a.dispatch_underling_site_code=#{params.privSiteCode}
)
</if>
</where>
group by dispatchUnderlingSiteCode,sendDate
order by sendDate desc
</select>
<select id="getQueryStatInfoMap" parameterType="EmisWaybill" resultType="map">
select
count(1) as totalNum,
ifnull(sum(a.parcel_qty),0) as totalParcelQty,
ifnull(round(sum(bill_weight),2),0) as totalBillWeight,
ifnull(round(sum(total_volume),5),0) as totalVolume,
ifnull(round(sum(volume_weight),2),0) as totalVolumeWeight,
ifnull(round(sum(settlement_weight),2),0) as totalSettlementWeight,
ifnull(round(sum(freight),2),0) as totalFreight
from emis_waybill a
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
<if test="blVirtual ==1"> and bl_virtual=#{blVirtual}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and order_type like concat('%', #{orderType}, '%')</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type like concat('%', #{meterType}, '%')</if>
<if test="carryType != null and carryType != ''"> and FIND_IN_SET(a.carry_type,#{carryType}) </if>
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
<if test="freight != null "> and freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
<if test="payee != null and payee != ''"> and payee=#{payee}</if>
<if test="salesmen != null and salesmen != ''"> and salesmen like concat('%', #{salesmen}, '%')</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and FIND_IN_SET(payment_status,#{paymentStatus})</if>
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and FIND_IN_SET(a.`send_site_code`,#{sendSiteCode})</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
and exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
and not exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) > 10
</if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 1">
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 2">
and a.waybill_status!='0' and a.order_status!='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 3">
and a.order_status='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
<!-- 转单 -->
<if test="params.waybillStatType != null and params.waybillStatType == 4">
and a.order_status in('0','3') and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="blSign != null and blSign != ''">
and a.bl_sign=#{blSign}
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 1">
and a.goods_pics is not null
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 0">
and a.goods_pics is null
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.expireNotSign != null and params.expireNotSign == 1">
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
</if>
<if test="params.printFlag != null ">
and a.bl_print=#{params.printFlag}
</if>
<if test="params.isNeedPack != null and params.isNeedPack == 1">
and not EXISTS ( select 1 from emis_tms_pack_dtl etp where etp.del_flag='0' and etp.main_bill_code=a.bill_code )
and a.trans_line_type in(
select line_code from emis_trans_line etl where etl.trans_type=1
)
and bl_sign!='1' and waybill_status!='40'
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and a.current_site_code=#{params.privSiteCode}
</if>
<if test="params.isNeedBatch != null and params.isNeedBatch == 1">
<!--
and a.bill_code not in( select etb.bill_code from emis_tms_site_batch_dtl etb where etb.del_flag='0' )
and bl_sign!='1' and waybill_status!='40'
-->
and a.bill_code=#{billCode}
</if>
<if test="salesmen == null and params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
or
a.dispatch_site_code=#{params.privSiteCode}
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
</if>
<if test="custNo != null and custNo != ''">
or EXISTS (
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
)
</if>
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</where>
</select>
<select id="getMyBizStatInfo" parameterType="EmisWaybill" resultType="map">
select
count(1) as totalNum,
sum(a.parcel_qty) as totalParcelQty,
round(sum(bill_weight),2) as totalBillWeight,
round(sum(total_volume),4) as totalVolume
from emis_waybill a
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
<!--
<if test="params.queryDateType != null and params.queryDateType == 1 ">
and to_days(a.send_date) = to_days(now())
</if>
<if test="params.queryDateType != null and params.queryDateType == 2 ">
and DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> a.send_date
</if>
<if test="params.queryDateType != null and params.queryDateType == 3 ">
and QUARTER(a.send_date)=QUARTER(now()) and YEAR(a.send_date)=YEAR(NOW())
</if>
<if test="params.queryDateType != null and params.queryDateType == 4 ">
and YEAR(a.send_date)=YEAR(NOW())
</if>
-->
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.salesmen=#{params.privEmpName} or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</where>
</select>
<select id="getMyBizStatListByCountry" parameterType="EmisWaybill" resultType="map">
<!--
'柬埔寨','越南','缅甸','孟加拉','老挝','中国'
0086 中国
0880 孟加拉
0855 柬埔寨
0095 缅甸
0856 老挝
0084 越南
-->
select
b.CODE AS countryCode,
b.NAME AS countryName,
(
CASE
WHEN b.CODE = '0855' THEN 1
WHEN b.CODE = '0084' THEN 2
WHEN b.CODE = '0095' THEN 3
WHEN b.CODE = '0880' THEN 4
WHEN b.CODE = '0856' THEN 5
ELSE 99
END
) as orderNum,
sum(if(c.trans_type=1,1,0) ) as kdTotalNum,
round(sum(if(c.trans_type=1,a.bill_weight,0) ),2) as kdTotalBillWeight,
sum(if(c.trans_type=2,1,0) ) as kyTotalNum,
round(sum(if(c.trans_type=2,a.bill_weight,0) ),2) as kyTotalBillWeight,
sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ),1,0) ) as wlTotalNum,
round(sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ) ,a.bill_weight,0) ),2) as
wlTotalBillWeight,
count( 1 ) AS totalNum,
round( sum( a.bill_weight ), 2 ) AS totalBillWeight
from emis_waybill a, emis_country b,emis_trans_line c
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
and b.del_flag='0' and c.del_flag='0'
and a.receive_country=b.code and a.trans_line_type=c.line_code
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.salesmen=#{params.privEmpName} or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</where>
group by b.code
</select>
<select id="selectPrintWaybillList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and a.dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="custNo != null and custNo != ''"> and a.cust_no=#{custNo}</if>
<if test="transLineType != null and transLineType != ''"> and a.trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and a.product_type=#{productType}</if>
<if test="sendCompany != null and sendCompany != ''"> and a.send_company like concat('%', #{sendCompany}, '%')</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and a.take_piece_employee_code=#{takePieceEmployeeCode}</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and a.operate_employee_code=#{operateEmployeeCode}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
or
a.dispatch_site_code=#{params.privSiteCode}
or
a.sign_site_code=#{params.privSiteCode}
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
or a.salesmen=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.payee=#{params.privEmpName}
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</where>
<if test="params.orderSnSortList != null ">
ORDER BY FIELD
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList != null ">
ORDER BY FIELD
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.billCodeSortList == null ">
ORDER BY a.send_date desc
</if>
</select>
<!--
bug: 1197 APP - 订单管理 - 未接单/已收件/已取消/已转单 数据优化
(1)未接单:展示 取件员=当前登录帐号和本网点 取货方式是仓库收货 未揽收的数据;
(2)已收件:展示 取件员或者录单员或者操作员=当前登录帐号 - 默认显示当月已收件的数据;
(3)已取消:展示 客户下单有绑定到登录帐号的单子- 默认显示当月已取消的数据;
(4)已转单:展示当前登录帐号操作转单的记录 - 默认显示当月已转单的数据;
-->
<select id="getWaybillStatMap" parameterType="EmisWaybill" resultType="Map">
select tba.waitGotCount,tbb.hasDoCount,tbc.hasCancelCount,tbd.hasChangeToCount,tbe.hasDispatchCount,tbf.hasSignCount from (
select count(1) as waitGotCount
from emis_waybill a
where a.del_flag='0'
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
(a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode})
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tba,
(
select count(1) as hasDoCount
from emis_waybill a
where a.del_flag='0'
and a.waybill_status!='0'
and a.order_status!='2'
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode})
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tbb,
(
select count(1) as hasCancelCount
from emis_waybill a
where a.del_flag='0'
and a.order_status='2'
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (a.send_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode})
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tbc,
(
select count(1) as hasChangeToCount
from emis_waybill a
where a.del_flag='0'
and a.order_status in('0','3')
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tbd,
(
select count(1) as hasDispatchCount
from emis_waybill a
where a.del_flag='0'
and a.waybill_status='40'
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tbe,
(
select count(1) as hasSignCount
from emis_waybill a
where a.del_flag='0'
and a.bl_sign='1'
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
) tbf
</select>
<select id="selectEmisWaybillById" parameterType="Long" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
where a.id = #{id}
</select>
<!-- 查询待出账运单 -->
<select id="selectWaitDoBillList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
select bill_code from emis_waybill a
where
a.del_flag='0' and a.bl_bill = '0' and a.order_status !='0'
and a.order_status!='2' and waybill_status != '0'
and ( a.problem_type is null or (a.problem_type is not null and (a.problem_type != 173 and a.problem_type != 170 and a.problem_type != 151) ) )
limit 300
</select>
<!-- 查询待提成运单 -->
<select id="selectWaitDoProfitList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
SELECT
bill_code
FROM
emis_waybill a
WHERE
a.del_flag = '0'
AND a.order_status != '0'
AND a.order_status != '2'
<if test="params.noNeedBlProfit == null">
AND a.bl_profit = '0'
</if>
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
<if test="params.billMonth != null and params.billMonth != ''">
and DATE_FORMAT(a.send_date,'%Y%m')= #{params.billMonth}
</if>
ORDER BY a.send_date DESC
</select>
<!-- 查询待计算成本运单 -->
<select id="selectWaitDoCostList" parameterType="EmisWaybill" resultType="EmisWaybill">
SELECT
id,
bill_code as billCode
FROM
emis_waybill a
WHERE
a.del_flag = '0'
AND a.order_status != '0'
AND a.order_status != '2'
AND a.bl_calc_cost = '0'
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(151)
)
<if test="params.billMonth != null and params.billMonth != ''">
and DATE_FORMAT(a.send_date,'%Y%m')= #{params.billMonth}
</if>
ORDER BY a.send_date DESC
</select>
<insert id="insertEmisWaybill" parameterType="EmisWaybill" useGeneratedKeys="true" keyProperty="id">
insert into emis_waybill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderSn != null and orderSn != ''">order_sn,</if>
<if test="custOrderId != null and custOrderId != ''">cust_order_id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub,</if>
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
<if test="waybillStatus != null and waybillStatus != ''">waybill_status,</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code,</if>
<if test="orderType != null and orderType != ''">order_type,</if>
<if test="orderDate != null">order_date,</if>
<if test="userId != null">user_id,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="openId != null and openId != ''">open_id,</if>
<if test="receiveName != null and receiveName != ''">receive_name,</if>
<if test="receiveCompany != null and receiveCompany != ''">receive_company,</if>
<if test="receiveMobile != null and receiveMobile != ''">receive_mobile,</if>
<if test="receiveTel != null and receiveTel != ''">receive_tel,</if>
<if test="receiveCountry != null and receiveCountry != ''">receive_country,</if>
<if test="receiveProvince != null and receiveProvince != ''">receive_province,</if>
<if test="receiveCity != null and receiveCity != ''">receive_city,</if>
<if test="receiveCounty != null and receiveCounty != ''">receive_county,</if>
<if test="receiveTown != null and receiveTown != ''">receive_town,</if>
<if test="receiveAddress != null and receiveAddress != ''">receive_address,</if>
<if test="receivePostcode != null and receivePostcode != ''">receive_postcode,</if>
<if test="receivePcd != null and receivePcd != ''">receive_pcd,</if>
<if test="sendName != null and sendName != ''">send_name,</if>
<if test="sendCompany != null and sendCompany != ''">send_company,</if>
<if test="sendMobile != null and sendMobile != ''">send_mobile,</if>
<if test="sendTel != null and sendTel != ''">send_tel,</if>
<if test="sendCountry != null and sendCountry != ''">send_country,</if>
<if test="sendProvince != null and sendProvince != ''">send_province,</if>
<if test="sendCity != null and sendCity != ''">send_city,</if>
<if test="sendCounty != null and sendCounty != ''">send_county,</if>
<if test="sendTown != null and sendTown != ''">send_town,</if>
<if test="sendAddress != null and sendAddress != ''">send_address,</if>
<if test="sendPostcode != null and sendPostcode != ''">send_postcode,</if>
<if test="sendPcd != null and sendPcd != ''">send_pcd,</if>
<if test="paymentType != null and paymentType != ''">payment_type,</if>
<if test="calcFeeType != null and calcFeeType != ''">calc_fee_type,</if>
<if test="custNo != null and custNo != ''">cust_no,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="transLineType != null and transLineType != ''">trans_line_type,</if>
<if test="productType != null and productType != ''">product_type,</if>
<if test="timeType != null and timeType != ''">time_type,</if>
<if test="meterType != null and meterType != ''">meter_type,</if>
<if test="carryType != null and carryType != ''">carry_type,</if>
<if test="customsClear != null and customsClear != ''">customs_clear,</if>
<if test="customsEclaration != null and customsEclaration != ''">customs_eclaration,</if>
<if test="estimateDate != null">estimate_date,</if>
<if test="packType != null and packType != ''">pack_type,</if>
<if test="dispatchMethod != null and dispatchMethod != ''">dispatch_method,</if>
<if test="pickupMethod != null and pickupMethod != ''">pickup_method,</if>
<if test="pickStartDate != null">pick_start_date,</if>
<if test="pickFinishDate != null">pick_finish_date,</if>
<if test="pickFailReason != null and pickFailReason != ''">pick_fail_reason,</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''">into_warehouse_code,</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''">into_warehouse_name,</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''">into_warehouse_address,</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''">into_warehouse_contact,</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''">into_warehouse_phone,</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''">into_warehouse_bill_code,</if>
<if test="warehouseInNo != null and warehouseInNo != ''">warehouse_in_no,</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''">customer_delivery_begin_time,</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''">customer_delivery_end_time,</if>
<if test="goodsType != null and goodsType != ''">goods_type,</if>
<if test="goodsInfo != null and goodsInfo != ''">goods_info,</if>
<if test="goodsPics != null and goodsPics != ''">goods_pics,</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''">bl_prepare_in_freight,</if>
<if test="prepareInEstFee != null">prepare_in_est_fee,</if>
<if test="prepareInRealFee != null">prepare_in_real_fee,</if>
<if test="prepareInExpress != null and prepareInExpress != ''">prepare_in_express,</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''">prepare_in_bill_code,</if>
<if test="prepareInRemark != null and prepareInRemark != ''">prepare_in_remark,</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''">prepare_in_supplier,</if>
<if test="totalWeight != null">total_weight,</if>
<if test="totalVolume != null">total_volume,</if>
<if test="parcelQty != null">parcel_qty,</if>
<if test="billWeight != null">bill_weight,</if>
<if test="volumeWeight != null">volume_weight,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="settlementWeight != null">settlement_weight,</if>
<if test="scanWeight != null">scan_weight,</if>
<if test="feeWeight != null">fee_weight,</if>
<if test="freight != null">freight,</if>
<if test="realPaymentType != null and realPaymentType != ''">real_payment_type,</if>
<if test="realFee != null">real_fee,</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''">bl_special_quote,</if>
<if test="blSensitive != null and blSensitive != ''">bl_sensitive,</if>
<if test="blOverLong != null and blOverLong != ''">bl_over_long,</if>
<if test="blVirtual != null and blVirtual != ''">bl_virtual,</if>
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code,</if>
<if test="blBill != null and blBill != ''">bl_bill,</if>
<if test="blBillText != null and blBillText != ''">bl_bill_text,</if>
<if test="blProfit != null and blProfit != ''">bl_profit,</if>
<if test="blOverWeight != null and blOverWeight != ''">bl_over_weight,</if>
<if test="overWeightNumber != null and overWeightNumber != ''">over_weight_number,</if>
<if test="feeRemark != null and feeRemark != ''">fee_remark,</if>
<if test="thirdCode != null and thirdCode != ''">third_code,</if>
<if test="realValue != null and realValue != ''">real_value,</if>
<if test="blInsure != null and blInsure != ''">bl_insure,</if>
<if test="insureValue != null and insureValue != ''">insure_value,</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''">insure_value_currency,</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''">insure_fee_currency,</if>
<if test="insureFee != null">insure_fee,</if>
<if test="insureRemark != null and insureRemark != ''">insure_remark,</if>
<if test="insureSiteCode != null and insureSiteCode != ''">insure_site_code,</if>
<if test="insureDate != null and insureDate != ''">insure_date,</if>
<if test="blCod != null and blCod != ''">bl_cod,</if>
<if test="codFee != null">cod_fee,</if>
<if test="codFeeCurrency != null and codFeeCurrency != ''">cod_fee_currency,</if>
<if test="codFeeDesc != null and codFeeDesc != ''">cod_fee_desc,</if>
<if test="blPrint != null and blPrint != ''">bl_print,</if>
<if test="printManCode != null and printManCode != ''">print_man_code,</if>
<if test="printSite != null and printSite != ''">print_site,</if>
<if test="printDate != null and printDate != ''">print_date,</if>
<if test="printCount != null">print_count,</if>
<if test="blDispFd != null and blDispFd != ''">bl_disp_fd,</if>
<if test="transferCode != null and transferCode != ''">transfer_code,</if>
<if test="transferBillcode != null and transferBillcode != ''">transfer_billcode,</if>
<if test="dispFdDate != null">disp_fd_date,</if>
<if test="dispFdReason != null and dispFdReason != ''">disp_fd_reason,</if>
<if test="currentSiteCode != null and currentSiteCode != ''">current_site_code,</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
<if test="lastSiteCode != null and lastSiteCode != ''">last_site_code,</if>
<if test="registerSiteCode != null and registerSiteCode != ''">register_site_code,</if>
<if test="registerDate != null">register_date,</if>
<if test="registerManCode != null and registerManCode != ''">register_man_code,</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''">take_piece_employee_code,</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code,</if>
<if test="sendCenterCode != null and sendCenterCode != ''">send_center_code,</if>
<if test="sendDate != null">send_date,</if>
<if test="dispatchManCode != null and dispatchManCode != ''">dispatch_man_code,</if>
<if test="dispatchDate != null">dispatch_date,</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''">dispatch_site_code,</if>
<if test="produceBillDate != null">produce_bill_date,</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''">produce_bill_site_code,</if>
<if test="produceBillManCode != null and produceBillManCode != ''">produce_bill_man_code,</if>
<if test="destinationCode != null and destinationCode != ''">destination_code,</if>
<if test="destinationProvince != null and destinationProvince != ''">destination_province,</if>
<if test="destinationCity != null and destinationCity != ''">destination_city,</if>
<if test="destinationCounty != null and destinationCounty != ''">destination_county,</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">dispatch_underling_site_code,</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">destination_center_code,</if>
<if test="marketManCode != null and marketManCode != ''">market_man_code,</if>
<if test="payee != null and payee != ''">payee,</if>
<if test="salesmen != null and salesmen != ''">salesmen,</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''">operate_employee_code,</if>
<if test="blIsQuestion != null and blIsQuestion != ''">bl_is_question,</if>
<if test="problemType != null">problem_type,</if>
<if test="problemCause != null and problemCause != ''">problem_cause,</if>
<if test="problemDelayDays != null">problem_delay_days,</if>
<if test="blMessage != null and blMessage != ''">bl_message,</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''">bl_accept_message,</if>
<if test="blGenSubbill != null and blGenSubbill != ''">bl_gen_subbill,</if>
<if test="blSign != null and blSign != ''">bl_sign,</if>
<if test="signMan != null and signMan != ''">sign_man,</if>
<if test="signManCode != null and signManCode != ''">sign_man_code,</if>
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code,</if>
<if test="signDate != null">sign_date,</if>
<if test="billPicSendRmk != null and billPicSendRmk != ''">bill_pic_send_rmk,</if>
<if test="billPicDispatchRmk != null and billPicDispatchRmk != ''">bill_pic_dispatch_rmk,</if>
<if test="timezoneOffset != null and timezoneOffset != ''">timezone_offset,</if>
<if test="paymentStatus != null and paymentStatus != ''">payment_status,</if>
<if test="paymentDate != null">payment_date,</if>
<if test="paymentRemark != null and paymentRemark != ''">payment_remark,</if>
<if test="orderRemark != null and orderRemark != ''">order_remark,</if>
<if test="cancelCause != null and cancelCause != ''">cancel_cause,</if>
<if test="dataFrom != null and dataFrom != ''">data_from,</if>
<if test="blSpecialGoods != null and blSpecialGoods != ''">bl_special_goods,</if>
<if test="extInfo != null and extInfo != ''">ext_info,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
<if test="ladingBillCode != null and ladingBillCode != ''">lading_bill_code ,</if>
<if test="companyCode != null and companyCode != ''">company_code ,</if>
<if test="departurePort != null and departurePort != ''">departure_port ,</if>
<if test="destinationPort != null and destinationPort != ''">destination_port ,</if>
<if test="boxQuantity != null and boxQuantity != ''">box_quantity ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderSn != null and orderSn != ''">#{orderSn},</if>
<if test="custOrderId != null and custOrderId != ''">#{custOrderId},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="billCodeSub != null and billCodeSub != ''">#{billCodeSub},</if>
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
<if test="waybillStatus != null and waybillStatus != ''">#{waybillStatus},</if>
<if test="startSiteCode != null and startSiteCode != ''">#{startSiteCode},</if>
<if test="orderType != null and orderType != ''">#{orderType},</if>
<if test="orderDate != null">#{orderDate},</if>
<if test="userId != null">#{userId},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="customerName != null and customerName != ''">#{customerName},</if>
<if test="openId != null and openId != ''">#{openId},</if>
<if test="receiveName != null and receiveName != ''">#{receiveName},</if>
<if test="receiveCompany != null and receiveCompany != ''">#{receiveCompany},</if>
<if test="receiveMobile != null and receiveMobile != ''">#{receiveMobile},</if>
<if test="receiveTel != null and receiveTel != ''">#{receiveTel},</if>
<if test="receiveCountry != null and receiveCountry != ''">#{receiveCountry},</if>
<if test="receiveProvince != null and receiveProvince != ''">#{receiveProvince},</if>
<if test="receiveCity != null and receiveCity != ''">#{receiveCity},</if>
<if test="receiveCounty != null and receiveCounty != ''">#{receiveCounty},</if>
<if test="receiveTown != null and receiveTown != ''">#{receiveTown},</if>
<if test="receiveAddress != null and receiveAddress != ''">#{receiveAddress},</if>
<if test="receivePostcode != null and receivePostcode != ''">#{receivePostcode},</if>
<if test="receivePcd != null and receivePcd != ''">#{receivePcd},</if>
<if test="sendName != null and sendName != ''">#{sendName},</if>
<if test="sendCompany != null and sendCompany != ''">#{sendCompany},</if>
<if test="sendMobile != null and sendMobile != ''">#{sendMobile},</if>
<if test="sendTel != null and sendTel != ''">#{sendTel},</if>
<if test="sendCountry != null and sendCountry != ''">#{sendCountry},</if>
<if test="sendProvince != null and sendProvince != ''">#{sendProvince},</if>
<if test="sendCity != null and sendCity != ''">#{sendCity},</if>
<if test="sendCounty != null and sendCounty != ''">#{sendCounty},</if>
<if test="sendTown != null and sendTown != ''">#{sendTown},</if>
<if test="sendAddress != null and sendAddress != ''">#{sendAddress},</if>
<if test="sendPostcode != null and sendPostcode != ''">#{sendPostcode},</if>
<if test="sendPcd != null and sendPcd != ''">#{sendPcd},</if>
<if test="paymentType != null and paymentType != ''">#{paymentType},</if>
<if test="calcFeeType != null and calcFeeType != ''">#{calcFeeType},</if>
<if test="custNo != null and custNo != ''">#{custNo},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="transLineType != null and transLineType != ''">#{transLineType},</if>
<if test="productType != null and productType != ''">#{productType},</if>
<if test="timeType != null and timeType != ''">#{timeType},</if>
<if test="meterType != null and meterType != ''">#{meterType},</if>
<if test="carryType != null and carryType != ''">#{carryType},</if>
<if test="customsClear != null and customsClear != ''">#{customsClear},</if>
<if test="customsEclaration != null and customsEclaration != ''">#{customsEclaration},</if>
<if test="estimateDate != null">#{estimateDate},</if>
<if test="packType != null and packType != ''">#{packType},</if>
<if test="dispatchMethod != null and dispatchMethod != ''">#{dispatchMethod},</if>
<if test="pickupMethod != null and pickupMethod != ''">#{pickupMethod},</if>
<if test="pickStartDate != null">#{pickStartDate},</if>
<if test="pickFinishDate != null">#{pickFinishDate},</if>
<if test="pickFailReason != null and pickFailReason != ''">#{pickFailReason},</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''">#{intoWarehouseCode},</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''">#{intoWarehouseName},</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''">#{intoWarehouseAddress},</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''">#{intoWarehouseContact},</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''">#{intoWarehousePhone},</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''">#{intoWarehouseBillCode},</if>
<if test="warehouseInNo != null and warehouseInNo != ''">#{warehouseInNo},</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''">#{customerDeliveryBeginTime},</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''">#{customerDeliveryEndTime},</if>
<if test="goodsType != null and goodsType != ''">#{goodsType},</if>
<if test="goodsInfo != null and goodsInfo != ''">#{goodsInfo},</if>
<if test="goodsPics != null and goodsPics != ''">#{goodsPics},</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''">#{blPrepareInFreight},</if>
<if test="prepareInEstFee != null">#{prepareInEstFee},</if>
<if test="prepareInRealFee != null">#{prepareInRealFee},</if>
<if test="prepareInExpress != null and prepareInExpress != ''">#{prepareInExpress},</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''">#{prepareInBillCode},</if>
<if test="prepareInRemark != null and prepareInRemark != ''">#{prepareInRemark},</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''">#{prepareInSupplier},</if>
<if test="totalWeight != null">#{totalWeight},</if>
<if test="totalVolume != null">#{totalVolume},</if>
<if test="parcelQty != null">#{parcelQty},</if>
<if test="billWeight != null">#{billWeight},</if>
<if test="volumeWeight != null">#{volumeWeight},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="settlementWeight != null">#{settlementWeight},</if>
<if test="scanWeight != null">#{scanWeight},</if>
<if test="feeWeight != null">#{feeWeight},</if>
<if test="freight != null">#{freight},</if>
<if test="realPaymentType != null and realPaymentType != ''">#{realPaymentType},</if>
<if test="realFee != null">#{realFee},</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''">#{blSpecialQuote},</if>
<if test="blSensitive != null and blSensitive != ''">#{blSensitive},</if>
<if test="blOverLong != null and blOverLong != ''">#{blOverLong},</if>
<if test="blVirtual != null and blVirtual != ''">#{blVirtual},</if>
<if test="masterBillCode != null and masterBillCode != ''">#{masterBillCode},</if>
<if test="blBill != null and blBill != ''">#{blBill},</if>
<if test="blBillText != null and blBillText != ''">#{blBillText},</if>
<if test="blProfit != null and blProfit != ''">#{blProfit},</if>
<if test="blOverWeight != null and blOverWeight != ''">#{blOverWeight},</if>
<if test="overWeightNumber != null and overWeightNumber != ''">#{overWeightNumber},</if>
<if test="feeRemark != null and feeRemark != ''">#{feeRemark},</if>
<if test="thirdCode != null and thirdCode != ''">#{thirdCode},</if>
<if test="realValue != null and realValue != ''">#{realValue},</if>
<if test="blInsure != null and blInsure != ''">#{blInsure},</if>
<if test="insureValue != null and insureValue != ''">#{insureValue},</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''">#{insureValueCurrency},</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''">#{insureFeeCurrency},</if>
<if test="insureFee != null">#{insureFee},</if>
<if test="insureRemark != null and insureRemark != ''">#{insureRemark},</if>
<if test="insureSiteCode != null and insureSiteCode != ''">#{insureSiteCode},</if>
<if test="insureDate != null and insureDate != ''">#{insureDate},</if>
<if test="blCod != null and blCod != ''">#{blCod},</if>
<if test="codFee != null">#{codFee},</if>
<if test="codFeeCurrency != null and codFeeCurrency != ''">#{codFeeCurrency},</if>
<if test="codFeeDesc != null and codFeeDesc != ''">#{codFeeDesc},</if>
<if test="blPrint != null and blPrint != ''">#{blPrint},</if>
<if test="printManCode != null and printManCode != ''">#{printManCode},</if>
<if test="printSite != null and printSite != ''">#{printSite},</if>
<if test="printDate != null and printDate != ''">#{printDate},</if>
<if test="printCount != null">#{printCount},</if>
<if test="blDispFd != null and blDispFd != ''">#{blDispFd},</if>
<if test="transferCode != null and transferCode != ''">#{transferCode},</if>
<if test="transferBillcode != null and transferBillcode != ''">#{transferBillcode},</if>
<if test="dispFdDate != null">#{dispFdDate},</if>
<if test="dispFdReason != null and dispFdReason != ''">#{dispFdReason},</if>
<if test="currentSiteCode != null and currentSiteCode != ''">#{currentSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
<if test="lastSiteCode != null and lastSiteCode != ''">#{lastSiteCode},</if>
<if test="registerSiteCode != null and registerSiteCode != ''">#{registerSiteCode},</if>
<if test="registerDate != null">#{registerDate},</if>
<if test="registerManCode != null and registerManCode != ''">#{registerManCode},</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''">#{takePieceEmployeeCode},</if>
<if test="sendSiteCode != null and sendSiteCode != ''">#{sendSiteCode},</if>
<if test="sendCenterCode != null and sendCenterCode != ''">#{sendCenterCode},</if>
<if test="sendDate != null">#{sendDate},</if>
<if test="dispatchManCode != null and dispatchManCode != ''">#{dispatchManCode},</if>
<if test="dispatchDate != null">#{dispatchDate},</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''">#{dispatchSiteCode},</if>
<if test="produceBillDate != null">#{produceBillDate},</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''">#{produceBillSiteCode},</if>
<if test="produceBillManCode != null and produceBillManCode != ''">#{produceBillManCode},</if>
<if test="destinationCode != null and destinationCode != ''">#{destinationCode},</if>
<if test="destinationProvince != null and destinationProvince != ''">#{destinationProvince},</if>
<if test="destinationCity != null and destinationCity != ''">#{destinationCity},</if>
<if test="destinationCounty != null and destinationCounty != ''">#{destinationCounty},</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">#{dispatchUnderlingSiteCode},</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">#{destinationCenterCode},</if>
<if test="marketManCode != null and marketManCode != ''">#{marketManCode},</if>
<if test="payee != null and payee != ''">#{payee},</if>
<if test="salesmen != null and salesmen != ''">#{salesmen},</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''">#{operateEmployeeCode},</if>
<if test="blIsQuestion != null and blIsQuestion != ''">#{blIsQuestion},</if>
<if test="problemType != null">#{problemType},</if>
<if test="problemCause != null and problemCause != ''">#{problemCause},</if>
<if test="problemDelayDays != null">#{problemDelayDays},</if>
<if test="blMessage != null and blMessage != ''">#{blMessage},</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''">#{blAcceptMessage},</if>
<if test="blGenSubbill != null and blGenSubbill != ''">#{blGenSubbill},</if>
<if test="blSign != null and blSign != ''">#{blSign},</if>
<if test="signMan != null and signMan != ''">#{signMan},</if>
<if test="signManCode != null and signManCode != ''">#{signManCode},</if>
<if test="signSiteCode != null and signSiteCode != ''">#{signSiteCode},</if>
<if test="signDate != null">#{signDate},</if>
<if test="billPicSendRmk != null and billPicSendRmk != ''">#{billPicSendRmk},</if>
<if test="billPicDispatchRmk != null and billPicDispatchRmk != ''">#{billPicDispatchRmk},</if>
<if test="timezoneOffset != null and timezoneOffset != ''">#{timezoneOffset},</if>
<if test="paymentStatus != null and paymentStatus != ''">#{paymentStatus},</if>
<if test="paymentDate != null">#{paymentDate},</if>
<if test="paymentRemark != null and paymentRemark != ''">#{paymentRemark},</if>
<if test="orderRemark != null and orderRemark != ''">#{orderRemark},</if>
<if test="cancelCause != null and cancelCause != ''">#{cancelCause},</if>
<if test="dataFrom != null and dataFrom != ''">#{dataFrom},</if>
<if test="blSpecialGoods != null and blSpecialGoods != ''">#{blSpecialGoods},</if>
<if test="extInfo != null and extInfo != ''">#{extInfo},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
<if test="ladingBillCode != null and ladingBillCode != ''">#{ladingBillCode},</if>
<if test="companyCode != null and companyCode != ''">#{companyCode},</if>
<if test="departurePort != null and departurePort != ''">#{departurePort},</if>
<if test="destinationPort != null and destinationPort != ''">#{destinationPort},</if>
<if test="boxQuantity != null and boxQuantity != ''">#{boxQuantity},</if>
</trim>
</insert>
<update id="updateEmisWaybill" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
<if test="custOrderId != null and custOrderId != ''">cust_order_id = #{custOrderId},</if>
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub = #{billCodeSub},</if>
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
<if test="waybillStatus != null and waybillStatus != ''">waybill_status = #{waybillStatus},</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code = #{startSiteCode},</if>
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
<if test="orderDate != null">order_date = #{orderDate},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="receiveName != null and receiveName != ''">receive_name = #{receiveName},</if>
<if test="receiveCompany != null and receiveCompany != ''">receive_company = #{receiveCompany},</if>
<if test="receiveMobile != null and receiveMobile != ''">receive_mobile = #{receiveMobile},</if>
<if test="receiveTel != null and receiveTel != ''">receive_tel = #{receiveTel},</if>
<if test="receiveCountry != null and receiveCountry != ''">receive_country = #{receiveCountry},</if>
<if test="receiveProvince != null and receiveProvince != ''">receive_province = #{receiveProvince},</if>
<if test="receiveCity != null and receiveCity != ''">receive_city = #{receiveCity},</if>
<if test="receiveCounty != null and receiveCounty != ''">receive_county = #{receiveCounty},</if>
<if test="receiveTown != null and receiveTown != ''">receive_town = #{receiveTown},</if>
<if test="receiveAddress != null and receiveAddress != ''">receive_address = #{receiveAddress},</if>
<if test="receivePostcode != null and receivePostcode != ''">receive_postcode = #{receivePostcode},</if>
<if test="receivePcd != null and receivePcd != ''">receive_pcd = #{receivePcd},</if>
<if test="sendName != null and sendName != ''">send_name = #{sendName},</if>
<if test="sendCompany != null and sendCompany != ''">send_company = #{sendCompany},</if>
<if test="sendMobile != null and sendMobile != ''">send_mobile = #{sendMobile},</if>
<if test="sendTel != null and sendTel != ''">send_tel = #{sendTel},</if>
<if test="sendCountry != null and sendCountry != ''">send_country = #{sendCountry},</if>
<if test="sendProvince != null and sendProvince != ''">send_province = #{sendProvince},</if>
<if test="sendCity != null and sendCity != ''">send_city = #{sendCity},</if>
<if test="sendCounty != null and sendCounty != ''">send_county = #{sendCounty},</if>
<if test="sendTown != null and sendTown != ''">send_town = #{sendTown},</if>
<if test="sendAddress != null and sendAddress != ''">send_address = #{sendAddress},</if>
<if test="sendPostcode != null and sendPostcode != ''">send_postcode = #{sendPostcode},</if>
<if test="sendPcd != null and sendPcd != ''">send_pcd = #{sendPcd},</if>
<if test="paymentType != null and paymentType != ''">payment_type = #{paymentType},</if>
<if test="calcFeeType != null and calcFeeType != ''">calc_fee_type = #{calcFeeType},</if>
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="transLineType != null and transLineType != ''">trans_line_type = #{transLineType},</if>
<if test="productType != null and productType != ''">product_type = #{productType},</if>
<if test="timeType != null and timeType != ''">time_type = #{timeType},</if>
<if test="meterType != null and meterType != ''">meter_type = #{meterType},</if>
<if test="carryType != null and carryType != ''">carry_type = #{carryType},</if>
<if test="customsClear != null and customsClear != ''">customs_clear = #{customsClear},</if>
<if test="customsEclaration != null and customsEclaration != ''">customs_eclaration = #{customsEclaration},</if>
<if test="estimateDate != null">estimate_date = #{estimateDate},</if>
<if test="packType != null and packType != ''">pack_type = #{packType},</if>
<if test="dispatchMethod != null and dispatchMethod != ''">dispatch_method = #{dispatchMethod},</if>
<if test="pickupMethod != null and pickupMethod != ''">pickup_method = #{pickupMethod},</if>
<if test="pickStartDate != null">pick_start_date = #{pickStartDate},</if>
<if test="pickFinishDate != null">pick_finish_date = #{pickFinishDate},</if>
<if test="pickFailReason != null and pickFailReason != ''">pick_fail_reason = #{pickFailReason},</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''">into_warehouse_code = #{intoWarehouseCode},</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''">into_warehouse_name = #{intoWarehouseName},</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''">into_warehouse_address = #{intoWarehouseAddress},</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''">into_warehouse_contact = #{intoWarehouseContact},</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''">into_warehouse_phone = #{intoWarehousePhone},</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''">into_warehouse_bill_code = #{intoWarehouseBillCode},</if>
<if test="warehouseInNo != null and warehouseInNo != ''">warehouse_in_no = #{warehouseInNo},</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''">customer_delivery_begin_time = #{customerDeliveryBeginTime},</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''">customer_delivery_end_time = #{customerDeliveryEndTime},</if>
<if test="goodsType != null and goodsType != ''">goods_type = #{goodsType},</if>
<if test="goodsInfo != null and goodsInfo != ''">goods_info = #{goodsInfo},</if>
<if test="goodsPics != null and goodsPics != ''">goods_pics = #{goodsPics},</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''">bl_prepare_in_freight = #{blPrepareInFreight},</if>
<if test="prepareInEstFee != null">prepare_in_est_fee = #{prepareInEstFee},</if>
<if test="prepareInRealFee != null">prepare_in_real_fee = #{prepareInRealFee},</if>
<if test="prepareInExpress != null and prepareInExpress != ''">prepare_in_express = #{prepareInExpress},</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''">prepare_in_bill_code = #{prepareInBillCode},</if>
<if test="prepareInRemark != null and prepareInRemark != ''">prepare_in_remark = #{prepareInRemark},</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''">prepare_in_supplier = #{prepareInSupplier},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="parcelQty != null">parcel_qty = #{parcelQty},</if>
<if test="billWeight != null">bill_weight = #{billWeight},</if>
<if test="volumeWeight != null">volume_weight = #{volumeWeight},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="settlementWeight != null">settlement_weight = #{settlementWeight},</if>
<if test="scanWeight != null">scan_weight = #{scanWeight},</if>
<if test="feeWeight != null">fee_weight = #{feeWeight},</if>
<if test="freight != null">freight = #{freight},</if>
<if test="realPaymentType != null and realPaymentType != ''">real_payment_type = #{realPaymentType},</if>
<if test="realFee != null">real_fee = #{realFee},</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''">bl_special_quote = #{blSpecialQuote},</if>
<if test="blSensitive != null and blSensitive != ''">bl_sensitive = #{blSensitive},</if>
<if test="blOverLong != null and blOverLong != ''">bl_over_long = #{blOverLong},</if>
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code= #{masterBillCode},</if>
<if test="virtualRemark != null and virtualRemark != ''">virtual_remark= #{virtualRemark},</if>
<if test="blBill != null and blBill != ''">bl_bill = #{blBill},</if>
<if test="blBillText != null and blBillText != ''">bl_bill_text = #{blBillText},</if>
<if test="blProfit != null and blProfit != ''">bl_profit = #{blProfit},</if>
<if test="blOverWeight != null and blOverWeight != ''">bl_over_weight = #{blOverWeight},</if>
<if test="overWeightNumber != null and overWeightNumber != ''">over_weight_number = #{overWeightNumber},</if>
<if test="feeRemark != null and feeRemark != ''">fee_remark = #{feeRemark},</if>
<if test="thirdCode != null and thirdCode != ''">third_code = #{thirdCode},</if>
<if test="realValue != null and realValue != ''">real_value = #{realValue},</if>
<if test="blInsure != null and blInsure != ''">bl_insure = #{blInsure},</if>
<if test="insureValue != null and insureValue != ''">insure_value = #{insureValue},</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''">insure_value_currency = #{insureValueCurrency},</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''">insure_fee_currency = #{insureFeeCurrency},</if>
<if test="insureFee != null">insure_fee = #{insureFee},</if>
<if test="insureRemark != null and insureRemark != ''">insure_remark = #{insureRemark},</if>
<if test="insureSiteCode != null and insureSiteCode != ''">insure_site_code = #{insureSiteCode},</if>
<if test="insureDate != null and insureDate != ''">insure_date = #{insureDate},</if>
<if test="blCod != null and blCod != ''">bl_cod = #{blCod},</if>
<if test="codFee != null">cod_fee = #{codFee},</if>
<if test="codFeeCurrency != null and codFeeCurrency != ''">cod_fee_currency = #{codFeeCurrency},</if>
<if test="codFeeDesc != null and codFeeDesc != ''">cod_fee_desc = #{codFeeDesc},</if>
<if test="blPrint != null and blPrint != ''">bl_print = #{blPrint},</if>
<if test="printManCode != null and printManCode != ''">print_man_code = #{printManCode},</if>
<if test="printSite != null and printSite != ''">print_site = #{printSite},</if>
<if test="printDate != null and printDate != ''">print_date = #{printDate},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="blDispFd != null and blDispFd != ''">bl_disp_fd = #{blDispFd},</if>
<if test="transferCode != null and transferCode != ''">transfer_code = #{transferCode},</if>
<if test="transferBillcode != null and transferBillcode != ''">transfer_billcode = #{transferBillcode},</if>
<if test="dispFdDate != null">disp_fd_date = #{dispFdDate},</if>
<if test="dispFdReason != null and dispFdReason != ''">disp_fd_reason = #{dispFdReason},</if>
<if test="currentSiteCode != null and currentSiteCode != ''">current_site_code = #{currentSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="lastSiteCode != null and lastSiteCode != ''">last_site_code = #{lastSiteCode},</if>
<if test="registerSiteCode != null and registerSiteCode != ''">register_site_code = #{registerSiteCode},</if>
<if test="registerDate != null">register_date = #{registerDate},</if>
<if test="registerManCode != null and registerManCode != ''">register_man_code = #{registerManCode},</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''">take_piece_employee_code = #{takePieceEmployeeCode},</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
<if test="sendCenterCode != null and sendCenterCode != ''">send_center_code = #{sendCenterCode},</if>
<if test="sendDate != null">send_date = #{sendDate},</if>
<if test="dispatchManCode != null and dispatchManCode != ''">dispatch_man_code = #{dispatchManCode},</if>
<if test="dispatchDate != null">dispatch_date = #{dispatchDate},</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''">dispatch_site_code = #{dispatchSiteCode},</if>
<if test="produceBillDate != null">produce_bill_date = #{produceBillDate},</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''">produce_bill_site_code = #{produceBillSiteCode},</if>
<if test="produceBillManCode != null and produceBillManCode != ''">produce_bill_man_code = #{produceBillManCode},</if>
<if test="destinationCode != null and destinationCode != ''">destination_code = #{destinationCode},</if>
<if test="destinationProvince != null and destinationProvince != ''">destination_province = #{destinationProvince},</if>
<if test="destinationCity != null and destinationCity != ''">destination_city = #{destinationCity},</if>
<if test="destinationCounty != null and destinationCounty != ''">destination_county = #{destinationCounty},</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">dispatch_underling_site_code = #{dispatchUnderlingSiteCode},</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">destination_center_code = #{destinationCenterCode},</if>
<if test="marketManCode != null and marketManCode != ''">market_man_code = #{marketManCode},</if>
<if test="payee != null and payee != ''">payee = #{payee},</if>
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''">operate_employee_code = #{operateEmployeeCode},</if>
<if test="blIsQuestion != null and blIsQuestion != ''">bl_is_question = #{blIsQuestion},</if>
<if test="problemType != null">problem_type = #{problemType},</if>
<if test="problemCause != null and problemCause != ''">problem_cause = #{problemCause},</if>
<if test="problemDelayDays != null">problem_delay_days = #{problemDelayDays},</if>
<if test="blMessage != null and blMessage != ''">bl_message = #{blMessage},</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''">bl_accept_message = #{blAcceptMessage},</if>
<if test="blGenSubbill != null and blGenSubbill != ''">bl_gen_subbill = #{blGenSubbill},</if>
<if test="blSign != null and blSign != ''">bl_sign = #{blSign},</if>
<if test="signMan != null and signMan != ''">sign_man = #{signMan},</if>
<if test="signManCode != null and signManCode != ''">sign_man_code = #{signManCode},</if>
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code = #{signSiteCode},</if>
<if test="signDate != null">sign_date = #{signDate},</if>
<if test="billPicSendRmk != null and billPicSendRmk != ''">bill_pic_send_rmk = #{billPicSendRmk},</if>
<if test="billPicDispatchRmk != null and billPicDispatchRmk != ''">bill_pic_dispatch_rmk = #{billPicDispatchRmk},</if>
<if test="timezoneOffset != null and timezoneOffset != ''">timezone_offset = #{timezoneOffset},</if>
<if test="paymentStatus != null and paymentStatus != ''">payment_status = #{paymentStatus},</if>
<if test="paymentDate != null">payment_date = #{paymentDate},</if>
<if test="paymentRemark != null and paymentRemark != ''">payment_remark = #{paymentRemark},</if>
<if test="orderRemark != null and orderRemark != ''">order_remark = #{orderRemark},</if>
<if test="cancelCause != null and cancelCause != ''">cancel_cause = #{cancelCause},</if>
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</if>
<if test="blSpecialGoods != null and blSpecialGoods != ''">bl_special_goods = #{blSpecialGoods},</if>
<if test="extInfo != null and extInfo != ''">ext_info = #{extInfo},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
<if test="ladingBillCode != null and ladingBillCode != ''">lading_bill_code = #{ladingBillCode},</if>
<if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
<if test="departurePort != null and departurePort != ''">departure_port = #{departurePort},</if>
<if test="destinationPort != null and destinationPort != ''">destination_port = #{destinationPort},</if>
<if test="boxQuantity != null and boxQuantity != ''">box_quantity = #{boxQuantity},</if>
</trim>
where id = #{id}
</update>
<update id="updateVirtualWaybill" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
<if test="custOrderId != null and custOrderId != ''">cust_order_id = #{custOrderId},</if>
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub = #{billCodeSub},</if>
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
<if test="waybillStatus != null and waybillStatus != ''">waybill_status = #{waybillStatus},</if>
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
<if test="orderDate != null">order_date = #{orderDate},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="receiveName != null and receiveName != ''">receive_name = #{receiveName},</if>
<if test="receiveCompany != null and receiveCompany != ''">receive_company = #{receiveCompany},</if>
<if test="receiveMobile != null and receiveMobile != ''">receive_mobile = #{receiveMobile},</if>
<if test="receiveTel != null and receiveTel != ''">receive_tel = #{receiveTel},</if>
<if test="receiveCountry != null and receiveCountry != ''">receive_country = #{receiveCountry},</if>
<if test="receiveProvince != null and receiveProvince != ''">receive_province = #{receiveProvince},</if>
<if test="receiveCity != null and receiveCity != ''">receive_city = #{receiveCity},</if>
<if test="receiveCounty != null and receiveCounty != ''">receive_county = #{receiveCounty},</if>
<if test="receiveTown != null and receiveTown != ''">receive_town = #{receiveTown},</if>
<if test="receiveAddress != null and receiveAddress != ''">receive_address = #{receiveAddress},</if>
<if test="receivePostcode != null and receivePostcode != ''">receive_postcode = #{receivePostcode},</if>
<if test="receivePcd != null and receivePcd != ''">receive_pcd = #{receivePcd},</if>
<if test="sendName != null and sendName != ''">send_name = #{sendName},</if>
<if test="sendCompany != null and sendCompany != ''">send_company = #{sendCompany},</if>
<if test="sendMobile != null and sendMobile != ''">send_mobile = #{sendMobile},</if>
<if test="sendTel != null and sendTel != ''">send_tel = #{sendTel},</if>
<if test="sendCountry != null and sendCountry != ''">send_country = #{sendCountry},</if>
<if test="sendProvince != null and sendProvince != ''">send_province = #{sendProvince},</if>
<if test="sendCity != null and sendCity != ''">send_city = #{sendCity},</if>
<if test="sendCounty != null and sendCounty != ''">send_county = #{sendCounty},</if>
<if test="sendTown != null and sendTown != ''">send_town = #{sendTown},</if>
<if test="sendAddress != null and sendAddress != ''">send_address = #{sendAddress},</if>
<if test="sendPostcode != null and sendPostcode != ''">send_postcode = #{sendPostcode},</if>
<if test="sendPcd != null and sendPcd != ''">send_pcd = #{sendPcd},</if>
<if test="paymentType != null and paymentType != ''">payment_type = #{paymentType},</if>
<if test="calcFeeType != null and calcFeeType != ''">calc_fee_type = #{calcFeeType},</if>
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="transLineType != null and transLineType != ''">trans_line_type = #{transLineType},</if>
<if test="productType != null and productType != ''">product_type = #{productType},</if>
<if test="timeType != null and timeType != ''">time_type = #{timeType},</if>
<if test="meterType != null and meterType != ''">meter_type = #{meterType},</if>
<if test="carryType != null and carryType != ''">carry_type = #{carryType},</if>
<if test="customsClear != null and customsClear != ''">customs_clear = #{customsClear},</if>
<if test="customsEclaration != null and customsEclaration != ''">customs_eclaration = #{customsEclaration},</if>
<if test="estimateDate != null">estimate_date = #{estimateDate},</if>
<if test="packType != null and packType != ''">pack_type = #{packType},</if>
<if test="dispatchMethod != null and dispatchMethod != ''">dispatch_method = #{dispatchMethod},</if>
<if test="pickupMethod != null and pickupMethod != ''">pickup_method = #{pickupMethod},</if>
<if test="pickStartDate != null">pick_start_date = #{pickStartDate},</if>
<if test="pickFinishDate != null">pick_finish_date = #{pickFinishDate},</if>
<if test="pickFailReason != null and pickFailReason != ''">pick_fail_reason = #{pickFailReason},</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''">into_warehouse_code = #{intoWarehouseCode},</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''">into_warehouse_name = #{intoWarehouseName},</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''">into_warehouse_address = #{intoWarehouseAddress},</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''">into_warehouse_contact = #{intoWarehouseContact},</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''">into_warehouse_phone = #{intoWarehousePhone},</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''">into_warehouse_bill_code = #{intoWarehouseBillCode},</if>
<if test="warehouseInNo != null and warehouseInNo != ''">warehouse_in_no = #{warehouseInNo},</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''">customer_delivery_begin_time = #{customerDeliveryBeginTime},</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''">customer_delivery_end_time = #{customerDeliveryEndTime},</if>
<if test="goodsType != null and goodsType != ''">goods_type = #{goodsType},</if>
<if test="goodsInfo != null and goodsInfo != ''">goods_info = #{goodsInfo},</if>
<if test="goodsPics != null and goodsPics != ''">goods_pics = #{goodsPics},</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''">bl_prepare_in_freight = #{blPrepareInFreight},</if>
<if test="prepareInEstFee != null">prepare_in_est_fee = #{prepareInEstFee},</if>
<if test="prepareInRealFee != null">prepare_in_real_fee = #{prepareInRealFee},</if>
<if test="prepareInExpress != null and prepareInExpress != ''">prepare_in_express = #{prepareInExpress},</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''">prepare_in_bill_code = #{prepareInBillCode},</if>
<if test="prepareInRemark != null and prepareInRemark != ''">prepare_in_remark = #{prepareInRemark},</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''">prepare_in_supplier = #{prepareInSupplier},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="parcelQty != null">parcel_qty = #{parcelQty},</if>
<if test="billWeight != null">bill_weight = #{billWeight},</if>
<if test="volumeWeight != null">volume_weight = #{volumeWeight},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="settlementWeight != null">settlement_weight = #{settlementWeight},</if>
<if test="scanWeight != null">scan_weight = #{scanWeight},</if>
<if test="feeWeight != null">fee_weight = #{feeWeight},</if>
<if test="freight != null">freight = #{freight},</if>
<if test="realPaymentType != null and realPaymentType != ''">real_payment_type = #{realPaymentType},</if>
<if test="realFee != null">real_fee = #{realFee},</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''">bl_special_quote = #{blSpecialQuote},</if>
<if test="blSensitive != null and blSensitive != ''">bl_sensitive = #{blSensitive},</if>
<if test="blOverLong != null and blOverLong != ''">bl_over_long = #{blOverLong},</if>
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code= #{masterBillCode},</if>
<if test="virtualRemark != null and virtualRemark != ''">virtual_remark= #{virtualRemark},</if>
<if test="blBill != null and blBill != ''">bl_bill = #{blBill},</if>
<if test="blBillText != null and blBillText != ''">bl_bill_text = #{blBillText},</if>
<if test="blProfit != null and blProfit != ''">bl_profit = #{blProfit},</if>
<if test="blOverWeight != null and blOverWeight != ''">bl_over_weight = #{blOverWeight},</if>
<if test="overWeightNumber != null and overWeightNumber != ''">over_weight_number = #{overWeightNumber},</if>
<if test="feeRemark != null and feeRemark != ''">fee_remark = #{feeRemark},</if>
<if test="thirdCode != null and thirdCode != ''">third_code = #{thirdCode},</if>
<if test="realValue != null and realValue != ''">real_value = #{realValue},</if>
<if test="blInsure != null and blInsure != ''">bl_insure = #{blInsure},</if>
<if test="insureValue != null and insureValue != ''">insure_value = #{insureValue},</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''">insure_value_currency = #{insureValueCurrency},</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''">insure_fee_currency = #{insureFeeCurrency},</if>
<if test="insureFee != null">insure_fee = #{insureFee},</if>
<if test="insureRemark != null and insureRemark != ''">insure_remark = #{insureRemark},</if>
<if test="insureSiteCode != null and insureSiteCode != ''">insure_site_code = #{insureSiteCode},</if>
<if test="insureDate != null and insureDate != ''">insure_date = #{insureDate},</if>
<if test="blCod != null and blCod != ''">bl_cod = #{blCod},</if>
<if test="codFee != null">cod_fee = #{codFee},</if>
<if test="codFeeCurrency != null and codFeeCurrency != ''">cod_fee_currency = #{codFeeCurrency},</if>
<if test="codFeeDesc != null and codFeeDesc != ''">cod_fee_desc = #{codFeeDesc},</if>
<if test="blPrint != null and blPrint != ''">bl_print = #{blPrint},</if>
<if test="printManCode != null and printManCode != ''">print_man_code = #{printManCode},</if>
<if test="printSite != null and printSite != ''">print_site = #{printSite},</if>
<if test="printDate != null and printDate != ''">print_date = #{printDate},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="blDispFd != null and blDispFd != ''">bl_disp_fd = #{blDispFd},</if>
<if test="transferCode != null and transferCode != ''">transfer_code = #{transferCode},</if>
<if test="transferBillcode != null and transferBillcode != ''">transfer_billcode = #{transferBillcode},</if>
<if test="dispFdDate != null">disp_fd_date = #{dispFdDate},</if>
<if test="dispFdReason != null and dispFdReason != ''">disp_fd_reason = #{dispFdReason},</if>
<if test="currentSiteCode != null and currentSiteCode != ''">current_site_code = #{currentSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="lastSiteCode != null and lastSiteCode != ''">last_site_code = #{lastSiteCode},</if>
<if test="registerSiteCode != null and registerSiteCode != ''">register_site_code = #{registerSiteCode},</if>
<if test="registerDate != null">register_date = #{registerDate},</if>
<if test="registerManCode != null and registerManCode != ''">register_man_code = #{registerManCode},</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''">take_piece_employee_code = #{takePieceEmployeeCode},</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
<if test="sendCenterCode != null and sendCenterCode != ''">send_center_code = #{sendCenterCode},</if>
<if test="sendDate != null">send_date = #{sendDate},</if>
<if test="dispatchManCode != null and dispatchManCode != ''">dispatch_man_code = #{dispatchManCode},</if>
<if test="dispatchDate != null">dispatch_date = #{dispatchDate},</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''">dispatch_site_code = #{dispatchSiteCode},</if>
<if test="produceBillDate != null">produce_bill_date = #{produceBillDate},</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''">produce_bill_site_code = #{produceBillSiteCode},</if>
<if test="produceBillManCode != null and produceBillManCode != ''">produce_bill_man_code = #{produceBillManCode},</if>
<if test="destinationCode != null and destinationCode != ''">destination_code = #{destinationCode},</if>
<if test="destinationProvince != null and destinationProvince != ''">destination_province = #{destinationProvince},</if>
<if test="destinationCity != null and destinationCity != ''">destination_city = #{destinationCity},</if>
<if test="destinationCounty != null and destinationCounty != ''">destination_county = #{destinationCounty},</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">dispatch_underling_site_code = #{dispatchUnderlingSiteCode},</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">destination_center_code = #{destinationCenterCode},</if>
<if test="marketManCode != null and marketManCode != ''">market_man_code = #{marketManCode},</if>
<if test="payee != null and payee != ''">payee = #{payee},</if>
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''">operate_employee_code = #{operateEmployeeCode},</if>
<if test="blIsQuestion != null and blIsQuestion != ''">bl_is_question = #{blIsQuestion},</if>
<if test="problemType != null">problem_type = #{problemType},</if>
<if test="problemCause != null and problemCause != ''">problem_cause = #{problemCause},</if>
<if test="problemDelayDays != null">problem_delay_days = #{problemDelayDays},</if>
<if test="blMessage != null and blMessage != ''">bl_message = #{blMessage},</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''">bl_accept_message = #{blAcceptMessage},</if>
<if test="blGenSubbill != null and blGenSubbill != ''">bl_gen_subbill = #{blGenSubbill},</if>
<if test="blSign != null and blSign != ''">bl_sign = #{blSign},</if>
<if test="signMan != null and signMan != ''">sign_man = #{signMan},</if>
<if test="signManCode != null and signManCode != ''">sign_man_code = #{signManCode},</if>
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code = #{signSiteCode},</if>
<if test="signDate != null">sign_date = #{signDate},</if>
<if test="billPicSendRmk != null and billPicSendRmk != ''">bill_pic_send_rmk = #{billPicSendRmk},</if>
<if test="billPicDispatchRmk != null and billPicDispatchRmk != ''">bill_pic_dispatch_rmk = #{billPicDispatchRmk},</if>
<if test="timezoneOffset != null and timezoneOffset != ''">timezone_offset = #{timezoneOffset},</if>
<if test="paymentStatus != null and paymentStatus != ''">payment_status = #{paymentStatus},</if>
<if test="paymentDate != null">payment_date = #{paymentDate},</if>
<if test="paymentRemark != null and paymentRemark != ''">payment_remark = #{paymentRemark},</if>
<if test="orderRemark != null and orderRemark != ''">order_remark = #{orderRemark},</if>
<if test="cancelCause != null and cancelCause != ''">cancel_cause = #{cancelCause},</if>
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</if>
<if test="blSpecialGoods != null and blSpecialGoods != ''">bl_special_goods = #{blSpecialGoods},</if>
<if test="extInfo != null and extInfo != ''">ext_info = #{extInfo},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
<if test="ladingBillCode != null and ladingBillCode != ''">lading_bill_code = #{ladingBillCode},</if>
<if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
<if test="departurePort != null and departurePort != ''">departure_port = #{departurePort},</if>
<if test="destinationPort != null and destinationPort != ''">destination_port = #{destinationPort},</if>
<if test="boxQuantity != null and boxQuantity != ''">box_quantity = #{boxQuantity},</if>
</trim>
where id = #{id}
</update>
<update id="updatePrintStatus" parameterType="EmisWaybill">
update emis_waybill set
bl_print='1',
print_man_code=#{printManCode},
print_site=#{printSite},
print_date=now(),
print_count=print_count+1
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where bill_code=#{billCode}
</update>
<update id="updateSignStatus" parameterType="EmisWaybill">
update emis_waybill
set sign_man=#{signMan},
bl_sign = '1',
dispatch_man_code = #{dispatchManCode},
sign_man_code=#{signManCode},
sign_site_code = #{signSiteCode},
sign_date = #{signDate},
bill_pic_dispatch_rmk = #{billPicDispatchRmk}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where bill_code=#{billCode}
</update>
<update id="updatePayedStatus" parameterType="EmisWaybill">
update emis_waybill
set payment_status=#{paymentStatus}
where bill_code=#{billCode}
</update>
<update id="updateDispatchStatus" parameterType="EmisWaybill">
update emis_waybill set
dispatch_man_code = #{dispatchManCode},
dispatch_date = #{dispatchDate},
dispatch_site_code = #{dispatchSiteCode}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where bill_code=#{billCode}
</update>
<!-- 取消订单 -->
<update id="cancelOrder" parameterType="EmisWaybill">
update emis_waybill set
order_status = 2,
order_remark = #{orderRemark}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where order_sn=#{orderSn}
</update>
<!-- 确认订单 -->
<update id="confirmOrder" parameterType="EmisWaybill">
update emis_waybill set
order_status = '1'
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where order_sn=#{orderSn}
</update>
<!-- 分配网点 -->
<update id="assignSendSite" parameterType="EmisWaybill">
update emis_waybill set
send_site_code = #{sendSiteCode}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where order_sn=#{orderSn}
</update>
<!-- 分配取件员 -->
<update id="assignTakeMan" parameterType="EmisWaybill">
update emis_waybill set
take_piece_employee_code = #{takePieceEmployeeCode},send_site_code = #{sendSiteCode}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where order_sn=#{orderSn}
</update>
<!-- 打出账标识 -->
<update id="updateHasDoBill" parameterType="String">
update emis_waybill set
bl_bill = '1',produce_bill_date=now(),produce_bill_site_code='88888',produce_bill_man_code='0'
where bill_code=#{billCode}
</update>
<!-- 取消出账标识 -->
<update id="cancelHasDoBill" parameterType="String">
update emis_waybill set
bl_bill = '0',produce_bill_date=null,produce_bill_site_code=null,produce_bill_man_code=null
where bill_code=#{billCode}
</update>
<!-- 打提成标识 -->
<update id="updateHasDoProfit" parameterType="String">
update emis_waybill set
bl_profit = '1'
where bill_code=#{billCode}
</update>
<!-- 取消提成标识 -->
<update id="cancelHasDoProfit" parameterType="String">
update emis_waybill set
bl_profit = '0'
where bill_code=#{billCode}
</update>
<!-- 打成本计算标识 -->
<update id="updateHasDoCostFee" parameterType="String">
update emis_waybill set
bl_calc_cost = '1'
where bill_code=#{billCode}
</update>
<!-- 取消成本计算标识 -->
<update id="cancelHasDoCostFee" parameterType="String">
update emis_waybill set
bl_calc_cost = '0'
where bill_code=#{billCode}
</update>
<update id="updateUnSignStatus" parameterType="EmisWaybill">
update emis_waybill
set sign_man=null,
bl_sign = '0',
sign_man_code=null,
sign_site_code = null,
sign_date = null,
bill_pic_dispatch_rmk =null
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where bill_code=#{billCode}
</update>
<update id="updateProblemStatus" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
bl_is_question = '1',
problem_type = #{problemType},
problem_cause = #{problemCause},
problem_delay_days = #{problemDelayDays},
estimate_date = #{estimateDate}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
</trim>
where bill_code=#{billCode}
</update>
<!-- 取消问题件登记 -->
<update id="cancelProblemRegister" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
bl_is_question = '0',
problem_type = null,
problem_cause = null,
problem_delay_days = null
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
</trim>
where bill_code=#{billCode}
</update>
<update id="updateTransferInfo" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
bl_disp_fd ='1',
transfer_code = #{transferCode},
transfer_billcode = #{transferBillcode},
disp_fd_date = #{dispFdDate},
disp_fd_reason = #{dispFdReason}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
</trim>
where bill_code=#{billCode}
</update>
<update id="cancelTransferInfo" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
bl_disp_fd ='0',
transfer_code = null,
transfer_billcode = null,
disp_fd_date =null,
disp_fd_reason =null,
bl_sign = '0'
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
</trim>
where bill_code=#{billCode}
</update>
<update id="updatePreOrNextSiteByBillCode" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
<if test="currentSiteCode != null and currentSiteCode != ''">current_site_code = #{currentSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="lastSiteCode != null and lastSiteCode != ''">last_site_code = #{lastSiteCode},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where bill_code=#{billCode}
</update>
<update id="changeWaybillStatusByBillCode" parameterType="EmisWaybill">
update emis_waybill
<trim prefix="SET" suffixOverrides=",">
waybill_status=#{waybillStatus}
<if test="blSign != null and blSign != ''">,bl_sign = #{blSign}</if>
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
</trim>
where bill_code=#{billCode}
</update>
<update id="changeOrderStatusByBillCode" parameterType="EmisWaybill">
update emis_waybill set order_status=#{orderStatus}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where bill_code=#{billCode}
</update>
<update id="changeOrderStatusByOrderSn" parameterType="EmisWaybill">
update emis_waybill set order_status=#{orderStatus}
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where order_sn=#{orderSn}
</update>
<delete id="deleteEmisWaybillById" parameterType="Long">
update emis_waybill set del_flag='1'
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where id = #{id}
</delete>
<delete id="deleteEmisWaybillByIds" parameterType="String">
update emis_waybill set del_flag='1'
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectUserBindSalesmenList" resultType="map">
SELECT
b.emp_code AS empCode,
b.emp_name AS empName,
b.extra_data AS rate,
b.avatar,
b.phonenumber AS phone,
b.owner_site_code AS ownerSiteCode,
'' AS ownerSiteName,
a.default_flag as defaultFlag
FROM
sys_oms_user_bind_emp a,
sys_user b
WHERE
a.emp_code = b.emp_code
AND a.customer_code = #{customerCode}
<if test="searchValue != null and searchValue != ''">
and b.emp_name like concat('%', #{searchValue}, '%')
</if>
</select>
<select id="queryNewSalesmen" resultType="map">
SELECT
a.emp_code AS empCode,
a.emp_name AS empName,
a.extra_data AS rate,
a.avatar,
a.phonenumber AS phone,
a.owner_site_code AS ownerSiteCode,
b.site_name AS ownerSiteName
FROM
sys_user a,emis_site b
WHERE a.owner_site_code=b.site_code
<if test="searchValue != null and searchValue != ''">
and (a.emp_code=#{searchValue} or a.phonenumber=#{searchValue})
</if>
</select>
<select id="checkEmpIsExist" resultType="int">
select count(1) from sys_user where del_flag='0' and emp_code=#{empCode}
</select>
<select id="checkIsBindSalesmen" resultType="int">
select count(1) from sys_oms_user_bind_emp where customer_code=#{customerCode} and emp_code=#{empCode}
</select>
<delete id="cancelBindSalesmenDefault" parameterType="String">
update sys_oms_user_bind_emp set default_flag='0' where customer_code=#{customerCode}
</delete>
<delete id="setBindSalesmenDefault" parameterType="String">
update sys_oms_user_bind_emp set default_flag='1' where customer_code=#{customerCode} and emp_code=#{empCode}
</delete>
<delete id="deleteBindSalesmen" parameterType="String">
delete from sys_oms_user_bind_emp where customer_code=#{customerCode} and emp_code=#{empCode}
</delete>
<insert id="insertBindSalesmen" parameterType="String" >
insert into sys_oms_user_bind_emp(customer_code,emp_code) values(#{customerCode}, #{empCode})
</insert>
<select id="selectWaybillListBySiteBatchStatus" resultMap="EmisWaybillResult">
select a.id, a.bill_code,a.trans_line_type,
a.product_type,a.start_site_code,a.send_site_code,a.problem_type,a.virtual_remark
from emis_waybill a
where a.del_flag = '0'
<if test="lineCode != null and lineCode != ''">
and a.trans_line_type = #{lineCode}
</if>
and DATE_FORMAT(a.send_date, '%Y-%m-%d') <![CDATA[ >= ]]> '2025-01-01'
and DATE_FORMAT(a.send_date, '%Y-%m-%d') <![CDATA[ <= ]]> DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY),
'%Y-%m-%d')
and ((a.virtual_remark is null or a.virtual_remark = '' or a.virtual_remark = ' ')or a.receive_country !=
'0095')
and a.order_status not in ('0','2')
and not exists (
select 1 from emis_waybill_batch_status b where a.bill_code = b.bill_code and b.site_batch_status = '1' and b.del_flag = '0'
)
and not exists (
select 1 from emis_waybill_problem_info c where a.bill_code = c.bill_code and c.problem_type in (151,170)
and c.del_flag = '0'
)
order by a.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="selectHistoryVirtualWaybill" resultMap="EmisWaybillResult">
select a.id, a.bill_code,a.master_bill_code,a.problem_type, a.remark,a.fee_remark
from emis_waybill a
where a.del_flag = '0' and
a.problem_type in (173,170)
and (master_bill_code is null or master_bill_code='' or master_bill_code=' ')
order by a.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="selectCustEmisWaybillById" parameterType="Long" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
where a.id = #{id}
</select>
<select id="selectCustEmisWaybillByBillCode" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
where a.del_flag='0'
<if test="custNo != null and custNo != ''">
and a.cust_no=#{custNo}
</if>
<if test="billCode != null and billCode != ''">
and a.bill_code=#{billCode}
</if>
limit 1
</select>
</mapper>