|
|
|
@ -3,111 +3,147 @@
|
|
|
|
|
<mapper namespace="com.logpm.report.mapper.ReportDeliverMapeer"> |
|
|
|
|
|
|
|
|
|
<select id="getDeliveryTrainPage" resultType="com.logpm.report.vo.ReportDevilerVO"> |
|
|
|
|
select * from (SELECT d.train_number train_number, |
|
|
|
|
d.task_time task_time, |
|
|
|
|
d.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN d.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN d.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
d.vehicle_name vehicle_name, |
|
|
|
|
d.driver_name driver_name, |
|
|
|
|
d.distribution_company distribution_company, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.delivery_status = 1 THEN |
|
|
|
|
'待配送' |
|
|
|
|
WHEN d.delivery_status = 2 THEN |
|
|
|
|
'配送中' |
|
|
|
|
WHEN d.delivery_status = 3 THEN |
|
|
|
|
'已完成' |
|
|
|
|
ELSE '' |
|
|
|
|
END delivery_status, |
|
|
|
|
d.customers_number customers_number, |
|
|
|
|
d.price, |
|
|
|
|
d.order_number order_number, |
|
|
|
|
rn.num reservation_num, |
|
|
|
|
rsln.num reservation_stock_listNum, |
|
|
|
|
IFNULL(loadScan.loadedNum,0) loaded_num, |
|
|
|
|
IFNULL(loadscaninvn.loadedNum,0) invn_loaded_num, |
|
|
|
|
IFNULL(loadScan.exLoadedNum,0) ex_loaded_num, |
|
|
|
|
IFNULL(loadScan.reNum,0) re_num, |
|
|
|
|
IFNULL(loadscaninvn.reNum,0) invn_re_num, |
|
|
|
|
IFNULL(loadScan.exReNum,0) ex_reNum, |
|
|
|
|
ifnull(ds.dsNum,0)ds_num, |
|
|
|
|
ifnull(ds.ssNum,0)ss_num, |
|
|
|
|
ifnull(d.unloading_team_name,'') unloading_team_name |
|
|
|
|
FROM |
|
|
|
|
logpm_distribution_delivery_list d |
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT |
|
|
|
|
lds.delivery_id, |
|
|
|
|
COALESCE ( sum( ldr.reservation_num ), 0 ) num |
|
|
|
|
FROM |
|
|
|
|
logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
WHERE |
|
|
|
|
ldr.reservation_status != '40' |
|
|
|
|
GROUP BY |
|
|
|
|
lds.delivery_id |
|
|
|
|
) rn ON rn.delivery_id = d.id |
|
|
|
|
select train_number, |
|
|
|
|
task_time, |
|
|
|
|
warehouse_name, |
|
|
|
|
type, |
|
|
|
|
kind, |
|
|
|
|
vehicle_name, |
|
|
|
|
driver_name, |
|
|
|
|
distribution_company, |
|
|
|
|
delivery_status, |
|
|
|
|
customers_number, |
|
|
|
|
price, |
|
|
|
|
order_number, |
|
|
|
|
reservation_num, |
|
|
|
|
reservation_stock_listNum, |
|
|
|
|
loaded_num, |
|
|
|
|
invn_loaded_num, |
|
|
|
|
ex_loaded_num, |
|
|
|
|
re_num, |
|
|
|
|
invn_re_num, |
|
|
|
|
ex_reNum, |
|
|
|
|
ds_num, |
|
|
|
|
ss_num, |
|
|
|
|
unloading_team_name |
|
|
|
|
from (SELECT d.train_number train_number, |
|
|
|
|
d.task_time task_time, |
|
|
|
|
d.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN d.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN d.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
d.vehicle_name vehicle_name, |
|
|
|
|
d.driver_name driver_name, |
|
|
|
|
d.distribution_company distribution_company, |
|
|
|
|
CASE |
|
|
|
|
WHEN d.delivery_status = 1 THEN |
|
|
|
|
'待配送' |
|
|
|
|
WHEN d.delivery_status = 2 THEN |
|
|
|
|
'配送中' |
|
|
|
|
WHEN d.delivery_status = 3 THEN |
|
|
|
|
'已完成' |
|
|
|
|
ELSE '' |
|
|
|
|
END delivery_status, |
|
|
|
|
d.customers_number customers_number, |
|
|
|
|
d.price, |
|
|
|
|
d.order_number order_number, |
|
|
|
|
rn.num reservation_num, |
|
|
|
|
rsln.num reservation_stock_listNum, |
|
|
|
|
IFNULL(loadScan.loadedNum, 0) loaded_num, |
|
|
|
|
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num, |
|
|
|
|
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num, |
|
|
|
|
IFNULL(loadScan.reNum, 0) re_num, |
|
|
|
|
IFNULL(loadscaninvn.reNum, 0) invn_re_num, |
|
|
|
|
IFNULL(loadScan.exReNum, 0) ex_reNum, |
|
|
|
|
ifnull(ds.dsNum, 0) ds_num, |
|
|
|
|
ifnull(ds.ssNum, 0) ss_num, |
|
|
|
|
ifnull(d.unloading_team_name, '') unloading_team_name |
|
|
|
|
FROM logpm_distribution_delivery_list d |
|
|
|
|
LEFT JOIN (SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
WHERE ldr.reservation_status != '40' |
|
|
|
|
GROUP BY lds.delivery_id) rn ON rn.delivery_id = d.id |
|
|
|
|
|
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT |
|
|
|
|
lds.delivery_id, |
|
|
|
|
COALESCE ( sum( ldr.reservation_stock_list_num ), 0 ) num |
|
|
|
|
FROM |
|
|
|
|
logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
GROUP BY |
|
|
|
|
lds.delivery_id |
|
|
|
|
) rsln ON rsln.delivery_id = d.id |
|
|
|
|
LEFT JOIN (SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_stock_list_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
GROUP BY lds.delivery_id) rsln ON rsln.delivery_id = d.id |
|
|
|
|
|
|
|
|
|
left join ( |
|
|
|
|
select |
|
|
|
|
t.delivery_id,SUM(t.loaded_nub) loadedNum,sum(t.received_quantity) reNum,sum(t.is_abnormal_loading) exLoadedNum,sum(t.is_abnormal_signing) exReNum |
|
|
|
|
from logpm_distribution_loadscan t |
|
|
|
|
group by t.delivery_id |
|
|
|
|
) loadScan on loadScan.delivery_id = d.id |
|
|
|
|
left join (select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum, |
|
|
|
|
sum(t.is_abnormal_loading) exLoadedNum, |
|
|
|
|
sum(t.is_abnormal_signing) exReNum |
|
|
|
|
from logpm_distribution_loadscan t |
|
|
|
|
group by t.delivery_id) loadScan on loadScan.delivery_id = d.id |
|
|
|
|
|
|
|
|
|
left join ( |
|
|
|
|
select |
|
|
|
|
t.delivery_id,SUM(t.loaded_nub) loadedNum,sum(t.received_quantity) reNum |
|
|
|
|
from logpm_distribution_loadscaninvn t |
|
|
|
|
group by t.delivery_id |
|
|
|
|
) loadscaninvn on loadscaninvn.delivery_id = d.id |
|
|
|
|
left join (select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum |
|
|
|
|
from logpm_distribution_loadscaninvn t |
|
|
|
|
group by t.delivery_id) loadscaninvn on loadscaninvn.delivery_id = d.id |
|
|
|
|
|
|
|
|
|
left join ( |
|
|
|
|
select |
|
|
|
|
t.delivery_id, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN t.driver_signing = 2 THEN |
|
|
|
|
1 |
|
|
|
|
ELSE |
|
|
|
|
0 |
|
|
|
|
END) dsNum, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN t.signing_status = 2 THEN |
|
|
|
|
1 |
|
|
|
|
ELSE |
|
|
|
|
0 |
|
|
|
|
END) ssNum |
|
|
|
|
from logpm_distribution_signfor t |
|
|
|
|
group by t.delivery_id |
|
|
|
|
) ds on ds.delivery_id = d.id) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
left join (select t.delivery_id, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN t.driver_signing = 2 THEN |
|
|
|
|
1 |
|
|
|
|
ELSE |
|
|
|
|
0 |
|
|
|
|
END) dsNum, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN t.signing_status = 2 THEN |
|
|
|
|
1 |
|
|
|
|
ELSE |
|
|
|
|
0 |
|
|
|
|
END) ssNum |
|
|
|
|
from logpm_distribution_signfor t |
|
|
|
|
group by t.delivery_id) ds on ds.delivery_id = d.id) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
</select> |
|
|
|
|
<select id="getCustomerPage" resultType="com.logpm.report.vo.ReportCustomerVO"> |
|
|
|
|
select * |
|
|
|
|
select train_number, |
|
|
|
|
reservation_code, |
|
|
|
|
stock_article_id, |
|
|
|
|
task_time, |
|
|
|
|
warehouse_name, |
|
|
|
|
receiving_unit, |
|
|
|
|
mall_name, |
|
|
|
|
consignee, |
|
|
|
|
delivery_phone, |
|
|
|
|
delivery_address, |
|
|
|
|
type, |
|
|
|
|
kind, |
|
|
|
|
vehicle_name, |
|
|
|
|
driver_name, |
|
|
|
|
distribution_company, |
|
|
|
|
delivery_status, |
|
|
|
|
order_number, |
|
|
|
|
reservation_num, |
|
|
|
|
reservation_stock_sist_num, |
|
|
|
|
loaded_num, |
|
|
|
|
invn_loaded_num, |
|
|
|
|
ex_loaded_num, |
|
|
|
|
re_num, |
|
|
|
|
invn_re_num, |
|
|
|
|
ex_re_num, |
|
|
|
|
sjsigning_time, |
|
|
|
|
signee_name, |
|
|
|
|
signing_time, |
|
|
|
|
examine_user_name |
|
|
|
|
from (select lddl.train_number train_number, |
|
|
|
|
obj.reservation_code reservation_code, |
|
|
|
|
obj.stock_article_id stock_article_id, |
|
|
|
@ -160,270 +196,344 @@
|
|
|
|
|
from logpm_distribution_reservation obj |
|
|
|
|
left join logpm_distribution_signfor lds on lds.reservation_id = obj.id |
|
|
|
|
left join logpm_distribution_delivery_list lddl on lds.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
WHERE ldr.reservation_status != '40' |
|
|
|
|
GROUP BY |
|
|
|
|
lds.delivery_id |
|
|
|
|
) rn ON rn.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN (SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
WHERE ldr.reservation_status != '40' |
|
|
|
|
GROUP BY lds.delivery_id) rn ON rn.delivery_id = lddl.id |
|
|
|
|
|
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_stock_list_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
GROUP BY lds.delivery_id |
|
|
|
|
) rsln ON rsln.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN (SELECT lds.delivery_id, |
|
|
|
|
COALESCE(sum(ldr.reservation_stock_list_num), 0) num |
|
|
|
|
FROM logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
|
|
|
|
GROUP BY lds.delivery_id) rsln ON rsln.delivery_id = lddl.id |
|
|
|
|
|
|
|
|
|
left join ( |
|
|
|
|
select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum, |
|
|
|
|
sum(t.is_abnormal_loading) exLoadedNum, |
|
|
|
|
sum(t.is_abnormal_signing) exReNum |
|
|
|
|
from logpm_distribution_loadscan t |
|
|
|
|
group by t.delivery_id |
|
|
|
|
) loadScan on loadScan.delivery_id = lddl.id |
|
|
|
|
left join (select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum, |
|
|
|
|
sum(t.is_abnormal_loading) exLoadedNum, |
|
|
|
|
sum(t.is_abnormal_signing) exReNum |
|
|
|
|
from logpm_distribution_loadscan t |
|
|
|
|
group by t.delivery_id) loadScan on loadScan.delivery_id = lddl.id |
|
|
|
|
|
|
|
|
|
left join ( |
|
|
|
|
select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum |
|
|
|
|
from logpm_distribution_loadscaninvn t |
|
|
|
|
group by t.delivery_id |
|
|
|
|
) loadscaninvn on loadscaninvn.delivery_id = lddl.id |
|
|
|
|
)t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
left join (select t.delivery_id, |
|
|
|
|
SUM(t.loaded_nub) loadedNum, |
|
|
|
|
sum(t.received_quantity) reNum |
|
|
|
|
from logpm_distribution_loadscaninvn t |
|
|
|
|
group by t.delivery_id) loadscaninvn on loadscaninvn.delivery_id = lddl.id) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
</select> |
|
|
|
|
<select id="getDetailsPage" resultType="com.logpm.report.vo.ReportDetailVO"> |
|
|
|
|
select * |
|
|
|
|
select |
|
|
|
|
id, |
|
|
|
|
train_number, |
|
|
|
|
reservation_code, |
|
|
|
|
task_time, |
|
|
|
|
warehouse_name, |
|
|
|
|
type, |
|
|
|
|
kind, |
|
|
|
|
vehicle_name, |
|
|
|
|
driver_name, |
|
|
|
|
distribution_company, |
|
|
|
|
dr_consignee, |
|
|
|
|
delivery_phone, |
|
|
|
|
delivery_address, |
|
|
|
|
consignee, |
|
|
|
|
consignee_name, |
|
|
|
|
consignee_mobile, |
|
|
|
|
waybill_no, |
|
|
|
|
stock_article_id, |
|
|
|
|
order_package_code, |
|
|
|
|
customer_train, |
|
|
|
|
conditions, |
|
|
|
|
firsts, |
|
|
|
|
decond, |
|
|
|
|
third_product, |
|
|
|
|
material_code, |
|
|
|
|
material_name, |
|
|
|
|
start_war, |
|
|
|
|
start_war_in_time, |
|
|
|
|
start_war_out_time, |
|
|
|
|
warehouse_entry_time_end, |
|
|
|
|
unload_time, |
|
|
|
|
un_administrators_name, |
|
|
|
|
sjsigning_time, |
|
|
|
|
lds_signee_name, |
|
|
|
|
signing_status, |
|
|
|
|
signing_time, |
|
|
|
|
examine_user_name, |
|
|
|
|
abnormal_signing, |
|
|
|
|
abnormal_loading, |
|
|
|
|
auditing_status, |
|
|
|
|
auditing_user, |
|
|
|
|
auditing_time |
|
|
|
|
from ( |
|
|
|
|
SELECT drp.reservation_id id, |
|
|
|
|
lddl.train_number train_number, |
|
|
|
|
obj.reservation_code reservation_code, |
|
|
|
|
lddl.task_time task_time, |
|
|
|
|
lddl.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN lddl.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN lddl.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
lddl.vehicle_name vehicle_name, |
|
|
|
|
lddl.driver_name driver_name, |
|
|
|
|
lddl.distribution_company distribution_company, |
|
|
|
|
obj.consignee dr_consignee, |
|
|
|
|
obj.delivery_phone delivery_phone, |
|
|
|
|
obj.delivery_address delivery_address, |
|
|
|
|
wi.consignee, |
|
|
|
|
wi.consignee_name consignee_name, |
|
|
|
|
wi.consignee_mobile consignee_mobile, |
|
|
|
|
wi.waybill_no waybill_no, |
|
|
|
|
obj.stock_article_id stock_article_id, |
|
|
|
|
dpl.order_package_code order_package_code, |
|
|
|
|
wi.customer_train customer_train, |
|
|
|
|
CASE |
|
|
|
|
SELECT drp.reservation_id id, |
|
|
|
|
lddl.train_number train_number, |
|
|
|
|
obj.reservation_code reservation_code, |
|
|
|
|
lddl.task_time task_time, |
|
|
|
|
lddl.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN lddl.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN lddl.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
lddl.vehicle_name vehicle_name, |
|
|
|
|
lddl.driver_name driver_name, |
|
|
|
|
lddl.distribution_company distribution_company, |
|
|
|
|
obj.consignee dr_consignee, |
|
|
|
|
obj.delivery_phone delivery_phone, |
|
|
|
|
obj.delivery_address delivery_address, |
|
|
|
|
wi.consignee, |
|
|
|
|
wi.consignee_name consignee_name, |
|
|
|
|
wi.consignee_mobile consignee_mobile, |
|
|
|
|
wi.waybill_no waybill_no, |
|
|
|
|
obj.stock_article_id stock_article_id, |
|
|
|
|
dpl.order_package_code order_package_code, |
|
|
|
|
wi.customer_train customer_train, |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN dpl.conditions = 1 THEN |
|
|
|
|
'定制品' |
|
|
|
|
WHEN dpl.conditions = 2 THEN |
|
|
|
|
'库存品' |
|
|
|
|
ELSE '零担' |
|
|
|
|
END conditions, |
|
|
|
|
dpl.firsts, |
|
|
|
|
dpl.SECOND decond, |
|
|
|
|
dpl.third_product third_product, |
|
|
|
|
dpl.material_code material_code, |
|
|
|
|
dpl.material_name material_name, |
|
|
|
|
'' start_war, |
|
|
|
|
'' start_war_in_time, |
|
|
|
|
'' start_war_out_time, |
|
|
|
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
|
|
|
|
ldl.unload_time unload_time, |
|
|
|
|
ldl.un_administrators_name un_administrators_name, |
|
|
|
|
WHEN dpl.conditions = 1 THEN |
|
|
|
|
'定制品' |
|
|
|
|
WHEN dpl.conditions = 2 THEN |
|
|
|
|
'库存品' |
|
|
|
|
ELSE '零担' |
|
|
|
|
END conditions, |
|
|
|
|
dpl.firsts, |
|
|
|
|
dpl.SECOND decond, |
|
|
|
|
dpl.third_product third_product, |
|
|
|
|
dpl.material_code material_code, |
|
|
|
|
dpl.material_name material_name, |
|
|
|
|
'' start_war, |
|
|
|
|
'' start_war_in_time, |
|
|
|
|
'' start_war_out_time, |
|
|
|
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
|
|
|
|
ldl.unload_time unload_time, |
|
|
|
|
ldl.un_administrators_name un_administrators_name, |
|
|
|
|
|
|
|
|
|
lds.sjsigning_time sjsigning_time, |
|
|
|
|
lds.signee_name lds_signee_name, |
|
|
|
|
CASE |
|
|
|
|
lds.sjsigning_time sjsigning_time, |
|
|
|
|
lds.signee_name lds_signee_name, |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'未签收' |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'签收' |
|
|
|
|
ELSE '' |
|
|
|
|
END signing_status, |
|
|
|
|
lds.signing_time signing_time, |
|
|
|
|
lds.examine_user_name examine_user_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'未签收' |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'签收' |
|
|
|
|
ELSE '' |
|
|
|
|
END signing_status, |
|
|
|
|
lds.signing_time signing_time, |
|
|
|
|
lds.examine_user_name examine_user_name, |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN ldl.is_abnormal_signing = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_signing, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_signing = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_signing, |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN ldl.is_abnormal_loading = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_loading, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_loading = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_loading, |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN ldla.auditing_status = 3 THEN |
|
|
|
|
'异常' |
|
|
|
|
WHEN ldla.auditing_status = 1 THEN |
|
|
|
|
'未审核' |
|
|
|
|
WHEN ldla.auditing_status = 2 THEN |
|
|
|
|
'已审核' |
|
|
|
|
ELSE '' |
|
|
|
|
END auditing_status, |
|
|
|
|
ldla.auditing_user auditing_user, |
|
|
|
|
ldla.auditing_time auditing_time |
|
|
|
|
FROM logpm_distribution_reservation_package drp |
|
|
|
|
LEFT JOIN logpm_distribution_parcel_list dpl |
|
|
|
|
ON dpl.order_package_code = drp.packet_bar_code AND dpl.is_deleted = 0 |
|
|
|
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl |
|
|
|
|
ON ldl.order_package_code = dpl.order_package_code |
|
|
|
|
AND ldl.type = 2 |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
|
|
|
|
ON ldla.package_code = dpl.order_package_code |
|
|
|
|
) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
|
|
|
|
and |
|
|
|
|
</if> |
|
|
|
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
|
|
|
|
where |
|
|
|
|
</if> |
|
|
|
|
EXISTS( |
|
|
|
|
SELECT obj.id |
|
|
|
|
FROM logpm_distribution_reservation obj |
|
|
|
|
WHERE obj.id = t.id) |
|
|
|
|
WHEN ldla.auditing_status = 3 THEN |
|
|
|
|
'异常' |
|
|
|
|
WHEN ldla.auditing_status = 1 THEN |
|
|
|
|
'未审核' |
|
|
|
|
WHEN ldla.auditing_status = 2 THEN |
|
|
|
|
'已审核' |
|
|
|
|
ELSE '' |
|
|
|
|
END auditing_status, |
|
|
|
|
ldla.auditing_user auditing_user, |
|
|
|
|
ldla.auditing_time auditing_time |
|
|
|
|
FROM logpm_distribution_reservation_package drp |
|
|
|
|
LEFT JOIN logpm_distribution_parcel_list dpl |
|
|
|
|
ON dpl.order_package_code = drp.packet_bar_code AND dpl.is_deleted = 0 |
|
|
|
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl |
|
|
|
|
ON ldl.order_package_code = dpl.order_package_code |
|
|
|
|
AND ldl.type = 2 |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
|
|
|
|
ON ldla.package_code = dpl.order_package_code |
|
|
|
|
) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
|
|
|
|
and |
|
|
|
|
</if> |
|
|
|
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
|
|
|
|
where |
|
|
|
|
</if> |
|
|
|
|
EXISTS( |
|
|
|
|
SELECT obj.id |
|
|
|
|
FROM logpm_distribution_reservation obj |
|
|
|
|
WHERE obj.id = t.id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
|
|
select * |
|
|
|
|
from (SELECT drp.reservation_id id, |
|
|
|
|
lddl.train_number train_number, |
|
|
|
|
obj.reservation_code reservation_code, |
|
|
|
|
lddl.task_time task_time, |
|
|
|
|
lddl.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN lddl.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN lddl.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
lddl.vehicle_name vehicle_name, |
|
|
|
|
lddl.driver_name driver_name, |
|
|
|
|
lddl.distribution_company distribution_company, |
|
|
|
|
obj.consignee dr_consignee, |
|
|
|
|
obj.delivery_phone delivery_phone, |
|
|
|
|
obj.delivery_address delivery_address, |
|
|
|
|
wi.consignee, |
|
|
|
|
wi.consignee_name consignee_name, |
|
|
|
|
wi.consignee_mobile consignee_mobile, |
|
|
|
|
wi.waybill_no waybill_no, |
|
|
|
|
obj.stock_article_id stock_article_id, |
|
|
|
|
dpl.order_package_code order_package_code, |
|
|
|
|
wi.customer_train customer_train, |
|
|
|
|
CASE |
|
|
|
|
WHEN dpl.conditions = 1 THEN |
|
|
|
|
'定制品' |
|
|
|
|
WHEN dpl.conditions = 2 THEN |
|
|
|
|
'库存品' |
|
|
|
|
ELSE '零担' |
|
|
|
|
END conditions, |
|
|
|
|
dpl.firsts, |
|
|
|
|
dpl.SECOND decond, |
|
|
|
|
dpl.third_product third_product, |
|
|
|
|
dpl.material_code material_code, |
|
|
|
|
dpl.material_name material_name, |
|
|
|
|
'' start_war, |
|
|
|
|
'' start_war_in_time, |
|
|
|
|
'' start_war_out_time, |
|
|
|
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
|
|
|
|
ldl.unload_time unload_time, |
|
|
|
|
ldl.un_administrators_name un_administrators_name, |
|
|
|
|
lds.sjsigning_time sjsigning_time, |
|
|
|
|
lds.signee_name lds_signee_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'未签收' |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'签收' |
|
|
|
|
ELSE '' |
|
|
|
|
END signing_status, |
|
|
|
|
lds.signing_time signing_time, |
|
|
|
|
lds.examine_user_name examine_user_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_signing = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_signing, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_loading = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_loading, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldla.auditing_status = 3 THEN |
|
|
|
|
'异常' |
|
|
|
|
WHEN ldla.auditing_status = 1 THEN |
|
|
|
|
'未审核' |
|
|
|
|
WHEN ldla.auditing_status = 2 THEN |
|
|
|
|
'已审核' |
|
|
|
|
ELSE '' |
|
|
|
|
END auditing_status, |
|
|
|
|
ldla.auditing_user auditing_user, |
|
|
|
|
ldla.auditing_time auditing_time |
|
|
|
|
FROM logpm_distribution_reservation_zero_package drp |
|
|
|
|
LEFT JOIN logpm_distribution_parcel_list dpl |
|
|
|
|
ON dpl.id = drp.parcel_list_id |
|
|
|
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl |
|
|
|
|
ON ldl.order_package_code = dpl.order_package_code |
|
|
|
|
AND ldl.type = 2 |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
|
|
|
|
ON ldla.package_code = dpl.order_package_code |
|
|
|
|
) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
|
|
|
|
and |
|
|
|
|
</if> |
|
|
|
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
|
|
|
|
where |
|
|
|
|
</if> |
|
|
|
|
EXISTS( |
|
|
|
|
SELECT obj.id |
|
|
|
|
FROM logpm_distribution_reservation obj |
|
|
|
|
WHERE obj.id = t.id) |
|
|
|
|
select |
|
|
|
|
id, |
|
|
|
|
train_number, |
|
|
|
|
reservation_code, |
|
|
|
|
task_time, |
|
|
|
|
warehouse_name, |
|
|
|
|
type, |
|
|
|
|
kind, |
|
|
|
|
vehicle_name, |
|
|
|
|
driver_name, |
|
|
|
|
distribution_company, |
|
|
|
|
dr_consignee, |
|
|
|
|
delivery_phone, |
|
|
|
|
delivery_address, |
|
|
|
|
consignee, |
|
|
|
|
consignee_name, |
|
|
|
|
consignee_mobile, |
|
|
|
|
waybill_no, |
|
|
|
|
stock_article_id, |
|
|
|
|
order_package_code, |
|
|
|
|
customer_train, |
|
|
|
|
conditions, |
|
|
|
|
firsts, |
|
|
|
|
decond, |
|
|
|
|
third_product, |
|
|
|
|
material_code, |
|
|
|
|
material_name, |
|
|
|
|
start_war, |
|
|
|
|
start_war_in_time, |
|
|
|
|
start_war_out_time, |
|
|
|
|
warehouse_entry_time_end, |
|
|
|
|
unload_time, |
|
|
|
|
un_administrators_name, |
|
|
|
|
sjsigning_time, |
|
|
|
|
lds_signee_name, |
|
|
|
|
signing_status, |
|
|
|
|
signing_time, |
|
|
|
|
examine_user_name, |
|
|
|
|
abnormal_signing, |
|
|
|
|
abnormal_loading, |
|
|
|
|
auditing_status, |
|
|
|
|
auditing_user, |
|
|
|
|
auditing_time |
|
|
|
|
from (SELECT drp.reservation_id id, |
|
|
|
|
lddl.train_number train_number, |
|
|
|
|
obj.reservation_code reservation_code, |
|
|
|
|
lddl.task_time task_time, |
|
|
|
|
lddl.warehouse_name warehouse_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.type = 1 THEN |
|
|
|
|
'市配' |
|
|
|
|
WHEN lddl.type = 2 THEN |
|
|
|
|
'商配' |
|
|
|
|
ELSE '' |
|
|
|
|
END type, |
|
|
|
|
CASE |
|
|
|
|
WHEN lddl.kind = 1 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
WHEN lddl.kind = 2 THEN |
|
|
|
|
'自主配送' |
|
|
|
|
ELSE '' |
|
|
|
|
END kind, |
|
|
|
|
lddl.vehicle_name vehicle_name, |
|
|
|
|
lddl.driver_name driver_name, |
|
|
|
|
lddl.distribution_company distribution_company, |
|
|
|
|
obj.consignee dr_consignee, |
|
|
|
|
obj.delivery_phone delivery_phone, |
|
|
|
|
obj.delivery_address delivery_address, |
|
|
|
|
wi.consignee, |
|
|
|
|
wi.consignee_name consignee_name, |
|
|
|
|
wi.consignee_mobile consignee_mobile, |
|
|
|
|
wi.waybill_no waybill_no, |
|
|
|
|
obj.stock_article_id stock_article_id, |
|
|
|
|
dpl.order_package_code order_package_code, |
|
|
|
|
wi.customer_train customer_train, |
|
|
|
|
CASE |
|
|
|
|
WHEN dpl.conditions = 1 THEN |
|
|
|
|
'定制品' |
|
|
|
|
WHEN dpl.conditions = 2 THEN |
|
|
|
|
'库存品' |
|
|
|
|
ELSE '零担' |
|
|
|
|
END conditions, |
|
|
|
|
dpl.firsts, |
|
|
|
|
dpl.SECOND decond, |
|
|
|
|
dpl.third_product third_product, |
|
|
|
|
dpl.material_code material_code, |
|
|
|
|
dpl.material_name material_name, |
|
|
|
|
'' start_war, |
|
|
|
|
'' start_war_in_time, |
|
|
|
|
'' start_war_out_time, |
|
|
|
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
|
|
|
|
ldl.unload_time unload_time, |
|
|
|
|
ldl.un_administrators_name un_administrators_name, |
|
|
|
|
lds.sjsigning_time sjsigning_time, |
|
|
|
|
lds.signee_name lds_signee_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'未签收' |
|
|
|
|
WHEN lds.signing_status = 1 THEN |
|
|
|
|
'签收' |
|
|
|
|
ELSE '' |
|
|
|
|
END signing_status, |
|
|
|
|
lds.signing_time signing_time, |
|
|
|
|
lds.examine_user_name examine_user_name, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_signing = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_signing, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldl.is_abnormal_loading = 1 THEN |
|
|
|
|
'是' |
|
|
|
|
ELSE '否' |
|
|
|
|
END abnormal_loading, |
|
|
|
|
CASE |
|
|
|
|
WHEN ldla.auditing_status = 3 THEN |
|
|
|
|
'异常' |
|
|
|
|
WHEN ldla.auditing_status = 1 THEN |
|
|
|
|
'未审核' |
|
|
|
|
WHEN ldla.auditing_status = 2 THEN |
|
|
|
|
'已审核' |
|
|
|
|
ELSE '' |
|
|
|
|
END auditing_status, |
|
|
|
|
ldla.auditing_user auditing_user, |
|
|
|
|
ldla.auditing_time auditing_time |
|
|
|
|
FROM logpm_distribution_reservation_zero_package drp |
|
|
|
|
LEFT JOIN logpm_distribution_parcel_list dpl |
|
|
|
|
ON dpl.id = drp.parcel_list_id |
|
|
|
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
|
|
|
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl |
|
|
|
|
ON ldl.order_package_code = dpl.order_package_code |
|
|
|
|
AND ldl.type = 2 |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
|
|
|
|
ON ldla.package_code = dpl.order_package_code |
|
|
|
|
) t |
|
|
|
|
${ew.customSqlSegment} |
|
|
|
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
|
|
|
|
and |
|
|
|
|
</if> |
|
|
|
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
|
|
|
|
where |
|
|
|
|
</if> |
|
|
|
|
EXISTS( |
|
|
|
|
SELECT obj.id |
|
|
|
|
FROM logpm_distribution_reservation obj |
|
|
|
|
WHERE obj.id = t.id) |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
</mapper> |
|
|
|
|