|
|
|
@ -61,7 +61,7 @@
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectDistributionParcelListPage" resultType="com.logpm.distribution.vo.DistributionParcelListVO"> |
|
|
|
|
SELECT DISTINCT |
|
|
|
|
SELECT |
|
|
|
|
ldpl.warehouse_id warehouseId, |
|
|
|
|
ldpl.id id, |
|
|
|
|
lww.name warehouse, |
|
|
|
@ -87,65 +87,141 @@
|
|
|
|
|
ldpl.order_package_loading_status orderPackageLoadingStatus, |
|
|
|
|
ldpl.warehouse_entry_time_end warehouseEntryTimeEnd, |
|
|
|
|
ldpl.waybill_number waybillNumber, |
|
|
|
|
lwug.position_code goodsAllocation, |
|
|
|
|
lwtg.tray_code pallet, |
|
|
|
|
ldr.reservation_code reservationCode, |
|
|
|
|
ldl.scan_time scanTimes, |
|
|
|
|
lddl.train_number dvehicleName, |
|
|
|
|
ldl.train_number zvehicleName, |
|
|
|
|
lddl.driver_name driverName, |
|
|
|
|
lddl.note_number noteNumber, |
|
|
|
|
ldl.signing_time signingTimes, |
|
|
|
|
ldl.signing_user signingUser, |
|
|
|
|
ldl.scan_user scanUser, |
|
|
|
|
lddl.vehicle_name vehicleName, |
|
|
|
|
ldsa.type_service typeService, |
|
|
|
|
ldbl.pickup_batch pickupBatch |
|
|
|
|
ldpl.order_code, |
|
|
|
|
IF(c.reservation_code is not null,c.reservation_code,IF(b.pickup_batch is not null,b.pickup_batch,a.reservation_code)) AS reservationCode, |
|
|
|
|
IF(c.driver_name is not null,c.driver_name,IF(b.consignee is not null,b.consignee,a.driver_name)) AS driverName, |
|
|
|
|
IF(c.vehicle_name is not null,c.vehicle_name,IF(b.pick_up_plate is not null,b.pick_up_plate,a.vehicle_name)) AS vehicleName, |
|
|
|
|
IF(c.train_number is not null,c.train_number,IF(b.train_number is not null,b.train_number,a.train_number)) AS dvehicleName, |
|
|
|
|
IF(c.scan_user is not null,c.scan_user,IF(b.scan_user is not null,b.scan_user,a.scan_user)) AS scanUser, |
|
|
|
|
IF(c.signing_user is not null,c.signing_user,IF(b.signing_user is not null,b.signing_user,a.signing_user)) AS signingUser, |
|
|
|
|
IF(c.scan_time is not null,c.scan_time,IF(b.scan_time is not null,b.scan_time,a.scan_time)) AS loadingTime, |
|
|
|
|
IF(c.signing_time is not null,c.signing_time,IF(b.signing_time is not null,b.signing_time,a.signing_time)) AS signingTime |
|
|
|
|
FROM |
|
|
|
|
logpm_distribution_parcel_list ldpl |
|
|
|
|
logpm_distribution_parcel_list AS ldpl |
|
|
|
|
LEFT JOIN logpm_warehouse_updown_goods lwug ON ldpl.id = lwug.association_id |
|
|
|
|
LEFT JOIN logpm_warehouse_tray_goods lwtg ON ldpl.id = lwtg.association_id |
|
|
|
|
left join logpm_warehouse_warehouse lww on lww.id = ldpl.warehouse_id |
|
|
|
|
LEFT JOIN logpm_distribution_reservation_package ldrp on ldrp.parce_list_id = ldpl.id and ldrp.packet_bar_status in (1,3) |
|
|
|
|
LEFT join logpm_distribution_stock_article ldsa on ldsa.id = ldpl.stock_article_id |
|
|
|
|
LEFT join logpm_warehouse_warehouse lww on lww.id = ldpl.warehouse_id |
|
|
|
|
LEFT JOIN |
|
|
|
|
(SELECT |
|
|
|
|
ldrp.parce_list_id, |
|
|
|
|
ldl.scan_time, |
|
|
|
|
lddl.train_number, |
|
|
|
|
lddl.driver_name, |
|
|
|
|
lddl.vehicle_name, |
|
|
|
|
ldl.signing_time, |
|
|
|
|
ldl.scan_user, |
|
|
|
|
ldl.signing_user, |
|
|
|
|
ldr.reservation_code |
|
|
|
|
FROM logpm_distribution_reservation_package ldrp |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl on ldl.package_id = ldrp.parce_list_id and ldl.scan_status !=1 AND ldl.is_deleted = 0 |
|
|
|
|
LEFT JOIN logpm_distribution_reservation ldr on ldr.id = ldrp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl on ldl.package_id = ldpl.id and ldl.scan_status !=1 AND ldl.is_deleted = 0 |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl on lddl.id = lds.delivery_id |
|
|
|
|
left join logpm_distribution_stock_article ldsa on ldsa.id = ldpl.stock_article_id |
|
|
|
|
LEFT JOIN logpm_distrilbution_bill_package AS ldbp ON ldbp.parce_list_id = ldpl.id and ldbp.packet_bar_status != 2 |
|
|
|
|
LEFT JOIN logpm_distrilbution_bill_lading ldbl ON ldbl.id = ldbp.bill_lading_id |
|
|
|
|
|
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl on lds.delivery_id =lddl.id |
|
|
|
|
<where> |
|
|
|
|
ldpl.is_deleted = 0 |
|
|
|
|
<if test="param.warehouse !='' and param.warehouse != null"> |
|
|
|
|
and lww.name like concat('%',#{param.warehouse},'%') |
|
|
|
|
</if> |
|
|
|
|
ldrp.packet_bar_status != '2' |
|
|
|
|
<if test="param.reservationCode !='' and param.reservationCode != null"> |
|
|
|
|
and ldr.reservation_code = #{param.reservationCode} |
|
|
|
|
and ldr.reservation_code like concat(#{param.reservationCode},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.scanTime !='' and param.scanTime != null"> |
|
|
|
|
and date_format(from_unixtime(ldl.scan_time),'%Y-%m-%d') = date_format(#{param.scanTime}),'%Y-%m-%d') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.signingTime !='' and param.signingTime != null"> |
|
|
|
|
and date_format(from_unixtime(ldl.signing_time),'%Y-%m-%d') = date_format(#{param.signingTime}),'%Y-%m-%d') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.dvehicleName !='' and param.dvehicleName != null"> |
|
|
|
|
and lddl.vehicle_name = #{param.dvehicleName} |
|
|
|
|
and lddl.train_number = #{param.dvehicleName} |
|
|
|
|
</if> |
|
|
|
|
<if test="param.vehicleName !='' and param.vehicleName != null"> |
|
|
|
|
and lddl.vehicle_name like concat('%',#{param.vehicleName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.vehicleName !='' and param.vehicleName != null"> |
|
|
|
|
and ldl.vehicle_name = #{param.vehicleName} |
|
|
|
|
and lddl.vehicle_name like concat('%',#{param.vehicleName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.driverName !='' and param.driverName != null"> |
|
|
|
|
and lddl.driver_name like concat('%',#{param.driverName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.scanUser !='' and param.scanUser != null"> |
|
|
|
|
and ldl.scan_user like concat('%',#{param.scanUser},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.signingUser !='' and param.signingUser != null"> |
|
|
|
|
and ldl.signing_user like concat('%',#{param.signingUser},'%') |
|
|
|
|
</if> |
|
|
|
|
</where> |
|
|
|
|
) AS a ON a.parce_list_id = ldpl.id |
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT |
|
|
|
|
ldbp.parce_list_id, |
|
|
|
|
ldbl.pickup_batch, |
|
|
|
|
ldbl.pickup_batch AS train_number, |
|
|
|
|
ldbl.pick_up_plate AS pick_up_plate, |
|
|
|
|
ldbl.consignee AS consignee, |
|
|
|
|
ldbls.create_time AS scan_time, |
|
|
|
|
ldbls.create_time AS signing_time, |
|
|
|
|
ldbls.scan_user AS scan_user, |
|
|
|
|
ldbls.scan_user AS signing_user |
|
|
|
|
FROM |
|
|
|
|
logpm_distrilbution_bill_package AS ldbp |
|
|
|
|
LEFT JOIN logpm_distrilbution_bill_lading ldbl ON ldbl.id = ldbp.bill_lading_id |
|
|
|
|
LEFT JOIN logpm_distribution_bill_lading_scan ldbls ON ldbls.parcel_list_id = ldbp.parce_list_id |
|
|
|
|
<where> |
|
|
|
|
ldbp.packet_bar_status != '2' |
|
|
|
|
<if test="param.reservationCode !='' and param.reservationCode != null"> |
|
|
|
|
and ldbl.pickup_batch like concat(#{param.reservationCode},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.scanTime !='' and param.scanTime != null"> |
|
|
|
|
and date_format(from_unixtime(ldl.scan_time),'%Y-%m-%d') = date_format(#{param.scanTime}),'%Y-%m-%d') |
|
|
|
|
and date_format(from_unixtime(ldl.created_time),'%Y-%m-%d') = date_format(#{param.scanTime}),'%Y-%m-%d') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.signingTime !='' and param.signingTime != null"> |
|
|
|
|
and date_format(from_unixtime(lddl.signing_time),'%Y-%m-%d') = date_format(#{param.signingTime}),'%Y-%m-%d') |
|
|
|
|
and date_format(from_unixtime(ldl.created_time),'%Y-%m-%d') = date_format(#{param.signingTime}),'%Y-%m-%d') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.dvehicleName !='' and param.dvehicleName != null"> |
|
|
|
|
and ldbl.pickup_batch = #{param.dvehicleName} |
|
|
|
|
</if> |
|
|
|
|
<if test="param.vehicleName !='' and param.vehicleName != null"> |
|
|
|
|
and ldbl.pick_up_plate like concat('%',#{param.vehicleName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.driverName !='' and param.driverName != null"> |
|
|
|
|
and lddl.driver_name = #{param.driverName} |
|
|
|
|
and lddl.consignee like concat('%',#{param.driverName},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.noteNumber !='' and param.noteNumber != null"> |
|
|
|
|
and lddl.note_number = #{param.noteNumber} |
|
|
|
|
<if test="param.scanUser !='' and param.scanUser != null"> |
|
|
|
|
and ldbls.scan_user like concat('%',#{param.scanUser},'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="param.signingUser !='' and param.signingUser != null"> |
|
|
|
|
and ldbls.scan_user like concat('%',#{param.signingUser},'%') |
|
|
|
|
</if> |
|
|
|
|
</where> |
|
|
|
|
) AS b ON b.parce_list_id = ldpl.id |
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT |
|
|
|
|
ldrzp.parcel_list_id, |
|
|
|
|
IF(lddl.train_number is not null,lddl.train_number,ldbl.pickup_batch) AS train_number, |
|
|
|
|
IF(lddl.driver_name is not null,lddl.driver_name,ldbl.consignee) AS driver_name, |
|
|
|
|
IF(lddl.vehicle_name is not null,lddl.vehicle_name,ldbl.pick_up_plate) AS vehicle_name, |
|
|
|
|
IF(ldl.signing_time is not null,ldl.signing_time,ldbls.create_time) AS signing_time, |
|
|
|
|
IF(ldl.scan_time is not null,ldl.scan_time,ldbls.create_time) AS scan_time, |
|
|
|
|
IF(ldl.scan_user is not null,ldl.scan_user,ldbls.scan_user) AS scan_user, |
|
|
|
|
IF(ldl.signing_user is not null,ldl.signing_user,ldbls.scan_user) AS signing_user, |
|
|
|
|
IF(ldr.reservation_code is not null,ldr.reservation_code,ldbl.pickup_batch) AS reservation_code |
|
|
|
|
FROM logpm_distribution_reservation_zero_package ldrzp |
|
|
|
|
LEFT JOIN logpm_distribution_loadscan ldl on ldl.package_id = ldrzp.parcel_list_id and ldl.scan_status !=1 AND ldl.is_deleted = 0 |
|
|
|
|
LEFT JOIN logpm_distribution_reservation ldr on ldr.id = ldrzp.reservation_id |
|
|
|
|
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id |
|
|
|
|
LEFT JOIN logpm_distribution_delivery_list lddl on lds.delivery_id =lddl.id |
|
|
|
|
LEFT JOIN logpm_distrilbution_bill_lading ldbl ON ldrzp.reservation_id = ldbl.id |
|
|
|
|
LEFT JOIN logpm_distribution_bill_lading_scan ldbls ON ldbls.parcel_list_id = ldrzp.parcel_list_id |
|
|
|
|
<where> |
|
|
|
|
</where> |
|
|
|
|
) AS c ON c.parcel_list_id = ldpl.id |
|
|
|
|
<where> |
|
|
|
|
ldpl.is_deleted = 0 |
|
|
|
|
<if test="param.warehouse !='' and param.warehouse != null"> |
|
|
|
|
and lww.name like concat('%',#{param.warehouse},'%') |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="param.orderPackageGroundingStatus !='' and param.orderPackageGroundingStatus != null"> |
|
|
|
|
and ldpl.order_package_grounding_status = #{param.orderPackageGroundingStatus} |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="param.warehouseIdList != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(param.warehouseIdList)"> |
|
|
|
|
and ldpl.warehouse_id in |
|
|
|
|
<foreach collection="param.warehouseIdList" item="item" open="(" close=")" separator=","> |
|
|
|
@ -182,7 +258,6 @@
|
|
|
|
|
<if test="param.materialName !='' and param.materialName != null"> |
|
|
|
|
and ldpl.material_name like concat('%',#{param.materialName},'%') |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="param.materialCode !='' and param.materialCode != null"> |
|
|
|
|
and ldpl.material_code =#{param.materialCode} |
|
|
|
|
</if> |
|
|
|
@ -213,12 +288,6 @@
|
|
|
|
|
<if test="param.waybillNumber != '' and param.waybillNumber != null "> |
|
|
|
|
and ldpl.waybill_number = #{param.waybillNumber} |
|
|
|
|
</if> |
|
|
|
|
<if test="param.scanUser !='' and param.scanUser != null"> |
|
|
|
|
and ldl.scan_user = #{param.scanUser} |
|
|
|
|
</if> |
|
|
|
|
<if test="param.signingUser !='' and param.signingUser != null"> |
|
|
|
|
and ldl.signing_user = #{param.signingUser} |
|
|
|
|
</if> |
|
|
|
|
<if test="param.startWarehouseEntryTimeEnd != null and param.startWarehouseEntryTimeEnd !='' and param.lastWarehouseEntryTimeEnd !=''and param.lastWarehouseEntryTimeEnd != null"> |
|
|
|
|
and ldpl.warehouse_entry_time_end BETWEEN #{param.startWarehouseEntryTimeEnd} AND #{param.lastWarehouseEntryTimeEnd} |
|
|
|
|
</if> |
|
|
|
|