IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND scan_status != 1 ), 0 ) AS deliveryNumber,
IFNULL(( SELECT SUM( received_quantity ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND scan_status != 1 ), 0 ) AS signForNumber,
IFNULL(( SELECT SUM( stock_quantity ) FROM logpm_distribution_stock WHERE stock_article = ldsa.id ), 0 ) AS stockUpNumber,
IFNULL(( SELECT SUM( reservation_num ) FROM logpm_distribution_reservation_stockarticle WHERE stock_article_id = ldsa.id ), 0 ) AS reservationNumber,
CONCAT(GROUP_CONCAT(DISTINCT IFNULL(t.msg,'')),GROUP_CONCAT(DISTINCT IFNULL(y.msg,''))) AS reservationInfo,
IFNULL(( SELECT SUM( reservation_num ) FROM logpm_distribution_reservation_stockarticle WHERE stock_article_id = ldsa.id AND stock_article_status!= 2), 0 ) AS reservationNumber,
IF(GROUP_CONCAT(t.msg) is not null,GROUP_CONCAT(t.msg),IFNULL(GROUP_CONCAT(y.msg),null)) AS reservationInfo,
GROUP_CONCAT(DISTINCT IFNULL( m.mssg,'')) AS deliveryListInfo,
ldsa.create_time As createTime,
ldsa.create_user As createUser,
@ -1173,6 +1173,7 @@
GROUP_CONCAT(DISTINCT IFNULL( m.vehicleName,'')) AS vehicleName,
GROUP_CONCAT(DISTINCT IFNULL( m.examine_user_name,'')) AS examineUserNames,
k.earliestWarehouseEntryTime AS earliestWarehouseEntryTime,
GROUP_CONCAT(t.reservation_id) AS reservationIds,
j.scanSigningTime AS scanSigningTime
FROM
logpm_distribution_stock_article AS ldsa
@ -1183,7 +1184,10 @@
CONCAT( ldr.reservation_code, '(', ldrs.reservation_num, ')' ) AS msg
FROM
logpm_distribution_reservation_stockarticle AS ldrs
LEFT JOIN logpm_distribution_reservation ldr ON ldrs.reservation_id = ldr.id AND ldrs.stock_article_status != 2 AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0
LEFT JOIN logpm_distribution_reservation ldr ON ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status != 2
AND ldr.reservation_status != 40
AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0