select id, order_sn, cust_order_id, bill_code, bill_code_sub, order_status, waybill_status, order_type, order_date, user_id, customer_code, customer_name, open_id, receive_name, receive_company, receive_mobile, receive_tel, receive_country, receive_province, receive_city, receive_county, receive_town, receive_address, receive_postcode, receive_pcd, send_name, send_company, send_mobile, send_tel, send_country, send_province, send_city, send_county, send_town, send_address, send_postcode, send_pcd, payment_type, calc_fee_type, cust_no, cust_name, trans_line_type, product_type, time_type, meter_type, carry_type, customs_clear, customs_eclaration, estimate_date, pack_type, dispatch_method, pickup_method, pick_start_date, pick_finish_date, pick_fail_reason, into_warehouse_code, into_warehouse_name, into_warehouse_address, into_warehouse_contact, into_warehouse_phone, into_warehouse_bill_code, warehouse_in_no, customer_delivery_begin_time, customer_delivery_end_time, goods_type, goods_info, goods_pics, bl_prepare_in_freight, prepare_in_est_fee, prepare_in_real_fee, prepare_in_express, prepare_in_bill_code, prepare_in_remark, prepare_in_supplier, total_weight, total_volume, parcel_qty, bill_weight, volume_weight, currency, settlement_weight, scan_weight, fee_weight, freight, real_payment_type, real_fee, bl_special_quote, bl_over_long, bl_bill, bl_bill_text, bl_over_weight, over_weight_number, fee_remark, third_code, real_value, bl_insure, insure_value, insure_value_currency, insure_fee_currency, insure_fee, insure_remark, insure_site_code, insure_date, bl_print, print_man_code, print_site, print_date, print_count, bl_disp_fd, transfer_code, transfer_billcode, disp_fd_date, disp_fd_reason, current_site_code, next_site_code, last_site_code, register_site_code, register_date, register_man_code, take_piece_employee_code, send_site_code, send_center_code, send_date, dispatch_man_code, dispatch_date, dispatch_site_code, produce_bill_date, produce_bill_site_code, produce_bill_man_code, destination_code, destination_province, destination_city, destination_county, dispatch_underling_site_code, destination_center_code, market_man_code, payee, salesmen, operate_employee_code, bl_is_question, problem_type, problem_cause, problem_delay_days, bl_message, bl_accept_message, bl_gen_subbill, bl_sign, sign_man, sign_man_code, sign_site_code, sign_date, bill_pic_send_rmk, bill_pic_dispatch_rmk, timezone_offset, payment_status, payment_date, payment_remark, order_remark, data_from, bl_special_goods, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_waybill
select
a.id,a.order_sn, a.cust_order_id, a.bill_code, a.bill_code_sub, 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.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.remark, a.del_flag, a.create_by,
a.create_time, a.update_by, a.update_time, a.create_site, a.update_site,
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,
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
from emis_waybill a
left join emis_country b on a.receive_country=b.code
left join emis_country c on a.send_country=c.code
left join emis_region d on a.receive_province=d.region_code
left join emis_region e on a.receive_city=e.region_code
left join emis_region f on a.receive_county=f.region_code
left join emis_region g on a.send_province=g.region_code
left join emis_region h on a.send_city=h.region_code
left join emis_region i on a.send_county=i.region_code
left join emis_trans_product j on a.product_type=j.prod_code
left join emis_trans_line k on a.trans_line_type=k.line_code
left join emis_site l on a.send_site_code=l.site_code
left join emis_site m on a.dispatch_underling_site_code=m.site_code
left join emis_destination n on a.destination_code=n.dest_code
left join emis_site o on a.dispatch_site_code=o.site_code
left join sys_user p on a.dispatch_man_code=p.emp_code
left join emis_site q on a.print_site=q.site_code
left join sys_user r on a.print_man_code=r.emp_code
left join sys_user s on a.take_piece_employee_code=s.emp_code
left join sys_user t on a.operate_employee_code=t.emp_code
left join emis_site u on a.register_site_code=u.site_code
left join sys_user v on a.register_man_code=v.emp_code
left join emis_site w on a.current_site_code=w.site_code
left join emis_site x on a.next_site_code=x.site_code
left join emis_site y on a.last_site_code=y.site_code
left join emis_problem_type z on a.problem_type=z.id
insert into emis_waybill
id,
order_sn,
cust_order_id,
bill_code,
bill_code_sub,
order_status,
waybill_status,
order_type,
order_date,
user_id,
customer_code,
customer_name,
open_id,
receive_name,
receive_company,
receive_mobile,
receive_tel,
receive_country,
receive_province,
receive_city,
receive_county,
receive_town,
receive_address,
receive_postcode,
receive_pcd,
send_name,
send_company,
send_mobile,
send_tel,
send_country,
send_province,
send_city,
send_county,
send_town,
send_address,
send_postcode,
send_pcd,
payment_type,
calc_fee_type,
cust_no,
cust_name,
trans_line_type,
product_type,
time_type,
meter_type,
carry_type,
customs_clear,
customs_eclaration,
estimate_date,
pack_type,
dispatch_method,
pickup_method,
pick_start_date,
pick_finish_date,
pick_fail_reason,
into_warehouse_code,
into_warehouse_name,
into_warehouse_address,
into_warehouse_contact,
into_warehouse_phone,
into_warehouse_bill_code,
warehouse_in_no,
customer_delivery_begin_time,
customer_delivery_end_time,
goods_type,
goods_info,
goods_pics,
bl_prepare_in_freight,
prepare_in_est_fee,
prepare_in_real_fee,
prepare_in_express,
prepare_in_bill_code,
prepare_in_remark,
prepare_in_supplier,
total_weight,
total_volume,
parcel_qty,
bill_weight,
volume_weight,
currency,
settlement_weight,
scan_weight,
fee_weight,
freight,
real_payment_type,
real_fee,
bl_special_quote,
bl_over_long,
bl_bill,
bl_bill_text,
bl_over_weight,
over_weight_number,
fee_remark,
third_code,
real_value,
bl_insure,
insure_value,
insure_value_currency,
insure_fee_currency,
insure_fee,
insure_remark,
insure_site_code,
insure_date,
bl_print,
print_man_code,
print_site,
print_date,
print_count,
bl_disp_fd,
transfer_code,
transfer_billcode,
disp_fd_date,
disp_fd_reason,
current_site_code,
next_site_code,
last_site_code,
register_site_code,
register_date,
register_man_code,
take_piece_employee_code,
send_site_code,
send_center_code,
send_date,
dispatch_man_code,
dispatch_date,
dispatch_site_code,
produce_bill_date,
produce_bill_site_code,
produce_bill_man_code,
destination_code,
destination_province,
destination_city,
destination_county,
dispatch_underling_site_code,
destination_center_code,
market_man_code,
payee,
salesmen,
operate_employee_code,
bl_is_question,
problem_type,
problem_cause,
problem_delay_days,
bl_message,
bl_accept_message,
bl_gen_subbill,
bl_sign,
sign_man,
sign_man_code,
sign_site_code,
sign_date,
bill_pic_send_rmk,
bill_pic_dispatch_rmk,
timezone_offset,
payment_status,
payment_date,
payment_remark,
order_remark,
data_from,
bl_special_goods,
remark,
del_flag,
create_by,
create_time,
update_by,
update_time,
create_site,
update_site,
#{id},
#{orderSn},
#{custOrderId},
#{billCode},
#{billCodeSub},
#{orderStatus},
#{waybillStatus},
#{orderType},
#{orderDate},
#{userId},
#{customerCode},
#{customerName},
#{openId},
#{receiveName},
#{receiveCompany},
#{receiveMobile},
#{receiveTel},
#{receiveCountry},
#{receiveProvince},
#{receiveCity},
#{receiveCounty},
#{receiveTown},
#{receiveAddress},
#{receivePostcode},
#{receivePcd},
#{sendName},
#{sendCompany},
#{sendMobile},
#{sendTel},
#{sendCountry},
#{sendProvince},
#{sendCity},
#{sendCounty},
#{sendTown},
#{sendAddress},
#{sendPostcode},
#{sendPcd},
#{paymentType},
#{calcFeeType},
#{custNo},
#{custName},
#{transLineType},
#{productType},
#{timeType},
#{meterType},
#{carryType},
#{customsClear},
#{customsEclaration},
#{estimateDate},
#{packType},
#{dispatchMethod},
#{pickupMethod},
#{pickStartDate},
#{pickFinishDate},
#{pickFailReason},
#{intoWarehouseCode},
#{intoWarehouseName},
#{intoWarehouseAddress},
#{intoWarehouseContact},
#{intoWarehousePhone},
#{intoWarehouseBillCode},
#{warehouseInNo},
#{customerDeliveryBeginTime},
#{customerDeliveryEndTime},
#{goodsType},
#{goodsInfo},
#{goodsPics},
#{blPrepareInFreight},
#{prepareInEstFee},
#{prepareInRealFee},
#{prepareInExpress},
#{prepareInBillCode},
#{prepareInRemark},
#{prepareInSupplier},
#{totalWeight},
#{totalVolume},
#{parcelQty},
#{billWeight},
#{volumeWeight},
#{currency},
#{settlementWeight},
#{scanWeight},
#{feeWeight},
#{freight},
#{realPaymentType},
#{realFee},
#{blSpecialQuote},
#{blOverLong},
#{blBill},
#{blBillText},
#{blOverWeight},
#{overWeightNumber},
#{feeRemark},
#{thirdCode},
#{realValue},
#{blInsure},
#{insureValue},
#{insureValueCurrency},
#{insureFeeCurrency},
#{insureFee},
#{insureRemark},
#{insureSiteCode},
#{insureDate},
#{blPrint},
#{printManCode},
#{printSite},
#{printDate},
#{printCount},
#{blDispFd},
#{transferCode},
#{transferBillcode},
#{dispFdDate},
#{dispFdReason},
#{currentSiteCode},
#{nextSiteCode},
#{lastSiteCode},
#{registerSiteCode},
#{registerDate},
#{registerManCode},
#{takePieceEmployeeCode},
#{sendSiteCode},
#{sendCenterCode},
#{sendDate},
#{dispatchManCode},
#{dispatchDate},
#{dispatchSiteCode},
#{produceBillDate},
#{produceBillSiteCode},
#{produceBillManCode},
#{destinationCode},
#{destinationProvince},
#{destinationCity},
#{destinationCounty},
#{dispatchUnderlingSiteCode},
#{destinationCenterCode},
#{marketManCode},
#{payee},
#{salesmen},
#{operateEmployeeCode},
#{blIsQuestion},
#{problemType},
#{problemCause},
#{problemDelayDays},
#{blMessage},
#{blAcceptMessage},
#{blGenSubbill},
#{blSign},
#{signMan},
#{signManCode},
#{signSiteCode},
#{signDate},
#{billPicSendRmk},
#{billPicDispatchRmk},
#{timezoneOffset},
#{paymentStatus},
#{paymentDate},
#{paymentRemark},
#{orderRemark},
#{dataFrom},
#{blSpecialGoods},
#{remark},
#{delFlag},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{createSite},
#{updateSite},
update emis_waybill
cust_order_id = #{custOrderId},
bill_code_sub = #{billCodeSub},
order_status = #{orderStatus},
waybill_status = #{waybillStatus},
order_type = #{orderType},
order_date = #{orderDate},
user_id = #{userId},
customer_code = #{customerCode},
customer_name = #{customerName},
open_id = #{openId},
receive_name = #{receiveName},
receive_company = #{receiveCompany},
receive_mobile = #{receiveMobile},
receive_tel = #{receiveTel},
receive_country = #{receiveCountry},
receive_province = #{receiveProvince},
receive_city = #{receiveCity},
receive_county = #{receiveCounty},
receive_town = #{receiveTown},
receive_address = #{receiveAddress},
receive_postcode = #{receivePostcode},
receive_pcd = #{receivePcd},
send_name = #{sendName},
send_company = #{sendCompany},
send_mobile = #{sendMobile},
send_tel = #{sendTel},
send_country = #{sendCountry},
send_province = #{sendProvince},
send_city = #{sendCity},
send_county = #{sendCounty},
send_town = #{sendTown},
send_address = #{sendAddress},
send_postcode = #{sendPostcode},
send_pcd = #{sendPcd},
payment_type = #{paymentType},
calc_fee_type = #{calcFeeType},
cust_no = #{custNo},
cust_name = #{custName},
trans_line_type = #{transLineType},
product_type = #{productType},
time_type = #{timeType},
meter_type = #{meterType},
carry_type = #{carryType},
customs_clear = #{customsClear},
customs_eclaration = #{customsEclaration},
estimate_date = #{estimateDate},
pack_type = #{packType},
dispatch_method = #{dispatchMethod},
pickup_method = #{pickupMethod},
pick_start_date = #{pickStartDate},
pick_finish_date = #{pickFinishDate},
pick_fail_reason = #{pickFailReason},
into_warehouse_code = #{intoWarehouseCode},
into_warehouse_name = #{intoWarehouseName},
into_warehouse_address = #{intoWarehouseAddress},
into_warehouse_contact = #{intoWarehouseContact},
into_warehouse_phone = #{intoWarehousePhone},
into_warehouse_bill_code = #{intoWarehouseBillCode},
warehouse_in_no = #{warehouseInNo},
customer_delivery_begin_time = #{customerDeliveryBeginTime},
customer_delivery_end_time = #{customerDeliveryEndTime},
goods_type = #{goodsType},
goods_info = #{goodsInfo},
goods_pics = #{goodsPics},
bl_prepare_in_freight = #{blPrepareInFreight},
prepare_in_est_fee = #{prepareInEstFee},
prepare_in_real_fee = #{prepareInRealFee},
prepare_in_express = #{prepareInExpress},
prepare_in_bill_code = #{prepareInBillCode},
prepare_in_remark = #{prepareInRemark},
prepare_in_supplier = #{prepareInSupplier},
total_weight = #{totalWeight},
total_volume = #{totalVolume},
parcel_qty = #{parcelQty},
bill_weight = #{billWeight},
volume_weight = #{volumeWeight},
currency = #{currency},
settlement_weight = #{settlementWeight},
scan_weight = #{scanWeight},
fee_weight = #{feeWeight},
freight = #{freight},
real_payment_type = #{realPaymentType},
real_fee = #{realFee},
bl_special_quote = #{blSpecialQuote},
bl_over_long = #{blOverLong},
bl_bill = #{blBill},
bl_bill_text = #{blBillText},
bl_over_weight = #{blOverWeight},
over_weight_number = #{overWeightNumber},
fee_remark = #{feeRemark},
third_code = #{thirdCode},
real_value = #{realValue},
bl_insure = #{blInsure},
insure_value = #{insureValue},
insure_value_currency = #{insureValueCurrency},
insure_fee_currency = #{insureFeeCurrency},
insure_fee = #{insureFee},
insure_remark = #{insureRemark},
insure_site_code = #{insureSiteCode},
insure_date = #{insureDate},
bl_print = #{blPrint},
print_man_code = #{printManCode},
print_site = #{printSite},
print_date = #{printDate},
print_count = #{printCount},
bl_disp_fd = #{blDispFd},
transfer_code = #{transferCode},
transfer_billcode = #{transferBillcode},
disp_fd_date = #{dispFdDate},
disp_fd_reason = #{dispFdReason},
current_site_code = #{currentSiteCode},
next_site_code = #{nextSiteCode},
last_site_code = #{lastSiteCode},
register_site_code = #{registerSiteCode},
register_date = #{registerDate},
register_man_code = #{registerManCode},
take_piece_employee_code = #{takePieceEmployeeCode},
send_site_code = #{sendSiteCode},
send_center_code = #{sendCenterCode},
send_date = #{sendDate},
dispatch_man_code = #{dispatchManCode},
dispatch_date = #{dispatchDate},
dispatch_site_code = #{dispatchSiteCode},
produce_bill_date = #{produceBillDate},
produce_bill_site_code = #{produceBillSiteCode},
produce_bill_man_code = #{produceBillManCode},
destination_code = #{destinationCode},
destination_province = #{destinationProvince},
destination_city = #{destinationCity},
destination_county = #{destinationCounty},
dispatch_underling_site_code = #{dispatchUnderlingSiteCode},
destination_center_code = #{destinationCenterCode},
market_man_code = #{marketManCode},
payee = #{payee},
salesmen = #{salesmen},
operate_employee_code = #{operateEmployeeCode},
bl_is_question = #{blIsQuestion},
problem_type = #{problemType},
problem_cause = #{problemCause},
problem_delay_days = #{problemDelayDays},
bl_message = #{blMessage},
bl_accept_message = #{blAcceptMessage},
bl_gen_subbill = #{blGenSubbill},
bl_sign = #{blSign},
sign_man = #{signMan},
sign_man_code = #{signManCode},
sign_site_code = #{signSiteCode},
sign_date = #{signDate},
bill_pic_send_rmk = #{billPicSendRmk},
bill_pic_dispatch_rmk = #{billPicDispatchRmk},
timezone_offset = #{timezoneOffset},
payment_status = #{paymentStatus},
payment_date = #{paymentDate},
payment_remark = #{paymentRemark},
order_remark = #{orderRemark},
data_from = #{dataFrom},
bl_special_goods = #{blSpecialGoods},
remark = #{remark},
del_flag = #{delFlag},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
create_site = #{createSite},
update_site = #{updateSite},
where id = #{id}
update emis_waybill set
bl_print='1',
print_man_code=#{printManCode},
print_site=#{printSite},
print_date=now(),
print_count=print_count+1
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill
set sign_man=#{signMan},
bl_sign = '1',
sign_man_code=#{signManCode},
sign_site_code = #{signSiteCode},
sign_date = #{signDate},
bill_pic_dispatch_rmk = #{billPicDispatchRmk}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill set
dispatch_man_code = #{dispatchManCode},
dispatch_date = #{dispatchDate},
dispatch_site_code = #{dispatchSiteCode}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
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
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill
bl_is_question = '1',
problem_type = #{problemType},
problem_cause = #{problemCause},
problem_delay_days = #{problemDelayDays},
estimate_date = #{estimateDate}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill
bl_disp_fd ='1',
transfer_code = #{transferCode},
transfer_billcode = #{transferBillcode},
disp_fd_date = #{dispFdDate},
disp_fd_reason = #{dispFdReason}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill
current_site_code = #{currentSiteCode},
next_site_code = #{nextSiteCode},
last_site_code = #{lastSiteCode},
update_by = #{updateBy},
update_site = #{updateSite},
where bill_code=#{billCode}
update emis_waybill
waybill_status=#{waybillStatus}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill set order_status=#{orderStatus}
,update_by = #{updateBy}
,update_site = #{updateSite}
where bill_code=#{billCode}
update emis_waybill set order_status=#{orderStatus}
,update_by = #{updateBy}
,update_site = #{updateSite}
where order_sn=#{orderSn}
update emis_waybill set del_flag='1'
,update_by = #{updateBy}
,update_site = #{updateSite}
where id = #{id}
update emis_waybill set del_flag='1
,update_by = #{updateBy}
,update_site = #{updateSite}
where id in
#{id}