2024-07-03 19:17:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.xdadan.erp.emis.mapper.EmisSettleSubBillMapper" >
2024-07-03 21:17:22 +00:00
<resultMap type= "EmisSettleSubBill" id= "BaseEmisSettleSubBillResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-07-03 19:17:36 +00:00
<result property= "id" column= "id" />
<result property= "billNo" column= "bill_no" />
<result property= "parentBillNo" column= "parent_bill_no" />
<result property= "settleBillNo" column= "settle_bill_no" />
<result property= "billCode" column= "bill_code" />
<result property= "billDate" column= "bill_date" />
<result property= "billFee" column= "bill_fee" />
<result property= "currency" column= "currency" />
<result property= "settleType" column= "settle_type" />
<result property= "blSplit" column= "bl_split" />
2024-07-09 22:42:16 +00:00
<result property= "blMerge" column= "bl_merge" />
2024-07-03 19:17:36 +00:00
<result property= "billMonth" column= "bill_month" />
<result property= "custNo" column= "cust_no" />
2024-07-20 08:09:53 +00:00
<result property= "custName" column= "cust_name" />
2024-07-03 19:17:36 +00:00
<result property= "customerCode" column= "customer_code" />
<result property= "customerName" column= "customer_name" />
2024-11-04 09:02:59 +00:00
<result property= "invoicedMoney" column= "invoiced_money" />
<result property= "recedMoney" column= "reced_money" />
<result property= "satisfyMoney" column= "satisfy_money" />
<result property= "allowanceMoney" column= "allowance_money" />
<result property= "deductionMoney" column= "deduction_money" />
<result property= "otherMoney" column= "other_money" />
<result property= "satisfyReason" column= "satisfy_reason" />
<result property= "allowanceReason" column= "allowance_reason" />
<result property= "deductionReason" column= "deduction_reason" />
<result property= "otherReason" column= "other_reason" />
<result property= "openBillStatus" column= "open_bill_status" />
<result property= "paymentStatus" column= "payment_status" />
<result property= "chargeStatus" column= "charge_status" />
2024-07-09 22:42:16 +00:00
<result property= "payee" column= "payee" />
<result property= "salesmen" column= "salesmen" />
<result property= "blSpecialQuote" column= "bl_special_quote" />
<result property= "blSensitive" column= "bl_sensitive" />
<result property= "blConfirmCenter" column= "bl_confirm_center" />
<result property= "confirmCenterDate" column= "confirm_center_date" />
<result property= "confirmCenterNote" column= "confirm_center_note" />
<result property= "confirmCenterManCode" column= "confirm_center_man_code" />
<result property= "confirmCenterCode" column= "confirm_center_code" />
<result property= "blConfirmSite" column= "bl_confirm_site" />
<result property= "confirmSiteDate" column= "confirm_site_date" />
<result property= "confirmSiteManCode" column= "confirm_site_man_code" />
<result property= "confirmSiteNote" column= "confirm_site_note" />
<result property= "confirmSiteCode" column= "confirm_site_code" />
2024-07-03 19:17:36 +00:00
</resultMap>
2024-08-13 02:37:41 +00:00
<!-- 列表模式 -->
<resultMap id= "EmisSettleSubBillListResult" type= "EmisSettleSubBill" extends= "BaseEmisSettleSubBillResult" >
2024-07-03 19:17:36 +00:00
2024-08-19 07:19:44 +00:00
<association property= "waybillDetail"
column="bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy"
/>
2024-08-19 07:32:13 +00:00
2024-07-08 06:32:35 +00:00
<association property= "feeitemList"
column="bill_no"
select="com.xdadan.erp.emis.mapper.EmisSettleSubBillFeeitemMapper.selectFeeitemListBySubBillNo"
fetchType="lazy"
/>
2024-07-09 22:42:16 +00:00
<association property= "confirmCenterManName" column= "confirm_center_man_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode" />
<association property= "confirmSiteManName" column= "confirm_site_man_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode" />
<association property= "confirmSiteName" column= "confirm_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
2024-07-08 16:03:38 +00:00
2024-07-03 21:14:18 +00:00
</resultMap>
2024-07-08 06:32:35 +00:00
2024-08-13 02:37:41 +00:00
<resultMap id= "EmisSettleSubBillResult" type= "EmisSettleSubBill" extends= "BaseEmisSettleSubBillResult" >
<association property= "waybillDetail"
column="bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy"
/>
<association property= "feeitemList"
column="bill_no"
select="com.xdadan.erp.emis.mapper.EmisSettleSubBillFeeitemMapper.selectFeeitemListBySubBillNo"
fetchType="lazy"
/>
<association property= "confirmCenterManName" column= "confirm_center_man_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode" />
<association property= "confirmSiteManName" column= "confirm_site_man_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode" />
<association property= "confirmSiteName" column= "confirm_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
</resultMap>
2024-07-08 06:32:35 +00:00
2024-07-03 19:17:36 +00:00
<sql id= "selectEmisSettleSubBillVo" >
2024-11-04 09:02:59 +00:00
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_sub_bill
2024-07-03 19:17:36 +00:00
</sql>
2024-08-13 02:37:41 +00:00
<select id= "selectEmisSettleSubBillList" parameterType= "EmisSettleSubBill" resultMap= "EmisSettleSubBillListResult" >
2024-07-09 22:42:16 +00:00
select b.id, b.bill_no, b.parent_bill_no, b.settle_bill_no, b.bill_code, b.bill_date,
2024-07-20 08:09:53 +00:00
b.bill_fee, b.currency, b.settle_type, b.bl_split, b.bl_merge, b.bill_month, b.cust_no,b.cust_name,
2024-11-04 09:02:59 +00:00
b.customer_code, b.customer_name,
b.invoiced_money, b.reced_money,
b.satisfy_money, b.allowance_money, b.deduction_money, b.other_money,
b.satisfy_reason, b.allowance_reason, b.deduction_reason, b.other_reason,
b.open_bill_status, b.payment_status, b.charge_status,
b.payee, b.salesmen, b.bl_special_quote, b.bl_sensitive,
2024-07-09 22:42:16 +00:00
b.bl_confirm_center, b.confirm_center_date, b.confirm_center_note, b.confirm_center_man_code,
2024-08-12 10:23:43 +00:00
b.confirm_center_code, b.bl_confirm_site, b.confirm_site_date, b.confirm_site_man_code,
b.confirm_site_note, b.confirm_site_code, b.del_flag, b.create_by, b.create_time, b.update_by,
b.update_time, b.create_site, b.update_site,
a.bl_special_quote,a.calc_fee_type,a.send_date,a.send_company,
a.cust_no,a.cust_name,a.payment_type,a.time_type,
2024-08-14 09:14:21 +00:00
a.send_name,a.parcel_qty,a.bill_weight,a.total_volume,a.volume_weight,a.settlement_weight,
2024-08-12 10:23:43 +00:00
a.freight,real_fee,a.fee_remark,a.payment_type,a.remark,
a.payee,a.salesmen,a.bl_is_question,a.problem_cause,
2025-04-09 09:33:03 +00:00
a.lading_bill_code, a.company_code, a.departure_port, a.destination_port, a.box_quantity,
2024-08-12 10:23:43 +00:00
j.prod_name as product_type_name,
k.line_name as trans_line_type_name,
l.site_name as send_site_name,
m.site_name as dispatch_underling_site_name,
z.type_name as problem_type_name
2024-07-08 06:06:05 +00:00
from emis_settle_sub_bill b ,emis_waybill a
2024-08-12 10:23:43 +00:00
left join emis_trans_product j on a.product_type=j.prod_code and j.del_flag='0'
left join emis_trans_line k on a.trans_line_type=k.line_code and k.del_flag='0'
left join emis_site l on a.send_site_code=l.site_code and l.del_flag=0 and l.del_flag='0'
left join emis_site m on a.dispatch_underling_site_code=m.site_code and m.del_flag=0
left join emis_problem_type z on a.problem_type=z.id and z.del_flag='0'
2024-07-08 06:06:05 +00:00
2024-07-03 19:17:36 +00:00
<where >
2024-07-08 06:06:05 +00:00
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
<if test= "id != null " > and b.id = #{id}</if>
<if test= "billNo != null and billNo != ''" > and FIND_IN_SET(b.`bill_no`,#{billNo}) </if>
<if test= "parentBillNo != null and parentBillNo != ''" > and b.parent_bill_no=#{parentBillNo}</if>
2024-08-19 00:37:42 +00:00
<if test= "settleBillNo != null and settleBillNo != ''" > and FIND_IN_SET(b.`settle_bill_no`,#{settleBillNo})</if>
2024-07-08 07:16:09 +00:00
<if test= "billCode != null and billCode != ''" > and ( FIND_IN_SET(b.`bill_code`,#{billCode}) or b.bill_code like concat('%', #{billCode}, '%') ) </if>
2024-07-08 06:06:05 +00:00
<if test= "billDate != null " > and bill_date = #{billDate}</if>
<if test= "billFee != null " > and bill_fee = #{billFee}</if>
<if test= "currency != null and currency != ''" > and currency= #{currency}</if>
<if test= "settleType != null and settleType != ''" > and settle_type=#{settleType}</if>
<if test= "blSplit != null and blSplit != ''" > and bl_split=#{blSplit}</if>
<if test= "billMonth != null and billMonth != ''" > and bill_month=#{billMonth}</if>
2024-07-08 14:50:25 +00:00
<if test= "custNo != null and custNo != ''" > and b.cust_no=#{custNo}</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > and b.cust_name like concat('%', #{custName}, '%')</if>
2024-07-08 14:50:25 +00:00
<if test= "customerCode != null and customerCode != ''" > and b.customer_code=#{customerCode}</if>
<if test= "customerName != null and customerName != ''" > and b.customer_name like concat('%', #{customerName}, '%')</if>
2024-07-09 22:42:16 +00:00
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > and b.bl_confirm_center = #{blConfirmCenter}</if>
<if test= "confirmCenterDate != null " > and b.confirm_center_date = #{confirmCenterDate}</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > and b.confirm_center_note = #{confirmCenterNote}</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > and b.confirm_center_man_code = #{confirmCenterManCode}</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > and b.confirm_center_code = #{confirmCenterCode}</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > and b.bl_confirm_site = #{blConfirmSite}</if>
<if test= "confirmSiteDate != null " > and b.confirm_site_date = #{confirmSiteDate}</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > and b.confirm_site_man_code = #{confirmSiteManCode}</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > and b.confirm_site_note = #{confirmSiteNote}</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > and b.confirm_site_code = #{confirmSiteCode}</if>
2024-07-08 06:06:05 +00:00
2024-08-01 07:32:09 +00:00
<!-- 过滤掉虚拟单 -->
2025-01-20 08:57:12 +00:00
and not exists(
2025-01-20 09:00:36 +00:00
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
2025-01-20 08:57:12 +00:00
)
2024-08-01 07:32:09 +00:00
2024-07-08 09:30:14 +00:00
<if test= "params.sendSiteCode != null and params.sendSiteCode != ''" >
and a.send_site_code = #{params.sendSiteCode}
</if>
<if test= "params.dispatchUnderlingSiteCode != null and params.dispatchUnderlingSiteCode != ''" >
and a.dispatch_underling_site_code = #{params.dispatchUnderlingSiteCode}
</if>
2024-08-10 01:59:41 +00:00
<if test= "params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''" >
2025-01-20 08:57:12 +00:00
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} )
2024-08-10 01:59:41 +00:00
)
</if>
<if test= "params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''" >
2025-01-20 08:57:12 +00:00
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} )
2024-08-10 01:59:41 +00:00
)
2024-07-26 10:29:28 +00:00
</if>
<if test= "params.receiveCompany != null and params.receiveCompany != ''" >
and a.receive_company like concat('%', #{params.receiveCompany}, '%')
</if>
<if test= "params.sendCompany != null and params.sendCompany != ''" >
and a.send_company like concat('%', #{params.sendCompany}, '%')
</if>
2024-09-07 04:05:04 +00:00
<if test= "blMerge != null and blMerge != ''" > and b.bl_merge=#{blMerge}</if>
2024-11-13 01:27:39 +00:00
<if test= "paymentStatus != null and paymentStatus != ''" >
and b.payment_status=#{paymentStatus}
</if>
<if test= "openBillStatus != null and openBillStatus != ''" >
and b.open_bill_status=#{openBillStatus}
</if>
2024-09-07 04:05:04 +00:00
2024-07-26 10:29:28 +00:00
2024-07-09 08:48:34 +00:00
<if test= "params.mergeStatus != null and params.mergeStatus == 1" >
2024-07-10 01:05:23 +00:00
and b.bl_merge='0'
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
2024-07-09 08:48:34 +00:00
</if>
<if test= "params.mergeStatus != null and params.mergeStatus == 2" >
2024-07-10 01:05:23 +00:00
and b.bl_merge='1'
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
2024-07-09 08:48:34 +00:00
</if>
2024-07-25 12:20:10 +00:00
<if test= "params.transLineType != null and params.transLineType != ''" >
and a.trans_line_type = #{params.transLineType}
</if>
<if test= "params.productType != null and params.productType != ''" >
and a.product_type = #{params.productType}
</if>
2024-07-08 09:30:14 +00:00
<if test= "params.payee != null and params.payee != ''" >
and a.payee = #{params.payee}
</if>
2024-07-25 12:20:10 +00:00
2024-07-08 09:30:14 +00:00
<if test= "params.salesmen != null and params.salesmen != ''" >
and a.salesmen = #{params.salesmen}
</if>
2024-07-10 01:05:23 +00:00
<if test= "params.paymentType != null and params.paymentType != ''" >
and a.payment_type = #{params.paymentType}
2024-07-08 09:30:14 +00:00
</if>
2024-07-10 01:05:23 +00:00
2024-07-10 00:11:08 +00:00
<if test= "params.blSpecialQuote != null and params.blSpecialQuote != ''" >
and a.bl_special_quote = #{params.blSpecialQuote}
</if>
<if test= "params.calcFeeType != null and params.calcFeeType != ''" >
and a.calc_fee_type = #{params.calcFeeType}
</if>
2024-07-08 06:06:05 +00:00
<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>
2024-08-10 05:51:59 +00:00
<if test= "params.beginCreateTime != null and params.beginCreateTime != ''" >
and b.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test= "params.endCreateTime != null and params.endCreateTime != ''" >
and b.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
2024-07-08 06:06:05 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
and (
2024-08-07 14:04:09 +00:00
a.salesmen=#{params.privEmpName}
2024-08-07 14:21:25 +00:00
or a.payee=#{params.privEmpName}
2024-08-07 14:04:09 +00:00
or a.salesmen in(
2024-09-18 10:13:27 +00:00
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}
2024-08-07 14:04:09 +00:00
)
)
</if>
2024-07-08 06:06:05 +00:00
</where>
order by b.create_time desc
</select>
<select id= "getQueryStatInfoMap" parameterType= "EmisSettleSubBill" resultType= "map" >
select
2024-07-08 06:41:47 +00:00
count(distinct a.bill_code) as totalNum,
2024-07-08 06:47:16 +00:00
round(sum(b.bill_fee),2) as totalBillFee
2024-07-08 06:06:05 +00:00
from emis_settle_sub_bill b ,emis_waybill a
<where >
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
<if test= "id != null " > and b.id = #{id}</if>
<if test= "billNo != null and billNo != ''" > and FIND_IN_SET(b.`bill_no`,#{billNo}) </if>
<if test= "parentBillNo != null and parentBillNo != ''" > and b.parent_bill_no=#{parentBillNo}</if>
2024-08-19 00:30:07 +00:00
<if test= "settleBillNo != null and settleBillNo != ''" > and FIND_IN_SET(b.`settle_bill_no`,#{settleBillNo})</if>
2024-07-08 07:16:09 +00:00
<if test= "billCode != null and billCode != ''" > and ( FIND_IN_SET(b.`bill_code`,#{billCode}) or b.bill_code like concat('%', #{billCode}, '%') ) </if>
2024-07-08 06:06:05 +00:00
2024-07-03 19:17:36 +00:00
<if test= "billDate != null " > and bill_date = #{billDate}</if>
<if test= "billFee != null " > and bill_fee = #{billFee}</if>
2024-07-08 06:06:05 +00:00
<if test= "currency != null and currency != ''" > and currency= #{currency}</if>
<if test= "settleType != null and settleType != ''" > and settle_type=#{settleType}</if>
2024-07-03 21:14:18 +00:00
<if test= "blSplit != null and blSplit != ''" > and bl_split=#{blSplit}</if>
<if test= "billMonth != null and billMonth != ''" > and bill_month=#{billMonth}</if>
2024-07-08 14:50:25 +00:00
<if test= "custNo != null and custNo != ''" > and b.cust_no=#{custNo}</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > and b.cust_name like concat('%', #{custName}, '%')</if>
2024-07-08 14:50:25 +00:00
<if test= "customerCode != null and customerCode != ''" > and b.customer_code=#{customerCode}</if>
<if test= "customerName != null and customerName != ''" > and b.customer_name like concat('%', #{customerName}, '%')</if>
2024-07-09 22:42:16 +00:00
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > and b.bl_confirm_center = #{blConfirmCenter}</if>
<if test= "confirmCenterDate != null " > and b.confirm_center_date = #{confirmCenterDate}</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > and b.confirm_center_note = #{confirmCenterNote}</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > and b.confirm_center_man_code = #{confirmCenterManCode}</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > and b.confirm_center_code = #{confirmCenterCode}</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > and b.bl_confirm_site = #{blConfirmSite}</if>
<if test= "confirmSiteDate != null " > and b.confirm_site_date = #{confirmSiteDate}</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > and b.confirm_site_man_code = #{confirmSiteManCode}</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > and b.confirm_site_note = #{confirmSiteNote}</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > and b.confirm_site_code = #{confirmSiteCode}</if>
2024-07-08 06:06:05 +00:00
2024-08-30 12:00:17 +00:00
<!-- 过滤掉虚拟单 -->
2025-01-20 09:00:36 +00:00
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
2024-08-30 12:00:17 +00:00
2024-07-08 09:30:14 +00:00
<if test= "params.sendSiteCode != null and params.sendSiteCode != ''" >
and a.send_site_code = #{params.sendSiteCode}
</if>
<if test= "params.dispatchUnderlingSiteCode != null and params.dispatchUnderlingSiteCode != ''" >
and a.dispatch_underling_site_code = #{params.dispatchUnderlingSiteCode}
</if>
2024-08-30 12:00:17 +00:00
<if test= "params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''" >
2025-01-20 09:00:36 +00:00
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} )
2024-08-30 12:00:17 +00:00
)
</if>
<if test= "params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''" >
2025-01-20 09:00:36 +00:00
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} )
2024-08-30 12:00:17 +00:00
)
</if>
<if test= "params.receiveCompany != null and params.receiveCompany != ''" >
and a.receive_company like concat('%', #{params.receiveCompany}, '%')
</if>
<if test= "params.sendCompany != null and params.sendCompany != ''" >
and a.send_company like concat('%', #{params.sendCompany}, '%')
</if>
2024-09-07 04:05:04 +00:00
<if test= "blMerge != null and blMerge != ''" > and b.bl_merge=#{blMerge}</if>
2024-08-30 12:00:17 +00:00
2024-11-13 01:27:39 +00:00
<if test= "paymentStatus != null and paymentStatus != ''" >
and b.payment_status=#{paymentStatus}
</if>
<if test= "openBillStatus != null and openBillStatus != ''" >
and b.open_bill_status=#{openBillStatus}
</if>
2024-07-09 08:48:34 +00:00
<if test= "params.mergeStatus != null and params.mergeStatus == 1" >
2024-07-10 01:05:23 +00:00
and b.bl_merge='0'
2024-07-09 22:42:16 +00:00
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
2024-07-10 01:05:23 +00:00
2024-07-09 08:48:34 +00:00
</if>
<if test= "params.mergeStatus != null and params.mergeStatus == 2" >
2024-07-10 01:05:23 +00:00
and b.bl_merge='1'
2024-07-09 22:42:16 +00:00
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
2024-07-09 08:48:34 +00:00
</if>
2024-08-30 12:00:17 +00:00
<if test= "params.transLineType != null and params.transLineType != ''" >
and a.trans_line_type = #{params.transLineType}
</if>
<if test= "params.productType != null and params.productType != ''" >
and a.product_type = #{params.productType}
</if>
2024-07-08 09:30:14 +00:00
<if test= "params.payee != null and params.payee != ''" >
and a.payee = #{params.payee}
</if>
2024-08-30 12:00:17 +00:00
2024-07-08 09:30:14 +00:00
<if test= "params.salesmen != null and params.salesmen != ''" >
and a.salesmen = #{params.salesmen}
</if>
<if test= "params.paymentType != null and params.paymentType != ''" >
and a.payment_type = #{params.paymentType}
</if>
2024-07-09 23:59:22 +00:00
<if test= "params.blSpecialQuote != null and params.blSpecialQuote != ''" >
and a.bl_special_quote = #{params.blSpecialQuote}
</if>
<if test= "params.calcFeeType != null and params.calcFeeType != ''" >
and a.calc_fee_type = #{params.calcFeeType}
</if>
2024-07-08 06:06:05 +00:00
<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>
2024-08-30 12:00:17 +00:00
<if test= "params.beginCreateTime != null and params.beginCreateTime != ''" >
and b.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test= "params.endCreateTime != null and params.endCreateTime != ''" >
and b.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
2024-07-08 06:06:05 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
and (
2024-08-07 14:04:09 +00:00
a.salesmen=#{params.privEmpName}
2024-08-30 12:00:17 +00:00
or a.payee=#{params.privEmpName}
2024-08-07 14:21:25 +00:00
or a.salesmen in(
2024-09-18 10:13:27 +00:00
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}
2024-08-07 14:04:09 +00:00
)
2024-07-08 06:06:05 +00:00
)
</if>
2024-07-03 19:17:36 +00:00
</where>
</select>
2024-07-11 01:56:46 +00:00
2024-11-21 03:49:58 +00:00
<select id= "getNoNeedOpenBillSum" parameterType= "String" resultType= "map" >
select
2025-05-07 02:34:18 +00:00
IFNULL(round(sum(bill_fee-invoiced_money),2),0) as totalNoNeed,count(1) as totalCnt
2024-11-21 03:49:58 +00:00
from emis_settle_sub_bill
2024-11-24 08:49:36 +00:00
where del_flag='0' and open_bill_status in('3','4') and `settle_bill_no`=#{settleBillNo}
2024-11-21 03:49:58 +00:00
</select>
2024-07-11 01:56:46 +00:00
<select id= "getMonthBillStatInfoMapList" parameterType= "EmisSettleSubBill" resultType= "map" >
select
count(a.bill_code) as totalNum,
round(sum(b.bill_fee),2) as totalBillFee,
b.cust_no as custNo,
2024-08-20 08:21:43 +00:00
max(b.cust_name) as custName,
2024-07-11 02:15:41 +00:00
sum(a.parcel_qty) as parcelQty,
sum(a.bill_weight) as totalBillWeight,
sum(a.total_volume) as totalVolume,
sum(a.volume_weight) as totalVolumeWeight,
sum(a.settlement_weight) as totalSettlementWeight,
sum(a.freight) as totalFreight
2024-07-11 01:56:46 +00:00
from emis_settle_sub_bill b ,emis_waybill a
<where >
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
and b.settle_type='2'
<if test= "id != null " > and b.id = #{id}</if>
<if test= "billNo != null and billNo != ''" > and FIND_IN_SET(b.`bill_no`,#{billNo}) </if>
<if test= "parentBillNo != null and parentBillNo != ''" > and b.parent_bill_no=#{parentBillNo}</if>
2024-08-19 00:37:42 +00:00
<if test= "settleBillNo != null and settleBillNo != ''" > and FIND_IN_SET(b.`settle_bill_no`,#{settleBillNo})</if>
2024-07-11 01:56:46 +00:00
<if test= "billCode != null and billCode != ''" > and ( FIND_IN_SET(b.`bill_code`,#{billCode}) or b.bill_code like concat('%', #{billCode}, '%') ) </if>
<if test= "billDate != null " > and bill_date = #{billDate}</if>
<if test= "billFee != null " > and bill_fee = #{billFee}</if>
<if test= "currency != null and currency != ''" > and currency= #{currency}</if>
<if test= "settleType != null and settleType != ''" > and settle_type=#{settleType}</if>
<if test= "blSplit != null and blSplit != ''" > and bl_split=#{blSplit}</if>
<if test= "billMonth != null and billMonth != ''" > and bill_month=#{billMonth}</if>
<if test= "custNo != null and custNo != ''" > and b.cust_no=#{custNo}</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > and b.cust_name like concat('%', #{custName}, '%')</if>
2024-07-11 01:56:46 +00:00
<if test= "customerCode != null and customerCode != ''" > and b.customer_code=#{customerCode}</if>
<if test= "customerName != null and customerName != ''" > and b.customer_name like concat('%', #{customerName}, '%')</if>
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > and b.bl_confirm_center = #{blConfirmCenter}</if>
<if test= "confirmCenterDate != null " > and b.confirm_center_date = #{confirmCenterDate}</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > and b.confirm_center_note = #{confirmCenterNote}</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > and b.confirm_center_man_code = #{confirmCenterManCode}</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > and b.confirm_center_code = #{confirmCenterCode}</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > and b.bl_confirm_site = #{blConfirmSite}</if>
<if test= "confirmSiteDate != null " > and b.confirm_site_date = #{confirmSiteDate}</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > and b.confirm_site_man_code = #{confirmSiteManCode}</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > and b.confirm_site_note = #{confirmSiteNote}</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > and b.confirm_site_code = #{confirmSiteCode}</if>
2024-09-03 02:39:28 +00:00
2025-01-20 09:00:36 +00:00
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
2024-09-03 02:39:28 +00:00
2024-07-11 01:56:46 +00:00
<if test= "params.sendSiteCode != null and params.sendSiteCode != ''" >
and a.send_site_code = #{params.sendSiteCode}
</if>
2024-09-03 02:39:28 +00:00
2024-07-11 01:56:46 +00:00
<if test= "params.dispatchUnderlingSiteCode != null and params.dispatchUnderlingSiteCode != ''" >
and a.dispatch_underling_site_code = #{params.dispatchUnderlingSiteCode}
</if>
2024-09-07 04:05:04 +00:00
<if test= "blMerge != null and blMerge != ''" > and b.bl_merge=#{blMerge}</if>
2024-11-13 01:27:39 +00:00
<if test= "paymentStatus != null and paymentStatus != ''" >
and b.payment_status=#{paymentStatus}
</if>
<if test= "openBillStatus != null and openBillStatus != ''" >
and b.open_bill_status=#{openBillStatus}
</if>
2024-07-11 01:56:46 +00:00
<if test= "params.mergeStatus != null and params.mergeStatus == 1" >
and b.bl_merge='0'
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
</if>
<if test= "params.mergeStatus != null and params.mergeStatus == 2" >
and b.bl_merge='1'
and b.bl_confirm_center='1'
and b.bl_confirm_site='1'
</if>
<if test= "params.payee != null and params.payee != ''" >
and a.payee = #{params.payee}
</if>
<if test= "params.salesmen != null and params.salesmen != ''" >
and a.salesmen = #{params.salesmen}
</if>
<if test= "params.paymentType != null and params.paymentType != ''" >
and a.payment_type = #{params.paymentType}
</if>
<if test= "params.blSpecialQuote != null and params.blSpecialQuote != ''" >
and a.bl_special_quote = #{params.blSpecialQuote}
</if>
<if test= "params.calcFeeType != null and params.calcFeeType != ''" >
and a.calc_fee_type = #{params.calcFeeType}
</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.privSiteCode != null and params.privSiteCode != '88888'" >
and (
2024-08-07 14:04:09 +00:00
a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
2024-08-07 14:21:25 +00:00
or a.salesmen in(
2024-09-18 10:13:27 +00:00
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}
2024-08-07 14:04:09 +00:00
)
2024-07-11 01:56:46 +00:00
)
</if>
</where>
group by b.cust_no
</select>
2024-07-03 19:17:36 +00:00
<select id= "checkUnique" parameterType= "EmisSettleSubBill" resultType= "int" >
select count(1) from emis_settle_sub_bill
where del_flag='0'
and id = #{id}
and bill_no = #{billNo}
and parent_bill_no = #{parentBillNo}
and settle_bill_no = #{settleBillNo}
and bill_code = #{billCode}
and bill_date = #{billDate}
and bill_fee = #{billFee}
and currency = #{currency}
and settle_type = #{settleType}
and bl_split = #{blSplit}
2024-07-09 22:42:16 +00:00
and bl_merge = #{blMerge}
2024-07-03 19:17:36 +00:00
and bill_month = #{billMonth}
and cust_no = #{custNo}
and customer_code = #{customerCode}
and customer_name = #{customerName}
2024-07-09 22:42:16 +00:00
and payee = #{payee}
and salesmen = #{salesmen}
and bl_special_quote = #{blSpecialQuote}
and bl_sensitive = #{blSensitive}
and bl_confirm_center = #{blConfirmCenter}
and confirm_center_date = #{confirmCenterDate}
and confirm_center_note = #{confirmCenterNote}
and confirm_center_man_code = #{confirmCenterManCode}
and confirm_center_code = #{confirmCenterCode}
and bl_confirm_site = #{blConfirmSite}
and confirm_site_date = #{confirmSiteDate}
and confirm_site_man_code = #{confirmSiteManCode}
and confirm_site_note = #{confirmSiteNote}
and confirm_site_code = #{confirmSiteCode}
2024-07-03 19:17:36 +00:00
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
2024-07-09 22:42:16 +00:00
2024-07-09 23:44:16 +00:00
2024-07-03 19:17:36 +00:00
<select id= "selectEmisSettleSubBillById" parameterType= "Long" resultMap= "EmisSettleSubBillResult" >
2024-11-04 09:02:59 +00:00
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-07-03 19:17:36 +00:00
from emis_settle_sub_bill a
where a.id = #{id}
</select>
2024-07-04 08:46:14 +00:00
2024-07-25 23:35:11 +00:00
<select id= "selectSettleSubBillListByBillCode" parameterType= "String" resultMap= "EmisSettleSubBillResult" >
2024-11-04 09:02:59 +00:00
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-07-04 08:46:14 +00:00
from emis_settle_sub_bill a
2024-07-25 23:35:11 +00:00
where a.del_flag='0' and a.bill_code = #{billCode}
2024-07-04 08:46:14 +00:00
</select>
2024-07-09 07:48:21 +00:00
2025-04-11 09:17:19 +00:00
<select id= "querysSettleSubBillByBillCodeList" parameterType= "String" resultMap= "EmisSettleSubBillResult" >
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_sub_bill a
where a.del_flag='0' and a.bill_code in
<foreach item= "billCode" collection= "billCodeList" open= "(" separator= "," close= ")" >
#{billCode}
</foreach>
</select>
2024-10-13 12:32:26 +00:00
2024-07-21 07:46:43 +00:00
<select id= "selectSubBillListBySettleBillNo" parameterType= "String" resultMap= "EmisSettleSubBillResult" >
2024-11-04 09:02:59 +00:00
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-07-21 07:46:43 +00:00
from emis_settle_sub_bill a
2024-07-25 23:35:11 +00:00
where a.settle_bill_no = #{settleBillNo} and del_flag='0'
2024-07-21 07:46:43 +00:00
</select>
2024-07-09 07:48:21 +00:00
<select id= "selectSettleSubBillBySubBillNo" parameterType= "String" resultMap= "EmisSettleSubBillResult" >
2024-11-04 09:02:59 +00:00
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-07-09 07:48:21 +00:00
from emis_settle_sub_bill a
where a.del_flag='0' and a.bill_no = #{subBillNo} limit 1
</select>
2024-07-09 22:42:16 +00:00
2024-07-03 19:17:36 +00:00
<insert id= "insertEmisSettleSubBill" parameterType= "EmisSettleSubBill" useGeneratedKeys= "true" keyProperty= "id" >
insert into emis_settle_sub_bill
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "billNo != null and billNo != ''" > bill_no,</if>
<if test= "parentBillNo != null and parentBillNo != ''" > parent_bill_no,</if>
<if test= "settleBillNo != null and settleBillNo != ''" > settle_bill_no,</if>
<if test= "billCode != null and billCode != ''" > bill_code,</if>
<if test= "billDate != null" > bill_date,</if>
<if test= "billFee != null" > bill_fee,</if>
<if test= "currency != null and currency != ''" > currency,</if>
<if test= "settleType != null and settleType != ''" > settle_type,</if>
<if test= "blSplit != null and blSplit != ''" > bl_split,</if>
2024-07-09 22:42:16 +00:00
<if test= "blMerge != null and blMerge != ''" > bl_merge,</if>
2024-07-03 19:17:36 +00:00
<if test= "billMonth != null and billMonth != ''" > bill_month,</if>
<if test= "custNo != null and custNo != ''" > cust_no,</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > cust_name,</if>
2024-07-03 19:17:36 +00:00
<if test= "customerCode != null and customerCode != ''" > customer_code,</if>
<if test= "customerName != null and customerName != ''" > customer_name,</if>
2024-11-04 09:02:59 +00:00
<if test= "invoicedMoney != null" > invoiced_money,</if>
<if test= "recedMoney != null" > reced_money,</if>
<if test= "satisfyMoney != null" > satisfy_money,</if>
<if test= "allowanceMoney != null" > allowance_money,</if>
<if test= "deductionMoney != null" > deduction_money,</if>
<if test= "otherMoney != null" > other_money,</if>
<if test= "satisfyReason != null and satisfyReason != ''" > satisfy_reason,</if>
<if test= "allowanceReason != null and allowanceReason != ''" > allowance_reason,</if>
<if test= "deductionReason != null and deductionReason != ''" > deduction_reason,</if>
<if test= "otherReason != null and otherReason != ''" > other_reason,</if>
<if test= "openBillStatus != null and openBillStatus != ''" > open_bill_status,</if>
<if test= "paymentStatus != null and paymentStatus != ''" > payment_status,</if>
<if test= "chargeStatus != null and chargeStatus != ''" > charge_status,</if>
2024-07-09 22:42:16 +00:00
<if test= "payee != null and payee != ''" > payee,</if>
<if test= "salesmen != null and salesmen != ''" > salesmen,</if>
<if test= "blSpecialQuote != null and blSpecialQuote != ''" > bl_special_quote,</if>
<if test= "blSensitive != null and blSensitive != ''" > bl_sensitive,</if>
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > bl_confirm_center,</if>
<if test= "confirmCenterDate != null" > confirm_center_date,</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > confirm_center_note,</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > confirm_center_man_code,</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > confirm_center_code,</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > bl_confirm_site,</if>
<if test= "confirmSiteDate != null" > confirm_site_date,</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > confirm_site_man_code,</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > confirm_site_note,</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > confirm_site_code,</if>
2024-07-03 19:17:36 +00:00
<if test= "delFlag != null and delFlag != ''" > del_flag,</if>
<if test= "createBy != null and createBy != ''" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null and updateBy != ''" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "createSite != null and createSite != ''" > create_site,</if>
<if test= "updateSite != null and updateSite != ''" > update_site,</if>
2024-07-09 22:42:16 +00:00
</trim>
2024-07-03 19:17:36 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "billNo != null and billNo != ''" > #{billNo},</if>
<if test= "parentBillNo != null and parentBillNo != ''" > #{parentBillNo},</if>
<if test= "settleBillNo != null and settleBillNo != ''" > #{settleBillNo},</if>
<if test= "billCode != null and billCode != ''" > #{billCode},</if>
<if test= "billDate != null" > #{billDate},</if>
<if test= "billFee != null" > #{billFee},</if>
<if test= "currency != null and currency != ''" > #{currency},</if>
<if test= "settleType != null and settleType != ''" > #{settleType},</if>
<if test= "blSplit != null and blSplit != ''" > #{blSplit},</if>
2024-07-09 22:42:16 +00:00
<if test= "blMerge != null and blMerge != ''" > #{blMerge},</if>
2024-07-03 19:17:36 +00:00
<if test= "billMonth != null and billMonth != ''" > #{billMonth},</if>
<if test= "custNo != null and custNo != ''" > #{custNo},</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > #{custName},</if>
2024-07-03 19:17:36 +00:00
<if test= "customerCode != null and customerCode != ''" > #{customerCode},</if>
<if test= "customerName != null and customerName != ''" > #{customerName},</if>
2024-11-04 09:02:59 +00:00
<if test= "invoicedMoney != null" > #{invoicedMoney},</if>
<if test= "recedMoney != null" > #{recedMoney},</if>
<if test= "satisfyMoney != null" > #{satisfyMoney},</if>
<if test= "allowanceMoney != null" > #{allowanceMoney},</if>
<if test= "deductionMoney != null" > #{deductionMoney},</if>
<if test= "otherMoney != null" > #{otherMoney},</if>
<if test= "satisfyReason != null and satisfyReason != ''" > #{satisfyReason},</if>
<if test= "allowanceReason != null and allowanceReason != ''" > #{allowanceReason},</if>
<if test= "deductionReason != null and deductionReason != ''" > #{deductionReason},</if>
<if test= "otherReason != null and otherReason != ''" > #{otherReason},</if>
<if test= "openBillStatus != null and openBillStatus != ''" > #{openBillStatus},</if>
<if test= "paymentStatus != null and paymentStatus != ''" > #{paymentStatus},</if>
<if test= "chargeStatus != null and chargeStatus != ''" > #{chargeStatus},</if>
2024-07-09 22:42:16 +00:00
<if test= "payee != null and payee != ''" > #{payee},</if>
<if test= "salesmen != null and salesmen != ''" > #{salesmen},</if>
<if test= "blSpecialQuote != null and blSpecialQuote != ''" > #{blSpecialQuote},</if>
<if test= "blSensitive != null and blSensitive != ''" > #{blSensitive},</if>
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > #{blConfirmCenter},</if>
<if test= "confirmCenterDate != null" > #{confirmCenterDate},</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > #{confirmCenterNote},</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > #{confirmCenterManCode},</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > #{confirmCenterCode},</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > #{blConfirmSite},</if>
<if test= "confirmSiteDate != null" > #{confirmSiteDate},</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > #{confirmSiteManCode},</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > #{confirmSiteNote},</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > #{confirmSiteCode},</if>
2024-07-03 19:17:36 +00:00
<if test= "delFlag != null and delFlag != ''" > #{delFlag},</if>
<if test= "createBy != null and createBy != ''" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null and updateBy != ''" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "createSite != null and createSite != ''" > #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > #{updateSite},</if>
2024-07-09 22:42:16 +00:00
</trim>
2024-07-03 19:17:36 +00:00
</insert>
<update id= "updateEmisSettleSubBill" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
<if test= "parentBillNo != null and parentBillNo != ''" > parent_bill_no = #{parentBillNo},</if>
<if test= "settleBillNo != null and settleBillNo != ''" > settle_bill_no = #{settleBillNo},</if>
<if test= "billCode != null and billCode != ''" > bill_code = #{billCode},</if>
<if test= "billDate != null" > bill_date = #{billDate},</if>
<if test= "billFee != null" > bill_fee = #{billFee},</if>
<if test= "currency != null and currency != ''" > currency = #{currency},</if>
<if test= "settleType != null and settleType != ''" > settle_type = #{settleType},</if>
<if test= "blSplit != null and blSplit != ''" > bl_split = #{blSplit},</if>
2024-07-09 22:42:16 +00:00
<if test= "blMerge != null and blMerge != ''" > bl_merge = #{blMerge},</if>
2024-07-03 19:17:36 +00:00
<if test= "billMonth != null and billMonth != ''" > bill_month = #{billMonth},</if>
<if test= "custNo != null and custNo != ''" > cust_no = #{custNo},</if>
2024-07-20 08:09:53 +00:00
<if test= "custName != null and custName != ''" > cust_name = #{custName},</if>
2024-07-03 19:17:36 +00:00
<if test= "customerCode != null and customerCode != ''" > customer_code = #{customerCode},</if>
<if test= "customerName != null and customerName != ''" > customer_name = #{customerName},</if>
2024-11-04 09:02:59 +00:00
<if test= "invoicedMoney != null" > invoiced_money = #{invoicedMoney},</if>
<if test= "recedMoney != null" > reced_money = #{recedMoney},</if>
<if test= "satisfyMoney != null" > satisfy_money = #{satisfyMoney},</if>
<if test= "allowanceMoney != null" > allowance_money = #{allowanceMoney},</if>
<if test= "deductionMoney != null" > deduction_money = #{deductionMoney},</if>
<if test= "otherMoney != null" > other_money = #{otherMoney},</if>
<if test= "satisfyReason != null and satisfyReason != ''" > satisfy_reason = #{satisfyReason},</if>
<if test= "allowanceReason != null and allowanceReason != ''" > allowance_reason = #{allowanceReason},</if>
<if test= "deductionReason != null and deductionReason != ''" > deduction_reason = #{deductionReason},</if>
<if test= "otherReason != null and otherReason != ''" > other_reason = #{otherReason},</if>
<if test= "openBillStatus != null and openBillStatus != ''" > open_bill_status = #{openBillStatus},</if>
<if test= "paymentStatus != null and paymentStatus != ''" > payment_status = #{paymentStatus},</if>
<if test= "chargeStatus != null and chargeStatus != ''" > charge_status = #{chargeStatus},</if>
2024-07-09 22:42:16 +00:00
<if test= "payee != null and payee != ''" > payee = #{payee},</if>
<if test= "salesmen != null and salesmen != ''" > salesmen = #{salesmen},</if>
<if test= "blSpecialQuote != null and blSpecialQuote != ''" > bl_special_quote = #{blSpecialQuote},</if>
<if test= "blSensitive != null and blSensitive != ''" > bl_sensitive = #{blSensitive},</if>
<if test= "blConfirmCenter != null and blConfirmCenter != ''" > bl_confirm_center = #{blConfirmCenter},</if>
<if test= "confirmCenterDate != null" > confirm_center_date = #{confirmCenterDate},</if>
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > confirm_center_note = #{confirmCenterNote},</if>
<if test= "confirmCenterManCode != null and confirmCenterManCode != ''" > confirm_center_man_code = #{confirmCenterManCode},</if>
<if test= "confirmCenterCode != null and confirmCenterCode != ''" > confirm_center_code = #{confirmCenterCode},</if>
<if test= "blConfirmSite != null and blConfirmSite != ''" > bl_confirm_site = #{blConfirmSite},</if>
<if test= "confirmSiteDate != null" > confirm_site_date = #{confirmSiteDate},</if>
<if test= "confirmSiteManCode != null and confirmSiteManCode != ''" > confirm_site_man_code = #{confirmSiteManCode},</if>
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > confirm_site_note = #{confirmSiteNote},</if>
<if test= "confirmSiteCode != null and confirmSiteCode != ''" > confirm_site_code = #{confirmSiteCode},</if>
2024-07-03 19:17:36 +00:00
<if test= "delFlag != null and delFlag != ''" > del_flag = #{delFlag},</if>
<if test= "createBy != null and createBy != ''" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "createSite != null and createSite != ''" > create_site = #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-11-04 09:02:59 +00:00
where id = #{id}
2024-07-03 19:17:36 +00:00
</update>
2024-07-09 07:48:21 +00:00
<!-- 更新合账单 -->
2024-07-21 07:46:43 +00:00
<update id= "addToSettleBill" parameterType= "EmisSettleSubBill" >
2024-07-09 07:48:21 +00:00
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 09:00:18 +00:00
settle_bill_no = #{settleBillNo},
2024-07-10 03:37:56 +00:00
bl_merge = '1',
2024-07-09 07:48:21 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
2024-07-21 07:46:43 +00:00
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-21 07:46:43 +00:00
</update>
<!-- 更新合账单 -->
<update id= "removeFromMainSettleBill" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
settle_bill_no = null,
bl_merge = '0',
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
2024-07-09 07:48:21 +00:00
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-09 07:48:21 +00:00
</update>
2024-07-10 03:37:56 +00:00
<update id= "batchUpdateMainSettleBillNo" parameterType= "String" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
settle_bill_no = #{settleBillNo},
bl_merge = '1',
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where del_flag='0' and id in
2024-07-10 03:37:56 +00:00
<foreach item= "id" collection= "ids" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</update>
2024-07-06 07:10:38 +00:00
<!-- 中心确认 -->
2024-07-03 23:08:14 +00:00
<update id= "confirmBillByCenter" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_center = '1',
confirm_center_date = now(),
confirm_center_man_code = #{confirmCenterManCode},
2025-06-18 02:07:59 +00:00
<if test= "confirmCenterNote != null and confirmCenterNote != ''" > confirm_center_note = #{confirmCenterNote},</if>
2024-07-03 23:08:14 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-03 23:08:14 +00:00
</update>
2024-07-06 07:10:38 +00:00
<!-- 中心取消确认 -->
2024-07-03 23:08:14 +00:00
<update id= "cancelConfirmBillByCenter" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_center = '0',
confirm_center_date = null,
confirm_center_man_code =null,
2024-07-06 07:10:38 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-06 07:10:38 +00:00
</update>
2024-07-07 02:05:30 +00:00
<!-- 中心确认不出账 2 -->
2024-07-06 07:10:38 +00:00
<update id= "confirmNoBillByCenter" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_center = '2',
confirm_center_date = now(),
confirm_center_man_code = #{confirmCenterManCode},
confirm_center_note = #{confirmCenterNote},
2024-07-06 07:10:38 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-06 07:10:38 +00:00
</update>
2024-07-07 02:05:30 +00:00
<!-- 中心账单设置异常 3 -->
2024-07-06 07:10:38 +00:00
<update id= "setBillErrorByCenter" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_center = '3',
confirm_center_date = now(),
confirm_center_man_code = #{confirmCenterManCode},
confirm_center_note = #{confirmCenterNote},
2024-07-03 23:08:14 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-03 23:08:14 +00:00
</update>
2024-07-07 02:05:30 +00:00
<!-- 站点业务确认 -->
2024-07-03 23:08:14 +00:00
<update id= "confirmBillBySite" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_site = '1',
confirm_site_date = now(),
confirm_site_code = #{confirmSiteCode},
confirm_site_man_code = #{confirmSiteManCode},
2025-06-18 02:07:59 +00:00
<if test= "confirmSiteNote != null and confirmSiteNote != ''" > confirm_site_note = #{confirmSiteNote},</if>
2024-07-03 23:08:14 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-03 23:08:14 +00:00
</update>
2024-07-06 07:10:38 +00:00
<!-- 站点取消确认 -->
2024-07-03 23:08:14 +00:00
<update id= "cancelConfirmBillBySite" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_site = '0',
confirm_site_date = null,
confirm_site_man_code =null,
confirm_site_code = null,
confirm_site_note = null,
2024-07-07 02:05:30 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-07 02:05:30 +00:00
</update>
<!-- 站点确认不出账 2 -->
<update id= "confirmNoBillBySite" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_site = '2',
confirm_site_date = now(),
confirm_site_man_code = #{confirmSiteManCode},
confirm_site_code = #{confirmSiteCode},
confirm_site_note = #{confirmSiteNote},
2024-07-07 02:05:30 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-07 02:05:30 +00:00
</update>
<!-- 站点账单设置异常 3 -->
<update id= "setBillErrorBySite" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
<trim prefix= "SET" suffixOverrides= "," >
2024-07-09 23:44:16 +00:00
bl_confirm_site = '3',
confirm_site_date = now(),
confirm_site_man_code = #{confirmSiteManCode},
confirm_site_code = #{confirmSiteCode},
confirm_site_note = #{confirmSiteNote},
2024-07-03 23:08:14 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-07-25 23:35:11 +00:00
where id = #{id} and del_flag='0'
2024-07-03 23:08:14 +00:00
</update>
2024-11-13 01:37:45 +00:00
<update id= "updatePayedStatus" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
2024-11-13 02:24:19 +00:00
set payment_status=#{paymentStatus},reced_money=#{recedMoney}
2024-11-13 01:37:45 +00:00
where bill_code=#{billCode}
</update>
2024-11-13 02:24:19 +00:00
2024-11-17 01:17:43 +00:00
<update id= "setNoNeedOpenBill" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
set open_bill_status='3'
where id=#{id}
</update>
2024-11-24 04:41:45 +00:00
<update id= "setCompleteOpenBill" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
set open_bill_status='4'
where id=#{id}
</update>
2024-11-13 02:24:19 +00:00
<update id= "updateOpenBillStatus" parameterType= "EmisSettleSubBill" >
update emis_settle_sub_bill
set open_bill_status=#{openBillStatus},invoiced_money=#{invoicedMoney}
where bill_code=#{billCode}
</update>
2024-07-08 08:53:58 +00:00
<delete id= "deleteEmisSettleSubBillByBillCode" parameterType= "String" >
update emis_settle_sub_bill set del_flag='1' where bill_code = #{billCode} and del_flag='0'
</delete>
2024-07-03 23:08:14 +00:00
2024-07-03 19:17:36 +00:00
<delete id= "deleteEmisSettleSubBillById" parameterType= "Long" >
2024-07-08 08:53:58 +00:00
update emis_settle_sub_bill set del_flag='1' where id = #{id}
2024-07-03 19:17:36 +00:00
</delete>
<delete id= "deleteEmisSettleSubBillByIds" parameterType= "String" >
2024-07-08 08:53:58 +00:00
update emis_settle_sub_bill set del_flag='1' where id in
2024-07-03 19:17:36 +00:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>