demand: TMS-运单管理-所有运单查询分页逻辑修改

This commit is contained in:
aike 2025-12-05 17:15:29 +08:00
parent 73f2a92596
commit 1d250d0e8f
7 changed files with 479 additions and 15 deletions

View File

@ -46,6 +46,7 @@ import com.xdadan.erp.emis.utils.WaybillHelper;
import com.xdadan.erp.system.domain.SysFileInfo;
import com.xdadan.erp.system.service.ISysFileInfoService;
import com.xdadan.erp.system.service.ISysUserService;
import com.xdadan.erp.web.emis.annotation.WaybillLightCount;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -541,10 +542,11 @@ public class EmisWaybillController extends EmisBaseController
*/
@PreAuthorize("@ss.hasPermi('emis:emisWaybill:list')")
@GetMapping("/list")
@WaybillLightCount
public TableDataInfo list(EmisWaybill emisWaybill)
{
// 非总部只能查看自己的或者与自己相关的订单
startPage();
// startPage();
setPrivParams(emisWaybill);
@ -578,11 +580,12 @@ public class EmisWaybillController extends EmisBaseController
*/
@PreAuthorize("@ss.hasPermi('emis:emisWaybill:list')")
@GetMapping("/listOrder")
@WaybillLightCount
public TableDataInfo listOrder(EmisWaybill emisWaybill)
{
// 非总部只能查看自己的或者与自己相关的订单
startPage();
// startPage();
setPrivParams(emisWaybill);
@ -618,10 +621,11 @@ public class EmisWaybillController extends EmisBaseController
*/
@PreAuthorize("@ss.hasPermi('emis:emisWaybill:list')")
@GetMapping("/getQueryStatInfoMap")
@WaybillLightCount
public AjaxResult getQueryStatInfoMap(EmisWaybill emisWaybill)
{
startPage();
// startPage();
setPrivParams(emisWaybill);
@ -650,9 +654,10 @@ public class EmisWaybillController extends EmisBaseController
*/
@PreAuthorize("@ss.hasPermi('emis:app:op:bizStatList')")
@GetMapping("/getMyBizStatInfo")
@WaybillLightCount
public AjaxResult getMyBizStatInfo(EmisWaybill emisWaybill)
{
startPage();
// startPage();
setPrivParams(emisWaybill);
String empName = getLoginUser().getUser().getEmpName();
emisWaybill.setSalesmen(empName);
@ -680,11 +685,12 @@ public class EmisWaybillController extends EmisBaseController
*/
@PreAuthorize("@ss.hasPermi('emis:emisWaybill:list')")
@GetMapping("/querySignlist")
@WaybillLightCount
public TableDataInfo querySignlist(EmisWaybill emisWaybill)
{
// 非总部只能查看自己的或者与自己相关的订单
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -728,9 +734,10 @@ public class EmisWaybillController extends EmisBaseController
"intoWarehouseBillCode"
},value= EmisWaybill.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
@GetMapping("/listSimple")
@WaybillLightCount
public TableDataInfo listSimple(EmisWaybill emisWaybill)
{
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -791,9 +798,10 @@ public class EmisWaybillController extends EmisBaseController
* @return
*/
@GetMapping("/getSiteSendStatInfoMap")
@WaybillLightCount
public TableDataInfo getSiteSendStatInfoMap(EmisWaybill emisWaybill)
{
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -808,9 +816,10 @@ public class EmisWaybillController extends EmisBaseController
* @return
*/
@GetMapping("/getSiteDestStatInfoMap")
@WaybillLightCount
public TableDataInfo getSiteDestStatInfoMap(EmisWaybill emisWaybill)
{
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -825,9 +834,10 @@ public class EmisWaybillController extends EmisBaseController
* @return
*/
@GetMapping("/queryScanStatInfoDtlList")
@WaybillLightCount
public TableDataInfo queryScanStatInfoDtlList(EmisWaybill emisWaybill)
{
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -860,9 +870,10 @@ public class EmisWaybillController extends EmisBaseController
@GetMapping("/selectEmisWaybillByMutiBillCode")
@WaybillLightCount
public TableDataInfo selectEmisWaybillByMutiBillCode(EmisWaybill emisWaybill)
{
startPage();
// startPage();
// 设置通用权限查询参数
setPrivParams(emisWaybill);
@ -891,9 +902,10 @@ public class EmisWaybillController extends EmisBaseController
// ,"printManName"
// },value= EmisWaybill.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
@GetMapping("/queryPrintListSimple")
@WaybillLightCount
public TableDataInfo queryPrintListSimple(EmisWaybill emisWaybill)
{
startPage();
// startPage();
List<EmisWaybill> list = null;
// 如果单号不为空,则去除其他参数

View File

@ -0,0 +1,14 @@
package com.xdadan.erp.web.emis.annotation;
import java.lang.annotation.*;
/**
* 运单查询轻量 count 注解
* - 在控制器方法上使用,统一采用轻量 count 查询
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WaybillLightCount {
}

View File

@ -0,0 +1,81 @@
package com.xdadan.erp.web.emis.aspect;
import com.github.pagehelper.PageHelper;
import com.xdadan.erp.common.core.page.PageDomain;
import com.xdadan.erp.common.core.page.TableDataInfo;
import com.xdadan.erp.common.core.page.TableSupport;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.service.IEmisWaybillService;
import com.xdadan.erp.web.emis.annotation.WaybillLightCount;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
/**
* 运单查询轻量 count 切面
* - 统一关闭 PageHelper 自动 count
* - 使用轻量 count SQL 计算总数
*/
@Aspect
@Component
@Slf4j
@RequiredArgsConstructor
public class WaybillLightCountAspect {
private final IEmisWaybillService emisWaybillService;
@Pointcut("@annotation(com.xdadan.erp.web.emis.annotation.WaybillLightCount)")
public void lightCountPointcut() {}
@Around("lightCountPointcut()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
// 统一分页:禁用自动 count,保留 orderBy
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
String orderBy = pageDomain.getOrderBy();
if (pageNum != null && pageSize != null) {
PageHelper.startPage(pageNum, pageSize, false);
if (StringUtils.isNotEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
}
Object result = joinPoint.proceed();
if (!(result instanceof TableDataInfo)) {
return result;
}
EmisWaybill param = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof EmisWaybill) {
param = (EmisWaybill) arg;
break;
}
}
if (param == null) {
return result;
}
long total = 0L;
try {
total = emisWaybillService.countWaybillList(param);
} catch (Exception ex) {
log.warn("Light count failed, fallback to current total. param={}", param.getBillCode(), ex);
}
TableDataInfo table = (TableDataInfo) result;
if (total > 0) {
table.setTotal(total);
}
return table;
}
}

View File

@ -141,6 +141,11 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill);
/**
* 运单列表轻量计数
*/
public long countWaybillList(EmisWaybill emisWaybill);

View File

@ -251,6 +251,7 @@ public interface IEmisWaybillService extends IDataAuditService
public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill);
public long countWaybillList(EmisWaybill emisWaybill);
public void genWarehouseInTplFileByOms(HttpServletResponse response, String orderSn,String fileType) throws EmisBizError ;
public void genWarehouseInTplFile(HttpServletResponse response, String orderSn,String fileType) throws EmisBizError ;

View File

@ -4557,6 +4557,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
return emisWaybillMapper.selectPrintWaybillList(emisWaybill);
}
@Override
public long countWaybillList(EmisWaybill emisWaybill){
return emisWaybillMapper.countWaybillList(emisWaybill);
}
@Override
public void genWarehouseInTplFileByOms(HttpServletResponse response, String orderSn,String fileType) throws EmisBizError {

View File

@ -1568,6 +1568,356 @@
</select>
<select id="countWaybillList" parameterType="EmisWaybill" resultType="long">
select count(1)
from emis_waybill a
left join emis_customer_user a4 on a.cust_no=a4.monthly_pay_code and a4.del_flag='0'
left join emis_waybill_other wss on a.id=wss.waybill_id and wss.del_flag='0'
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
</if>
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
and a.bill_code in
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
<if test="orderType != null and orderType != ''"> and order_type=#{orderType}</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
<if test="blVirtual ==1"> and bl_virtual=#{blVirtual}</if>
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
<if test="enterpriseName != null and enterpriseName != ''"> and a.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="enterpriseTaxId != null and enterpriseTaxId != ''"> and a.enterprise_tax_id like concat('%', #{enterpriseTaxId}, '%')</if>
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<include refid="salesSupportFilter"/>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and FIND_IN_SET(product_type,#{productType})</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type=#{meterType}</if>
<if test="carryType != null and carryType != ''">and FIND_IN_SET(a.carry_type,#{carryType})</if>
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
<if test="freight != null "> and freight = #{freight}</if>
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and exists (select 1 from sys_user su1, sys_user su2 where su1.emp_code = #{takePieceEmployeeCode} and su2.emp_code = a.take_piece_employee_code and su1.emp_name = su2.emp_name and su1.del_flag='0' and su2.del_flag='0')</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
<if test="payee != null and payee != ''"> and a.payee=#{payee}</if>
<if test="salesmen != null and salesmen != ''"> and a.salesmen like concat('%', #{salesmen}, '%')</if>
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and FIND_IN_SET(payment_status,#{paymentStatus})</if>
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''">and FIND_IN_SET(`send_site_code`,#{sendSiteCode})
</if>
<if test="startSiteCode != null and startSiteCode != ''">
and a.start_site_code=#{startSiteCode}
</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
and exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
and not exists (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 1">
and a.order_type='0'
and a.waybill_status='0'
and a.order_status in('0','3')
and (
a.take_piece_employee_code=#{params.privEmpCode}
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
or (a.operate_employee_code=#{params.privEmpCode} )
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 2">
and a.waybill_status!='0' and a.order_status!='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
or a.register_man_code=#{params.privEmpCode}
)
</if>
<if test="params.waybillStatType != null and params.waybillStatType == 3">
and a.order_status='2'
and (
a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
<!-- 转单 -->
<if test="params.waybillStatType != null and params.waybillStatType == 4">
and a.order_status in('0','3') and exists (
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
)
</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<if test="payee != null and payee != ''">
and a.payee=#{payee}
</if>
<if test="salesmen != null and salesmen != '' " >
and a.salesmen=#{salesmen}
</if>
<if test="blSign != null and blSign != ''">
and a.bl_sign=#{blSign}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 1">
and a.goods_pics is not null
</if>
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 0">
and a.goods_pics is null
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.expireNotSign != null and params.expireNotSign == 1">
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
</if>
<if test="params.printFlag != null ">
and a.bl_print=#{params.printFlag}
</if>
<if test="params.isNeedPack != null and params.isNeedPack == 1">
and not EXISTS ( select 1 from emis_tms_pack_dtl etp where etp.del_flag='0' and etp.main_bill_code=a.bill_code )
and a.trans_line_type in(
select line_code from emis_trans_line etl where etl.trans_type=1
)
and bl_sign!='1' and waybill_status!='40'
and (a.send_site_code=#{params.privSiteCode} or a.start_site_code=#{params.privSiteCode})
and a.current_site_code=#{params.privSiteCode}
</if>
<if test="params.isNeedBatch != null and params.isNeedBatch == 1">
and a.bill_code = #{billCode}
<!--
and a.bill_code not in(
select etsbd.bill_code from emis_tms_site_batch_dtl etsbd,emis_tms_site_batch etsb
where etsbd.batch_no=etsb.batch_no and etsbd.del_flag='0' and etsb.del_flag='0' and etsb.batch_type=#{params.batchType}
)
-->
</if>
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
<if test="params.queryQuotaType != null and params.queryQuotaType == 1">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) > 10
</if>
<if test="params.queryQuotaType != null and params.queryQuotaType == 2">
and a.send_date is not null
and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
</if>
<if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " >
<if test="(salesmen == null or salesmen=='') and params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
or a.dispatch_site_code=#{params.privSiteCode}
or a.start_site_code=#{params.privSiteCode}
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
</if>
<if test="custNo != null and custNo != ''">
or EXISTS (
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
)
</if>
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.salesmen in(
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
)
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</if>
</where>
</select>
<select id="selectLatestMonthCreateOrderMapList" parameterType="EmisWaybill" resultType="map">
SELECT
DATE_FORMAT( create_time, '%Y-%m-%d' ) AS createDay,
@ -4278,10 +4628,6 @@
<if test="salesExecutive != null and salesExecutive != ''">
AND a4.sales_executive LIKE CONCAT('%', #{salesExecutive}, '%')
</if>
<!-- 销售支持 -->
<if test="salesSupport != null and salesSupport != ''">
AND a4.sales_support LIKE CONCAT('%', #{salesSupport}, '%')
</if>
<!-- 销售联系人 -->
<if test="salesmen != null and salesmen != ''">
AND a4.salesmen LIKE CONCAT('%', #{salesmen}, '%')