JOIN logpm_distribution_stock_list ldsl ON lwtg.association_id = ldsl.material_id
left join (logpm_warehouse_updown_goods lwug join logpm_warehouse_goods_allocation lwga on lwug.allocation_id =lwga.id) on lwug.association_id = ldsl.material_id
logpm_warehouse_tray_goods lwtg
JOIN logpm_distribution_stock_list ldsl ON lwtg.association_id = ldsl.material_id AND lwtg.incoming_batch = ldsl.incoming_batch
LEFT JOIN logpm_warehouse_tary_allocation AS lwta ON lwtg.tray_id = lwta.tray_id
LEFT JOIN logpm_warehouse_updown_goods AS lwug ON lwta.allocation_id = lwug.allocation_id
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwga.id = lwug.allocation_id
<where>
ldsl.is_deleted = 0 and lwtg.is_deleted = 0 and lwtg.association_type = 4 and lwtg.tray_id = #{param.id}
<iftest="param.cargoNumber !=null and param.cargoNumber != ''">
@ -197,12 +197,12 @@
<iftest="param.descriptionGoods !=null and param.descriptionGoods != ''">
and ldsl.description_goods like concat('%',#{param.descriptionGoods},'%')
</if>
<iftest="param.columnNum !=null and param.columnNum != ''">
and ldsl.column_num like concat('%',#{param.columnNum},'%')
</if>
<iftest="param.layerNum !=null and param.layerNum != ''">
and ldsl.layer_num like concat('%',#{param.layerNum},'%')
</if>
<!-- <if test="param.columnNum !=null and param.columnNum != ''">-->
<!-- and ldsl.column_num like concat('%',#{param.columnNum},'%')-->
<!-- </if>-->
<!-- <if test="param.layerNum !=null and param.layerNum != ''">-->
<!-- and ldsl.layer_num like concat('%',#{param.layerNum},'%')-->
<!-- </if>-->
<iftest="param.cargoNorms !=null and param.cargoNorms != ''">
and ldsl.cargo_norms like concat('%',#{param.cargoNorms},'%')
SELECT * from logpm_distribution_stock_article ldsa where
ldsa.is_deleted = 0 and ldsa.type_service ='2' and ldsa.genre = '1' and ldsa.reservation_status in ('10','20') and ldsa.order_status in ('10','20','30','70')
ldsa.is_deleted = 0 and ldsa.type_service ='2' and ldsa.genre = '1' and ldsa.reservation_status in ('10','20')
and ldsa.order_status in ('10','20','30','70')
<iftest="distributionStockArticleVO.orderCode!=null and distributionStockArticleVO.orderCode !=''">
and ldsa.order_code like concat(#{distributionStockArticleVO.orderCode},'%')
and ldsa.order_code like concat(#{distributionStockArticleVO.orderCode},'%')
</if>
<iftest="distributionStockArticleVO.stockupStatus != null and distributionStockArticleVO.stockupStatus != ''">
and ldsa.stockup_status = #{distributionStockArticleVO.stockupStatus}
@ -146,7 +154,7 @@
</if>
<iftest="distributionStockArticleVO.clientIds != null and distributionStockArticleVO.handQuantity != ''">
<iftest="param.serviceNumber != null and param.serviceNumber != ''">
and ldsa.service_number = #{param.serviceNumber}
</if>
@ -892,34 +922,42 @@
update logpm_distribution_stock_article
set grounding_status = #{groundingStatus}
where order_code = #{orderCode}
AND warehouse_id = #{warehouseId}
AND warehouse_id = #{warehouseId}
</update>
<updateid="submitHandleNumByOrderId">
<updateid="submitHandleNumByOrderId">
update logpm_distribution_stock_article
set hand_quantity = hand_quantity - #{subNum}
where id = #{articleId}
and hand_quantity - #{subNum} >= 0
and hand_quantity - #{subNum} >= 0
</update>
<updateid="updateCustomerInfoByOrderCode">
update logpm_distribution_stock_article
set customer_name = #{customerName},
set customer_name = #{customerName},
customer_telephone = #{customerPhone},
customer_address = #{customerRoad}
customer_address = #{customerRoad}
where order_code = #{orderCode}
</update>
<updateid="freezeByOrderCode">
<updateid="freezeByOrderCode">
update logpm_distribution_stock_article
set freeze_status = #{freezeStatus}
where order_code = #{orderCode}
</update>
<updateid="deductionHandQuantity">
UPDATE logpm_distribution_stock_article SET hand_quantity = (hand_quantity - 1) WHERE id=#{orderId} AND is_deleted = 0 AND hand_quantity >= 0
UPDATE logpm_distribution_stock_article
SET hand_quantity = (hand_quantity - 1)
WHERE id = #{orderId}
AND is_deleted = 0
AND hand_quantity >= 0
</update>
<updateid="augmentHandQuantity">
UPDATE logpm_distribution_stock_article SET hand_quantity = (hand_quantity + #{augmentNum}) WHERE id=#{orderId} AND is_deleted = 0 AND hand_quantity >= 0
UPDATE logpm_distribution_stock_article
SET hand_quantity = (hand_quantity + #{augmentNum})
WHERE id = #{orderId}
AND is_deleted = 0
AND hand_quantity >= 0
</update>
@ -927,50 +965,54 @@
update logpm_distribution_stock_article
set incoming_num = incoming_num + #{num}
where id = #{orderId}
and incoming_num + #{num} <= total_number
and incoming_num + #{num} <= total_number
</update>
<updateid="augmentDeliveryQuantity">
UPDATE logpm_distribution_stock_article SET delivery_quantity = #{reservationNum} WHERE id = #{orderId}
where ldl.package_id = ldpl.id and ldl.signfor_state = 2
) ) signinQuantity,
sum((
select COUNT(ldl.id)
from logpm_distribution_loadscan ldl
where ldl.package_id = ldpl.id and ldl.signfor_state = 1
)) deliveryQuantity
from logpm_distribution_parcel_list ldpl
where ldl.package_id = ldpl.id
and ldl.signfor_state = 2
)) signinQuantity,
sum((
select COUNT(ldl.id)
from logpm_distribution_loadscan ldl
where ldl.package_id = ldpl.id
and ldl.signfor_state = 1
)) deliveryQuantity
from logpm_distribution_parcel_list ldpl
where ldpl.stock_article_id = #{id}
</select>
<selectid="selectOrderPackageListByMap"
@ -996,10 +1038,11 @@
ldpl.order_package_code,
ldpl.cargo_title,
ldpl.shelf_title,
(SELECT lwga.qr_code from logpm_warehouse_updown_goods lwug left join
(SELECT lwga.qr_code from logpm_warehouse_updown_goods lwug left join
logpm_warehouse_goods_allocation lwga on lwga.id = lwug.allocation_id
where association_value=ldpl.order_package_code) goods_allocation,
(SELECT lwt.pallet_name from logpm_warehouse_tray_goods lwtg LEFT JOIN logpm_warehouse_tray lwt on lwt.id=lwtg.tray_id where lwtg.association_value=ldpl.order_package_code ) pallet,
(SELECT lwt.pallet_name from logpm_warehouse_tray_goods lwtg LEFT JOIN logpm_warehouse_tray lwt on
lwt.id=lwtg.tray_id where lwtg.association_value=ldpl.order_package_code ) pallet,
ldpl.firsts_code,
ldpl.firsts,
ldpl.second_code,
@ -1038,7 +1081,8 @@
FROM
logpm_distribution_parcel_list AS ldpl
WHERE
ldpl.order_package_reservation_status = 10 and ldpl.order_package_freeze_status = 10 AND ldpl.order_package_loading_status = 10 AND order_package_status IN (10,20)
ldpl.order_package_reservation_status = 10 and ldpl.order_package_freeze_status = 10 AND
ldpl.order_package_loading_status = 10 AND order_package_status IN (10,20)
and ldpl.stock_article_id = #{param.id} and ldpl.warehouse_id = #{warehouseId}
<iftest="param.waybillNumber != null and param.waybillNumber != ''">
and ldpl.waybill_number like concat('%',#{param.waybillNumber},'%')
WHEN 0 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_list WHERE stock_article_id = ldsa.id),'是','否')
WHEN 1 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_number WHERE stock_article_id = ldsa.id),'是','否')
WHEN 0 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_list WHERE
stock_article_id = ldsa.id),'是','否')
WHEN 1 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_number WHERE
stock_article_id = ldsa.id),'是','否')
END isCompleteSet,
CASE ldsa.type_service
WHEN 1 THEN '商配'
@ -1166,10 +1212,14 @@
WHEN 3 THEN '自提'
WHEN 4 THEN '三方中转'
END typeServiceName,
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 AND stock_article_status!= 2), 0 ) AS reservationNumber,
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 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,
@ -1177,7 +1227,7 @@
m.signing_time AS signinTime,
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,
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
@ -1224,18 +1274,20 @@
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id
GROUP BY ldr.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 GROUP BY stock_article_id) AS k ON k.stock_article_id = ldsa.id
LEFT JOIN ( SELECT order_id, max( signing_time ) AS scanSigningTime FROM logpm_distribution_loadscan WHERE scan_status != 1 AND signfor_state = 2 GROUP BY order_id ) AS j ON j.order_id = ldsa.id
LEFT JOIN ( SELECT stock_article_id, min( create_time ) AS earliestWarehouseEntryTime FROM
logpm_distribution_parcel_list GROUP BY stock_article_id) AS k ON k.stock_article_id = ldsa.id
LEFT JOIN ( SELECT order_id, max( signing_time ) AS scanSigningTime FROM logpm_distribution_loadscan WHERE
scan_status != 1 AND signfor_state = 2 GROUP BY order_id ) AS j ON j.order_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},"%")
AND ldsa.waybill_number like concat(#{param.waybillNumber},"%")
</if>
<iftest="param.serviceNumber != null and 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},"%")
AND ldsa.order_code like concat(#{param.orderCode},"%")
</if>
<iftest="param.warehouseName != null and param.warehouseName != ''">
AND ldsa.warehouse like concat(#{param.warehouseName},"%")
@ -1269,7 +1321,7 @@
AND ldsa.warehouse_id = #{param.warehouseId}
</if>
<iftest="param.warehouseIdList != null and param.warehouseId != ''">
left join logpm_basicdata_factory_category lbfc on lbfc.brand = ltad.brand and lbfc.firsts = ltad.first_pack_name and lbfc.seconds = ltad.second_pack_name and lbfc.thirds = ltad.third_pack_name
left join logpm_trunkline_cars_order ltco on ltco.waybill_id = ltcls.waybill_id and ltco.order_code = ltcls.order_code and ltcls.node_id = ltco.warehouse_id
left join logpm_trunkline_cars_order ltco on ltco.waybill_id = ltcls.waybill_id and ltco.order_code = ltcls.order_code and ltcls.warehouse_id = ltco.warehouse_id