|
|
|
@ -1040,54 +1040,63 @@
|
|
|
|
|
</select> |
|
|
|
|
<select id="exportDistributionSignforSigningOwn" resultType="com.logpm.distribution.vo.DistributionSignforVO"> |
|
|
|
|
SELECT DISTINCT |
|
|
|
|
lds.id id, |
|
|
|
|
lds.signee_name signeeName, |
|
|
|
|
ldr.mall_name mallName, |
|
|
|
|
lds.positioning positioning, |
|
|
|
|
lddl.warehouse_name warehouseName, |
|
|
|
|
ldr.stock_article_id stockArticleId, |
|
|
|
|
ldr.store_name storeName, |
|
|
|
|
ldr.consignee consignee, |
|
|
|
|
ldr.delivery_type deliveryType, |
|
|
|
|
lds.delivery_id AS deliveryId, |
|
|
|
|
lds.delivery_time deliveryTime, |
|
|
|
|
lds.signing_time signingTime, |
|
|
|
|
lds.sjsigning_time sjsigningTime, |
|
|
|
|
lds.signing_status signingStatus, |
|
|
|
|
lds.is_have_abnormal_package isHaveAbnormalPackage, |
|
|
|
|
lds.signing_type signingType, |
|
|
|
|
lddl.train_number trainNumber, |
|
|
|
|
lds.received_quantity receivedQuantity, |
|
|
|
|
ldr.delivery_phone deliveryPhone, |
|
|
|
|
(SELECT GROUP_CONCAT(distinct driver_name SEPARATOR ',') from logpm_distribution_loadscan ldl WHERE ldl.reservation_id = lds.reservation_id) deliveryDriverName, |
|
|
|
|
(SELECT GROUP_CONCAT(distinct driver_phone SEPARATOR ',') from logpm_distribution_loadscan ldl WHERE ldl.reservation_id = lds.reservation_id) deliveryDriverPhone, |
|
|
|
|
ldr.delivery_address deliveryAddress, |
|
|
|
|
lds.delivery_sign_pictures deliverySignPictures, |
|
|
|
|
ldr.reservation_num reservationNum, |
|
|
|
|
lds.driver_signing driverSigning, |
|
|
|
|
lds.loaded_number loadedNumber, |
|
|
|
|
lds.create_time createTime, |
|
|
|
|
lds.signing_status signingStatus, |
|
|
|
|
lds.driver_signing driverSigning, |
|
|
|
|
ldr.reservation_num - lds.received_quantity unsigneds, |
|
|
|
|
ldr.reservation_num - lds.loaded_number withoutScanning, |
|
|
|
|
lds.reservation_id reservationId, |
|
|
|
|
( SELECT GROUP_CONCAT(ldsa.order_code) |
|
|
|
|
from logpm_distribution_reservation_stockarticle ldrs |
|
|
|
|
LEFT JOIN logpm_distribution_stock_article ldsa on ldsa.id = ldrs.stock_article_id |
|
|
|
|
where reservation_id = ldr.id |
|
|
|
|
) orderCode |
|
|
|
|
lddl.train_number AS trainNumber, |
|
|
|
|
ldr.reservation_code AS reservationCode, |
|
|
|
|
lddl.driver_name AS driverName, |
|
|
|
|
lddl.vehicle_name AS vehicleName, |
|
|
|
|
lddl.task_time AS taskTime, |
|
|
|
|
lddl.loading_time AS loadingTime, |
|
|
|
|
IF(ldr.reservation_num > 0,GROUP_CONCAT(ldsa.order_code),'') AS orderCode, |
|
|
|
|
lds.signee_name AS signeeName, |
|
|
|
|
ldr.warehouse_id AS warehouseId, |
|
|
|
|
ldr.consignee AS consignee, |
|
|
|
|
ldr.delivery_phone AS deliveryPhone, |
|
|
|
|
ldr.delivery_address AS deliveryAddress, |
|
|
|
|
CASE ldr.delivery_type |
|
|
|
|
WHEN 1 THEN '商配' |
|
|
|
|
WHEN 2 THEN '市配' |
|
|
|
|
WHEN 3 THEN '自提' |
|
|
|
|
END deliveryTypeName, |
|
|
|
|
(ldr.reservation_num + ldr.reservation_stock_list_num ) AS totalNum, |
|
|
|
|
(COUNT(ldl.id) + COUNT(ldll.id) ) AS loadingNum, |
|
|
|
|
lds.received_quantity AS signingNum, |
|
|
|
|
((ldr.reservation_num + ldr.reservation_stock_list_num ) - (COUNT(ldl.id) + COUNT(ldll.id) )) AS unLoadingNum, |
|
|
|
|
((ldr.reservation_num + ldr.reservation_stock_list_num ) - lds.received_quantity) AS unsigneds, |
|
|
|
|
lds.signing_time AS signingTime, |
|
|
|
|
lds.sjsigning_time AS sjsigningTime, |
|
|
|
|
lds.signee_name AS signeeName, |
|
|
|
|
lds.examine_user_name AS examineUserName, |
|
|
|
|
CASE lddl.delivery_status |
|
|
|
|
WHEN 1 THEN '待配送' |
|
|
|
|
WHEN 2 THEN '配送中' |
|
|
|
|
WHEN 3 THEN '已完成' |
|
|
|
|
END deliveryStatusName, |
|
|
|
|
CASE lds.signing_status |
|
|
|
|
WHEN 1 THEN '文员待审核' |
|
|
|
|
WHEN 2 THEN '文员已审核' |
|
|
|
|
END signingStatusName, |
|
|
|
|
IF(lddl.kind = 1,ldds.driver_phone,lddt.driver_phone) AS driverPhone |
|
|
|
|
FROM |
|
|
|
|
logpm_distribution_signfor lds |
|
|
|
|
JOIN logpm_distribution_delivery_list lddl ON lddl.id = lds.delivery_id |
|
|
|
|
JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_reservation_stockarticle ldrs on ldr.id = ldrs.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_stock_article ldsa on ldsa.id = ldrs.stock_article_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan AS ldl ON ldr.id = ldl.reservation_id AND ldl.delivery_id = ldl.delivery_id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscaninvn AS ldll ON ldr.id = ldll.reservation_id AND ldll.delivery_id = ldl.delivery_id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_self AS ldds ON ldds.delivery_id = lddl.id AND ldds.is_master = 2 |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_tripartite AS lddt ON lddt.delivery_id = lddl.id |
|
|
|
|
<where> |
|
|
|
|
lds.is_deleted = 0 |
|
|
|
|
<if test="param.mallName != null and param.mallName!=''"> |
|
|
|
|
and ldr.mall_name like concat('%',#{param.mallName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.ids != null and param.ids!=''"> |
|
|
|
|
and lds.id |
|
|
|
|
<foreach collection="param.ids" item="item" open="in (" close=")" separator=","> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
<if test="param.warehouseIdList != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(param.warehouseIdList)"> |
|
|
|
|
and ldr.warehouse_id in |
|
|
|
|
<foreach collection="param.warehouseIdList" item="item" open="(" close=")" separator=","> |
|
|
|
|