GROUP_CONCAT(DISTINCT IFNULL( m.driverName,'')) AS driverName,
GROUP_CONCAT(DISTINCT IFNULL( m.vehicleName,'')) AS vehicleName,
GROUP_CONCAT(DISTINCT IFNULL( m.examine_user_name,'')) AS examineUserNames,
(SELECT MIN(create_time) FROM logpm_distribution_parcel_list WHERE stock_article_id = ldsa.id) AS earliestWarehouseEntryTime
k.earliestWarehouseEntryTime AS earliestWarehouseEntryTime
FROM
logpm_distribution_stock_article AS ldsa
LEFT JOIN (
@ -1198,13 +1198,14 @@
logpm_distribution_signfor As lds ON lds.reservation_id = ldr.id
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id
) AS m ON ldsa.id = m.stock_article_id AND t.reservation_id = m.reservation_id
LEFT JOIN ( SELECT stock_article_id, min( create_time ) AS earliestWarehouseEntryTime FROM logpm_distribution_parcel_list) AS k ON k.stock_article_id = ldsa.id
<where>
ldsa.order_status in ('70','80')
<iftest="param.waybillNumber != null and param.waybillNumber != ''">
AND ldsa.waybill_number like concat("%",#{param.waybillNumber},"%")
</if>
<iftest="param.serviceNumber != null and param.serviceNumber != ''">
AND ldsa.service_umber like concat("%",#{param.serviceNumber},"%")
AND ldsa.service_number like concat("%",#{param.serviceNumber},"%")
</if>
<iftest="param.orderCode != null and param.orderCode != ''">
AND ldsa.order_code like concat("%",#{param.orderCode},"%")
@ -1213,7 +1214,7 @@
AND ldsa.warehouse like concat("%",#{param.warehouseName},"%")
</if>
<iftest="param.mallName != null and param.mallName != ''">
AND ldsa.mall_mame like concat("%",#{param.mallName},"%")
AND ldsa.mall_name like concat("%",#{param.mallName},"%")
</if>
<iftest="param.brand != null and param.brand != ''">
AND ldsa.brand like concat("%",#{param.brand},"%")
IF((SELECT sum(packet_number) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = #{billLadingId} AND packet_bar_status != 2) IS NULL,0,(SELECT sum(packet_number) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = #{billLadingId} AND packet_bar_status != 2))
( SELECT count( 1 ) FROM logpm_distrilbution_bill_stock WHERE bill_lading_id = ldbl.id AND order_status != 2 AND is_deleted = 0) AS orderNum ,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_reservation_zero_package WHERE reservation_id = ldbl.id AND is_deleted = 0),0) + IFNULL((SELECT sum(packet_number) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = ldbl.id AND is_deleted = 0),0) AS planNum,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND is_deleted = 0),0) AS inventoryNub,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_bill_lading_scan WHERE bill_lading_id = ldbl.id AND is_deleted = 0) ,0) AS signedNum
IF(IFNULL(SUM(ldbls.quantity),0) = sum( ldbp.packet_number ),1,0) c
FROM
logpm_distrilbution_bill_stock AS ldbs
LEFT JOIN logpm_distrilbution_bill_package AS ldbp ON ldbs.stock_article_id = ldbp.stock_article_id
AND ldbs.bill_lading_id = ldbp.bill_lading_id
LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbls.stock_article_id = ldbp.stock_article_id AND ldbls.bill_lading_id = ldbs.bill_lading_id
WHERE ldbs.bill_lading_id = #{billLadingId} GROUP BY ldbp.id