2024-03-01 06:47:57 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2024-06-03 05:55:23 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-03-01 06:47:57 +00:00
<mapper namespace= "com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMapper" >
2024-06-03 05:55:23 +00:00
2024-06-02 02:57:46 +00:00
<resultMap type= "EmisTmsSiteBatch" id= "EmisTmsSiteBatchResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-03-01 06:47:57 +00:00
<result property= "id" column= "id" />
2024-06-03 05:55:23 +00:00
<result property= "batchNo" column= "batch_no" />
2024-03-01 06:47:57 +00:00
<result property= "batchName" column= "batch_name" />
<result property= "batchDate" column= "batch_date" />
2025-02-14 02:18:13 +00:00
<result property= "supplierCode" column= "supplier_code" />
2024-06-07 05:10:38 +00:00
<result property= "transLineType" column= "trans_line_type" />
<result property= "productType" column= "product_type" />
2024-06-03 05:55:23 +00:00
<result property= "batchType" column= "batch_type" />
2024-03-01 06:47:57 +00:00
<result property= "transType" column= "trans_type" />
2024-06-08 04:51:13 +00:00
<result property= "startSiteCode" column= "start_site_code" />
2024-11-19 08:22:29 +00:00
<result property= "sendCountry" column= "send_country" />
2024-03-01 06:47:57 +00:00
<result property= "nextSiteCode" column= "next_site_code" />
<result property= "airBilllNo" column= "air_billl_no" />
<result property= "etd" column= "etd" />
<result property= "eta" column= "eta" />
<result property= "carNo" column= "car_no" />
<result property= "shipNo" column= "ship_no" />
<result property= "clearanceResStatus" column= "clearance_res_status" />
<result property= "declareResStatus" column= "declare_res_status" />
2024-06-03 05:55:23 +00:00
<result property= "destCountry" column= "dest_country" />
2025-02-14 02:18:13 +00:00
<result property= "destCountryName" column= "dest_country_name" />
<result property= "transWeight" column= "trans_weight" />
<result property= "packNum" column= "pack_num" />
2024-06-03 05:55:23 +00:00
<result property= "totalParcelQty" column= "total_parcel_qty" />
<result property= "totalWaybillQty" column= "total_waybill_qty" />
<result property= "totalVolume" column= "total_volume" />
<result property= "totalWeight" column= "total_weight" />
2025-07-10 21:45:29 +00:00
<result property= "totalSettlementWeight" column= "total_settlement_weight" />
2024-06-03 05:55:23 +00:00
<result property= "opMan" column= "op_man" />
2025-04-01 02:41:37 +00:00
<result property= "blEntering" column= "bl_entering" />
2024-06-07 05:10:38 +00:00
2025-02-14 02:18:13 +00:00
<!-- 扩展 -->
2025-07-03 03:24:09 +00:00
<association property= "supplierName" column= "supplier_code" select= "com.xdadan.erp.emis.mapper.EmisSupplierMapper.selectSupplierNameByCode" />
2024-06-07 05:10:38 +00:00
<association property= "productTypeName" column= "product_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode" />
<association property= "transLineTypeName" column= "trans_line_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode" />
2024-06-08 04:57:22 +00:00
<association property= "sendCountryName" column= "trans_line_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectFromCountryNameByLineCode" />
<association property= "destCountryName" column= "dest_country" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode" />
2024-06-07 05:10:38 +00:00
2024-07-31 13:21:08 +00:00
<association property= "startSiteName" column= "start_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
<association property= "nextSiteName" column= "next_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
2025-05-13 19:47:53 +00:00
</resultMap>
2025-07-02 11:52:44 +00:00
<resultMap type= "EmisTmsSiteBatch" id= "EmisTransPlanRuleSimpleResult" >
<result property= "id" column= "id" />
<result property= "lineCode" column= "line_code" />
<result property= "productType" column= "product_type" />
<result property= "startSiteCode" column= "start_site_code" />
<result property= "nextSiteCode" column= "next_site_code" />
<result property= "manager" column= "manager" />
<result property= "supplierCode" column= "supplier_code" />
<result property= "startDate" column= "start_date" />
<result property= "endDate" column= "end_date" />
<result property= "etd" column= "etd" />
<collection property= "batchDtlList" ofType= "com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl" >
<result property= "billCode" column= "bill_code" />
2025-08-20 08:22:34 +00:00
<result property= "waybillBatchStatus" column= "waybill_batch_status" />
2025-07-02 11:52:44 +00:00
</collection>
</resultMap>
2025-05-13 19:47:53 +00:00
<resultMap type= "EmisTmsSiteBatch" id= "EmisTmsSiteBatchDtlResult" extends= "EmisTmsSiteBatchResult" >
<result property= "id" column= "id" />
<result property= "batchNo" column= "batch_no" />
<result property= "batchName" column= "batch_name" />
<result property= "batchDate" column= "batch_date" />
<result property= "supplierCode" column= "supplier_code" />
<result property= "transLineType" column= "trans_line_type" />
<result property= "productType" column= "product_type" />
<result property= "batchType" column= "batch_type" />
<result property= "transType" column= "trans_type" />
<result property= "startSiteCode" column= "start_site_code" />
<result property= "sendCountry" column= "send_country" />
<result property= "nextSiteCode" column= "next_site_code" />
<result property= "airBilllNo" column= "air_billl_no" />
<result property= "etd" column= "etd" />
<result property= "eta" column= "eta" />
<result property= "carNo" column= "car_no" />
<result property= "shipNo" column= "ship_no" />
<result property= "clearanceResStatus" column= "clearance_res_status" />
<result property= "declareResStatus" column= "declare_res_status" />
<result property= "destCountry" column= "dest_country" />
<result property= "destCountryName" column= "dest_country_name" />
<result property= "transWeight" column= "trans_weight" />
<result property= "packNum" column= "pack_num" />
<result property= "totalParcelQty" column= "total_parcel_qty" />
<result property= "totalWaybillQty" column= "total_waybill_qty" />
<result property= "totalVolume" column= "total_volume" />
<result property= "totalWeight" column= "total_weight" />
<result property= "opMan" column= "op_man" />
<result property= "blEntering" column= "bl_entering" />
<!-- 扩展 -->
2025-07-03 03:24:09 +00:00
<association property= "supplierName" column= "supplier_code" select= "com.xdadan.erp.emis.mapper.EmisSupplierMapper.selectSupplierNameByCode" />
2025-05-13 19:47:53 +00:00
<association property= "productTypeName" column= "product_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode" />
<association property= "transLineTypeName" column= "trans_line_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode" />
<association property= "sendCountryName" column= "trans_line_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectFromCountryNameByLineCode" />
<association property= "destCountryName" column= "dest_country" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode" />
<association property= "startSiteName" column= "start_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
<association property= "nextSiteName" column= "next_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode" />
2024-07-31 13:21:08 +00:00
2025-05-09 09:32:01 +00:00
<!-- 批次明细列表 -->
<collection property= "batchDtlList" ofType= "EmisTmsSiteBatchDtl" select= "com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column= "batch_no" >
<result property= "id" column= "id" />
<result property= "billCode" column= "bill_code" />
<result property= "batchNo" column= "batch_no" />
<result property= "scanDate" column= "scan_date" />
<result property= "scanStatus" column= "scan_status" />
<result property= "groupStatus" column= "group_status" />
<result property= "scanMan" column= "scan_man" />
<result property= "scanSite" column= "scan_site" />
<association property= "waybillDetail" column= "bill_code" select= "com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode" />
</collection>
2024-03-01 06:47:57 +00:00
</resultMap>
2025-06-25 06:46:07 +00:00
<resultMap type= "EmisTmsSiteBatch" id= "EmisTmsSiteBatchWithDetailsResult" extends= "EmisTmsSiteBatchResult" >
<!-- 批次明细列表 -->
<collection property= "batchDtlList" ofType= "EmisTmsSiteBatchDtl" select= "com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column= "batch_no" >
<result property= "id" column= "id" />
<result property= "billCode" column= "bill_code" />
<result property= "batchNo" column= "batch_no" />
<result property= "scanDate" column= "scan_date" />
<result property= "scanStatus" column= "scan_status" />
<result property= "groupStatus" column= "group_status" />
<result property= "scanMan" column= "scan_man" />
<result property= "scanSite" column= "scan_site" />
<association property= "waybillDetail" column= "bill_code" select= "com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode" />
</collection>
<!-- 装载信息列表 -->
<collection property= "loadingList" ofType= "EmisTmsSiteBatchLoading" select= "com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper.selectEmisTmsSiteBatchLoadingByBatchNo" column= "batch_no" >
<result property= "id" column= "id" />
<result property= "batchNo" column= "batch_no" />
<result property= "posNo" column= "pos_no" />
<result property= "row" column= "row" />
<result property= "col" column= "col" />
<result property= "layer" column= "layer" />
<result property= "posDesc" column= "pos_desc" />
</collection>
</resultMap>
2024-03-01 06:47:57 +00:00
<sql id= "selectEmisTmsSiteBatchVo" >
2025-07-10 21:45:29 +00:00
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering from emis_tms_site_batch
2024-03-01 06:47:57 +00:00
</sql>
<select id= "selectEmisTmsSiteBatchList" parameterType= "EmisTmsSiteBatch" resultMap= "EmisTmsSiteBatchResult" >
<include refid= "selectEmisTmsSiteBatchVo" />
2024-06-03 05:55:23 +00:00
<where >
del_flag='0'
2024-03-01 06:47:57 +00:00
<if test= "id != null " > and id = #{id}</if>
2025-06-17 06:00:22 +00:00
<if test= "batchNo != null and batchNo != ''" > and FIND_IN_SET(`batch_no`,#{batchNo})</if>
2024-12-05 10:01:32 +00:00
<if test= "batchName != null and batchName != ''" > and ( batch_name like concat('%', #{batchName}, '%') )</if>
2024-06-03 05:55:23 +00:00
<if test= "batchDate != null " > and batch_date = #{batchDate}</if>
2024-06-13 14:42:49 +00:00
<if test= "transLineType != null and transLineType != ''" > and trans_line_type=#{transLineType}</if>
<if test= "productType != null and productType != ''" > and product_type=#{productType}</if>
<if test= "batchType != null and batchType != ''" > and batch_type=#{batchType}</if>
<if test= "transType != null and transType != ''" > and trans_type=#{transType}</if>
<if test= "startSiteCode != null and startSiteCode != ''" > and start_site_code=#{startSiteCode}</if>
<if test= "sendCountry != null and sendCountry != ''" > and send_country=#{sendCountry}</if>
<if test= "nextSiteCode != null and nextSiteCode != ''" > and next_site_code=#{nextSiteCode}</if>
<if test= "airBilllNo != null and airBilllNo != ''" > and air_billl_no=#{airBilllNo}</if>
2025-02-14 02:27:10 +00:00
<if test= "supplierCode != null and supplierCode != ''" > and supplier_code=#{supplierCode}</if>
<if test= "supplierName != null and supplierName != ''" > and supplier_name like concat('%', #{supplierName}, '%')</if>
2024-06-03 05:55:23 +00:00
<if test= "etd != null " > and etd = #{etd}</if>
<if test= "eta != null " > and eta = #{eta}</if>
<if test= "packNum != null " > and pack_num = #{packNum}</if>
2025-12-01 01:34:28 +00:00
<if test= "carNo != null and carNo != ''" > and FIND_IN_SET(`car_no`,#{carNo})</if>
2024-06-13 14:42:49 +00:00
<if test= "shipNo != null and shipNo != ''" > and ship_no=#{shipNo}</if>
<if test= "clearanceResStatus != null and clearanceResStatus != ''" > and clearance_res_status= #{clearanceResStatus}</if>
<if test= "declareResStatus != null and declareResStatus != ''" > and declare_res_status=#{declareResStatus}</if>
<if test= "destCountry != null and destCountry != ''" > and dest_country=#{destCountry}</if>
2024-06-03 05:55:23 +00:00
<if test= "destCountryName != null and destCountryName != ''" > and dest_country_name like concat('%', #{destCountryName}, '%')</if>
<if test= "totalParcelQty != null " > and total_parcel_qty = #{totalParcelQty}</if>
<if test= "totalWaybillQty != null " > and total_waybill_qty = #{totalWaybillQty}</if>
<if test= "totalVolume != null " > and total_volume = #{totalVolume}</if>
<if test= "totalWeight != null " > and total_weight = #{totalWeight}</if>
<if test= "opMan != null and opMan != ''" > and op_man like concat('%', #{opMan}, '%')</if>
<if test= "remark != null and remark != ''" > and remark like concat('%', #{remark}, '%')</if>
<if test= "tenantId != null and tenantId != ''" > and tenant_id like concat('%', #{tenantId}, '%')</if>
2024-03-01 06:47:57 +00:00
<if test= "delFlag != null and delFlag != ''" > and del_flag like concat('%', #{delFlag}, '%')</if>
2025-02-21 08:50:53 +00:00
<if test= "createBy != null and createBy != ''" > and create_by=#{createBy}</if>
2024-03-01 06:47:57 +00:00
<if test= "createTime != null " > and create_time = #{createTime}</if>
2025-02-21 08:50:53 +00:00
<if test= "updateBy != null and updateBy != ''" > and update_by=#{updateBy}</if>
2024-03-01 06:47:57 +00:00
<if test= "updateTime != null " > and update_time = #{updateTime}</if>
2024-06-13 14:42:49 +00:00
<if test= "createSite != null and createSite != ''" > and create_site=#{createSite}</if>
<if test= "updateSite != null and updateSite != ''" > and update_site=#{updateSite}</if>
2025-07-07 03:04:59 +00:00
<if test= "blEntering==1" > and bl_entering=#{blEntering}</if>
<if test= "blEntering==-1" > and bl_entering='0'</if>
2024-06-13 14:42:49 +00:00
2024-12-05 10:01:32 +00:00
<if test= "searchValue != null and searchValue != '' " >
2025-03-16 03:17:09 +00:00
and ( batch_no like concat('%', #{searchValue},'%') or batch_name like concat('%', #{searchValue},'%') or car_no like concat('%', #{searchValue},'%') )
2024-12-05 10:01:32 +00:00
</if>
2024-11-22 06:57:22 +00:00
<if test= "params.billCode != null and params.billCode != ''" >
2025-01-09 07:07:30 +00:00
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0' and FIND_IN_SET(`bill_code`,#{params.billCode}) )
2024-11-22 06:57:22 +00:00
</if>
2024-06-13 14:42:49 +00:00
<if test= "params.beginCreateTime != null and params.beginCreateTime != ''" >
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test= "params.endCreateTime != null and params.endCreateTime != ''" >
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
2025-02-21 09:32:02 +00:00
<if test= "params.beginEtd != null and params.beginEtd != ''" >
and etd <![CDATA[ >= ]]> #{params.beginEtd}
</if>
<if test= "params.endEtd != null and params.endEtd != ''" >
and etd <![CDATA[ <= ]]> #{params.endEtd}
</if>
2024-06-13 14:42:49 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
and (
2025-03-18 03:03:03 +00:00
start_site_code=#{params.privSiteCode}
or create_site=#{params.privSiteCode}
2025-12-11 08:48:41 +00:00
or next_site_code=#{params.privSiteCode}
2024-06-13 14:42:49 +00:00
)
</if>
2024-03-01 06:47:57 +00:00
</where>
order by create_time desc
</select>
2024-06-03 05:55:23 +00:00
2025-05-13 19:47:53 +00:00
<select id= "selectEmisTmsSiteBatchDtlList" parameterType= "EmisTmsSiteBatch" resultMap= "EmisTmsSiteBatchDtlResult" >
<include refid= "selectEmisTmsSiteBatchVo" />
<where >
del_flag='0'
<if test= "id != null " > and id = #{id}</if>
2025-06-17 06:01:26 +00:00
<if test= "batchNo != null and batchNo != ''" > and `batch_no`= #{batchNo} </if>
2025-05-13 19:47:53 +00:00
<if test= "batchName != null and batchName != ''" > and ( batch_name like concat('%', #{batchName}, '%') )</if>
<if test= "batchDate != null " > and batch_date = #{batchDate}</if>
<if test= "transLineType != null and transLineType != ''" > and trans_line_type=#{transLineType}</if>
<if test= "productType != null and productType != ''" > and product_type=#{productType}</if>
<if test= "batchType != null and batchType != ''" > and batch_type=#{batchType}</if>
<if test= "transType != null and transType != ''" > and trans_type=#{transType}</if>
<if test= "startSiteCode != null and startSiteCode != ''" > and start_site_code=#{startSiteCode}</if>
<if test= "sendCountry != null and sendCountry != ''" > and send_country=#{sendCountry}</if>
<if test= "nextSiteCode != null and nextSiteCode != ''" > and next_site_code=#{nextSiteCode}</if>
<if test= "airBilllNo != null and airBilllNo != ''" > and air_billl_no=#{airBilllNo}</if>
<if test= "supplierCode != null and supplierCode != ''" > and supplier_code=#{supplierCode}</if>
<if test= "supplierName != null and supplierName != ''" > and supplier_name like concat('%', #{supplierName}, '%')</if>
<if test= "etd != null " > and etd = #{etd}</if>
<if test= "eta != null " > and eta = #{eta}</if>
<if test= "packNum != null " > and pack_num = #{packNum}</if>
<if test= "carNo != null and carNo != ''" > and car_no like concat('%', #{carNo}, '%')</if>
<if test= "shipNo != null and shipNo != ''" > and ship_no=#{shipNo}</if>
<if test= "clearanceResStatus != null and clearanceResStatus != ''" > and clearance_res_status= #{clearanceResStatus}</if>
<if test= "declareResStatus != null and declareResStatus != ''" > and declare_res_status=#{declareResStatus}</if>
<if test= "destCountry != null and destCountry != ''" > and dest_country=#{destCountry}</if>
<if test= "destCountryName != null and destCountryName != ''" > and dest_country_name like concat('%', #{destCountryName}, '%')</if>
<if test= "totalParcelQty != null " > and total_parcel_qty = #{totalParcelQty}</if>
<if test= "totalWaybillQty != null " > and total_waybill_qty = #{totalWaybillQty}</if>
<if test= "totalVolume != null " > and total_volume = #{totalVolume}</if>
<if test= "totalWeight != null " > and total_weight = #{totalWeight}</if>
<if test= "opMan != null and opMan != ''" > and op_man like concat('%', #{opMan}, '%')</if>
<if test= "remark != null and remark != ''" > and remark like concat('%', #{remark}, '%')</if>
<if test= "tenantId != null and tenantId != ''" > and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test= "delFlag != null and delFlag != ''" > and del_flag like concat('%', #{delFlag}, '%')</if>
<if test= "createBy != null and createBy != ''" > and create_by=#{createBy}</if>
<if test= "createTime != null " > and create_time = #{createTime}</if>
<if test= "updateBy != null and updateBy != ''" > and update_by=#{updateBy}</if>
<if test= "updateTime != null " > and update_time = #{updateTime}</if>
<if test= "createSite != null and createSite != ''" > and create_site=#{createSite}</if>
<if test= "updateSite != null and updateSite != ''" > and update_site=#{updateSite}</if>
2025-07-07 03:04:59 +00:00
<if test= "blEntering==1" > and bl_entering=#{blEntering}</if>
<if test= "blEntering==-1" > and bl_entering='0'</if>
2025-05-13 19:47:53 +00:00
<if test= "searchValue != null and searchValue != '' " >
and ( batch_no like concat('%', #{searchValue},'%') or batch_name like concat('%', #{searchValue},'%') or car_no like concat('%', #{searchValue},'%') )
</if>
<if test= "params.billCode != null and params.billCode != ''" >
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0' and FIND_IN_SET(`bill_code`,#{params.billCode}) )
</if>
<if test= "params.beginCreateTime != null and params.beginCreateTime != ''" >
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test= "params.endCreateTime != null and params.endCreateTime != ''" >
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test= "params.beginEtd != null and params.beginEtd != ''" >
and etd <![CDATA[ >= ]]> #{params.beginEtd}
</if>
<if test= "params.endEtd != null and params.endEtd != ''" >
and etd <![CDATA[ <= ]]> #{params.endEtd}
</if>
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
and (
start_site_code=#{params.privSiteCode}
or create_site=#{params.privSiteCode}
)
</if>
</where>
order by create_time desc
</select>
2025-03-16 03:11:39 +00:00
<!-- 查询待提成运单 -->
<select id= "selectWaitDoProfitList" parameterType= "EmisTmsSiteBatch" resultMap= "EmisTmsSiteBatchResult" >
SELECT
batch_no
FROM
emis_tms_site_batch a
2025-03-16 12:26:15 +00:00
WHERE a.del_flag = '0'
<if test= "params.noNeedBlProfit == null" >
AND a.bl_profit = '0'
</if>
2025-03-16 03:11:39 +00:00
<if test= "params.billMonth != null and params.billMonth != ''" >
and DATE_FORMAT(a.etd,'%Y%m')= #{params.billMonth}
</if>
ORDER BY a.etd DESC
</select>
2025-07-01 06:33:50 +00:00
<select id= "checkUnique" parameterType= "EmisTmsSiteBatch" resultType= "int" >
select count(1)
from emis_tms_site_batch
where del_flag = '0'
and batch_no != #{batchNo}
and start_site_code = #{startSiteCode}
and next_site_code = #{nextSiteCode}
and supplier_code=#{supplierCode}
2025-12-12 02:42:18 +00:00
<if test= "carNo != null and carNo != ''" >
and car_no = #{carNo}
</if>
2025-07-01 06:33:50 +00:00
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0'
and FIND_IN_SET(`bill_code`
, #{params.billCode}) )
limit 1
</select>
2024-06-03 05:55:23 +00:00
2024-03-01 06:47:57 +00:00
<select id= "selectEmisTmsSiteBatchById" parameterType= "Long" resultMap= "EmisTmsSiteBatchResult" >
2025-07-10 21:45:29 +00:00
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering
2024-03-01 06:47:57 +00:00
from emis_tms_site_batch a
where a.id = #{id}
</select>
2024-06-03 05:55:23 +00:00
2025-06-25 06:46:07 +00:00
<select id= "selectEmisTmsSiteBatchWithDetailsById" parameterType= "Long" resultMap= "EmisTmsSiteBatchWithDetailsResult" >
2025-07-10 21:45:29 +00:00
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering
2025-06-25 06:46:07 +00:00
from emis_tms_site_batch a
where a.id = #{id}
</select>
2025-06-17 09:17:32 +00:00
<select id= "selectTmsSiteBatchBySupplerAndCarNo" parameterType= "EmisTmsSiteBatch" resultMap= "EmisTmsSiteBatchResult" >
2025-07-10 21:45:29 +00:00
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering
2025-06-17 09:17:32 +00:00
from emis_tms_site_batch a
2025-07-21 07:18:52 +00:00
where a.del_flag='0'
and a.supplier_code = #{supplierCode}
and a.car_no = #{carNo}
2025-07-21 07:53:22 +00:00
<if test= "etd != null" >
2025-07-21 07:18:52 +00:00
and DATE_FORMAT(a.etd,'%Y%m%d')= DATE_FORMAT(#{etd},'%Y%m%d')
</if>
limit 3
2025-06-17 09:17:32 +00:00
</select>
2025-03-16 02:44:15 +00:00
<select id= "selectTmsSiteBatchByBatchNo" parameterType= "String" resultMap= "EmisTmsSiteBatchResult" >
2025-07-10 21:45:29 +00:00
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering
2025-03-16 02:44:15 +00:00
from emis_tms_site_batch a
where a.batch_no = #{batchNo}
2025-08-12 12:05:42 +00:00
limit 1
2025-03-16 02:44:15 +00:00
</select>
<!-- 打提成标识 -->
<update id= "updateHasDoProfit" parameterType= "String" >
update emis_tms_site_batch set
bl_profit = '1'
where batch_no=#{batchNo}
</update>
2025-04-01 02:41:37 +00:00
<!-- 更新录入状态 -->
<update id= "updateEnteringStatus" parameterType= "String" >
update emis_tms_site_batch set
bl_entering = '1'
where batch_no=#{batchNo}
</update>
2025-11-24 08:31:35 +00:00
<!-- 重置录入状态 -->
<update id= "resetEnteringStatus" parameterType= "String" >
update emis_tms_site_batch set
bl_entering = '0'
where batch_no=#{batchNo}
</update>
2024-06-03 05:55:23 +00:00
<insert id= "insertEmisTmsSiteBatch" parameterType= "EmisTmsSiteBatch" useGeneratedKeys= "true" keyProperty= "id" >
2024-03-01 06:47:57 +00:00
insert into emis_tms_site_batch
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2024-06-03 05:55:23 +00:00
<if test= "batchNo != null and batchNo != ''" > batch_no,</if>
2024-03-01 06:47:57 +00:00
<if test= "batchName != null and batchName != ''" > batch_name,</if>
2024-06-03 05:55:23 +00:00
<if test= "batchDate != null" > batch_date,</if>
2025-02-14 02:27:10 +00:00
<if test= "supplierCode != null and supplierCode != ''" > supplier_code,</if>
<if test= "supplierName != null and supplierName != ''" > supplier_name,</if>
2024-06-07 05:10:38 +00:00
<if test= "transLineType != null and transLineType != ''" > trans_line_type,</if>
<if test= "productType != null and productType != ''" > product_type,</if>
2024-06-03 05:55:23 +00:00
<if test= "batchType != null and batchType != ''" > batch_type,</if>
2024-03-01 06:47:57 +00:00
<if test= "transType != null and transType != ''" > trans_type,</if>
<if test= "startSiteCode != null and startSiteCode != ''" > start_site_code,</if>
2024-06-07 05:10:38 +00:00
<if test= "sendCountry != null and sendCountry != ''" > send_country,</if>
2024-03-01 06:47:57 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > next_site_code,</if>
<if test= "airBilllNo != null and airBilllNo != ''" > air_billl_no,</if>
2024-06-03 05:55:23 +00:00
<if test= "etd != null" > etd,</if>
<if test= "eta != null" > eta,</if>
2024-03-01 06:47:57 +00:00
<if test= "carNo != null and carNo != ''" > car_no,</if>
<if test= "shipNo != null and shipNo != ''" > ship_no,</if>
<if test= "clearanceResStatus != null and clearanceResStatus != ''" > clearance_res_status,</if>
<if test= "declareResStatus != null and declareResStatus != ''" > declare_res_status,</if>
2024-06-03 05:55:23 +00:00
<if test= "destCountry != null and destCountry != ''" > dest_country,</if>
<if test= "destCountryName != null and destCountryName != ''" > dest_country_name,</if>
2024-11-19 08:22:29 +00:00
<if test= "transWeight != null" > trans_weight,</if>
<if test= "packNum != null" > pack_num,</if>
2024-06-03 05:55:23 +00:00
<if test= "totalParcelQty != null" > total_parcel_qty,</if>
<if test= "totalWaybillQty != null" > total_waybill_qty,</if>
<if test= "totalVolume != null" > total_volume,</if>
<if test= "totalWeight != null" > total_weight,</if>
2025-07-10 21:45:29 +00:00
<if test= "totalSettlementWeight != null" > total_settlement_weight,</if>
2024-06-03 05:55:23 +00:00
<if test= "opMan != null and opMan != ''" > op_man,</if>
<if test= "remark != null and remark != ''" > remark,</if>
<if test= "tenantId != null and tenantId != ''" > tenant_id,</if>
2024-03-01 06:47:57 +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>
2024-06-03 05:55:23 +00:00
<if test= "createSite != null and createSite != ''" > create_site,</if>
<if test= "updateSite != null and updateSite != ''" > update_site,</if>
2025-07-10 21:45:29 +00:00
<if test= "blEntering != null and blEntering != ''" > bl_entering,</if>
2024-06-03 05:55:23 +00:00
</trim>
2024-03-01 06:47:57 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2024-06-03 05:55:23 +00:00
<if test= "batchNo != null and batchNo != ''" > #{batchNo},</if>
2024-03-01 06:47:57 +00:00
<if test= "batchName != null and batchName != ''" > #{batchName},</if>
2024-06-03 05:55:23 +00:00
<if test= "batchDate != null" > #{batchDate},</if>
2025-02-14 02:27:10 +00:00
<if test= "supplierCode != null and supplierCode != ''" > #{supplierCode},</if>
<if test= "supplierName != null and supplierName != ''" > #{supplierName},</if>
2024-06-07 05:10:38 +00:00
<if test= "transLineType != null and transLineType != ''" > #{transLineType},</if>
<if test= "productType != null and productType != ''" > #{productType},</if>
2024-06-03 05:55:23 +00:00
<if test= "batchType != null and batchType != ''" > #{batchType},</if>
2024-03-01 06:47:57 +00:00
<if test= "transType != null and transType != ''" > #{transType},</if>
<if test= "startSiteCode != null and startSiteCode != ''" > #{startSiteCode},</if>
2024-06-07 05:10:38 +00:00
<if test= "sendCountry != null and sendCountry != ''" > #{sendCountry},</if>
2024-03-01 06:47:57 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > #{nextSiteCode},</if>
<if test= "airBilllNo != null and airBilllNo != ''" > #{airBilllNo},</if>
2024-06-03 05:55:23 +00:00
<if test= "etd != null" > #{etd},</if>
<if test= "eta != null" > #{eta},</if>
2024-03-01 06:47:57 +00:00
<if test= "carNo != null and carNo != ''" > #{carNo},</if>
<if test= "shipNo != null and shipNo != ''" > #{shipNo},</if>
<if test= "clearanceResStatus != null and clearanceResStatus != ''" > #{clearanceResStatus},</if>
<if test= "declareResStatus != null and declareResStatus != ''" > #{declareResStatus},</if>
2024-06-03 05:55:23 +00:00
<if test= "destCountry != null and destCountry != ''" > #{destCountry},</if>
<if test= "destCountryName != null and destCountryName != ''" > #{destCountryName},</if>
2024-11-19 08:22:29 +00:00
<if test= "transWeight != null" > #{transWeight},</if>
<if test= "packNum != null" > #{packNum},</if>
2024-06-03 05:55:23 +00:00
<if test= "totalParcelQty != null" > #{totalParcelQty},</if>
<if test= "totalWaybillQty != null" > #{totalWaybillQty},</if>
<if test= "totalVolume != null" > #{totalVolume},</if>
<if test= "totalWeight != null" > #{totalWeight},</if>
2025-07-10 21:45:29 +00:00
<if test= "totalSettlementWeight != null" > #{totalSettlementWeight},</if>
2024-06-03 05:55:23 +00:00
<if test= "opMan != null and opMan != ''" > #{opMan},</if>
<if test= "remark != null and remark != ''" > #{remark},</if>
<if test= "tenantId != null and tenantId != ''" > #{tenantId},</if>
2024-03-01 06:47:57 +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>
2024-06-03 05:55:23 +00:00
<if test= "createSite != null and createSite != ''" > #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > #{updateSite},</if>
2025-07-10 21:45:29 +00:00
<if test= "blEntering != null and blEntering != ''" > #{blEntering},</if>
2024-06-03 05:55:23 +00:00
</trim>
2024-03-01 06:47:57 +00:00
</insert>
<update id= "updateEmisTmsSiteBatch" parameterType= "EmisTmsSiteBatch" >
update emis_tms_site_batch
<trim prefix= "SET" suffixOverrides= "," >
2024-06-03 05:55:23 +00:00
<if test= "batchNo != null and batchNo != ''" > batch_no = #{batchNo},</if>
2024-03-01 06:47:57 +00:00
<if test= "batchName != null and batchName != ''" > batch_name = #{batchName},</if>
2024-06-03 05:55:23 +00:00
<if test= "batchDate != null" > batch_date = #{batchDate},</if>
2025-02-14 02:27:10 +00:00
<if test= "supplierCode != null and supplierCode != ''" > supplier_code = #{supplierCode},</if>
<if test= "supplierName != null and supplierName != ''" > supplier_name = #{supplierName},</if>
2024-06-07 05:10:38 +00:00
<if test= "transLineType != null and transLineType != ''" > trans_line_type = #{transLineType},</if>
<if test= "productType != null and productType != ''" > product_type = #{productType},</if>
2024-06-03 05:55:23 +00:00
<if test= "batchType != null and batchType != ''" > batch_type = #{batchType},</if>
2024-03-01 06:47:57 +00:00
<if test= "transType != null and transType != ''" > trans_type = #{transType},</if>
<if test= "startSiteCode != null and startSiteCode != ''" > start_site_code = #{startSiteCode},</if>
2024-06-07 05:10:38 +00:00
<if test= "sendCountry != null and sendCountry != ''" > send_country = #{sendCountry},</if>
2024-03-01 06:47:57 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > next_site_code = #{nextSiteCode},</if>
<if test= "airBilllNo != null and airBilllNo != ''" > air_billl_no = #{airBilllNo},</if>
2024-06-03 05:55:23 +00:00
<if test= "etd != null" > etd = #{etd},</if>
<if test= "eta != null" > eta = #{eta},</if>
2024-03-01 06:47:57 +00:00
<if test= "carNo != null and carNo != ''" > car_no = #{carNo},</if>
<if test= "shipNo != null and shipNo != ''" > ship_no = #{shipNo},</if>
<if test= "clearanceResStatus != null and clearanceResStatus != ''" > clearance_res_status = #{clearanceResStatus},</if>
<if test= "declareResStatus != null and declareResStatus != ''" > declare_res_status = #{declareResStatus},</if>
2024-06-03 05:55:23 +00:00
<if test= "destCountry != null and destCountry != ''" > dest_country = #{destCountry},</if>
<if test= "destCountryName != null and destCountryName != ''" > dest_country_name = #{destCountryName},</if>
2024-11-19 08:22:29 +00:00
<if test= "transWeight != null" > trans_weight = #{transWeight},</if>
<if test= "packNum != null" > pack_num = #{packNum},</if>
2024-06-03 05:55:23 +00:00
<if test= "totalParcelQty != null" > total_parcel_qty = #{totalParcelQty},</if>
<if test= "totalWaybillQty != null" > total_waybill_qty = #{totalWaybillQty},</if>
<if test= "totalVolume != null" > total_volume = #{totalVolume},</if>
<if test= "totalWeight != null" > total_weight = #{totalWeight},</if>
2025-07-10 21:45:29 +00:00
<if test= "totalSettlementWeight != null" > total_settlement_weight = #{totalSettlementWeight},</if>
2024-06-03 05:55:23 +00:00
<if test= "opMan != null and opMan != ''" > op_man = #{opMan},</if>
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
<if test= "tenantId != null and tenantId != ''" > tenant_id = #{tenantId},</if>
2024-03-01 06:47:57 +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>
2024-06-03 05:55:23 +00:00
<if test= "createSite != null and createSite != ''" > create_site = #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
2025-07-10 21:45:29 +00:00
<if test= "blEntering != null and blEntering != ''" > bl_entering = #{blEntering},</if>
2024-03-01 06:47:57 +00:00
</trim>
where id = #{id}
</update>
<delete id= "deleteEmisTmsSiteBatchById" parameterType= "Long" >
2024-11-20 02:06:10 +00:00
update emis_tms_site_batch set del_flag='1' where id = #{id}
2024-03-01 06:47:57 +00:00
</delete>
<delete id= "deleteEmisTmsSiteBatchByIds" parameterType= "String" >
2024-11-20 02:06:10 +00:00
update emis_tms_site_batch set del_flag='1' where id in
2024-03-01 06:47:57 +00:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2025-05-09 09:32:01 +00:00
<!-- 根据运单号列表查询组批次信息 -->
2025-07-02 11:52:44 +00:00
<select id= "selectEmisTmsSiteBatchListByBillCodes" resultMap= "EmisTransPlanRuleSimpleResult" >
2025-08-20 08:22:34 +00:00
select distinct b.id, b.batch_no, b.supplier_code, b.trans_line_type, b.product_type, b.trans_type,
b.start_site_code, b.next_site_code, b.etd, d.bill_code,d.waybill_batch_status
2025-05-09 09:32:01 +00:00
from emis_tms_site_batch b
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
where d.bill_code in
<foreach collection= "billCodes" item= "billCode" open= "(" separator= "," close= ")" >
#{billCode}
</foreach>
and b.del_flag = '0'
and d.del_flag = '0'
</select>
2025-08-01 08:51:43 +00:00
<!-- 根据起始网点、下一网点和运单号查询TMS组批次 -->
<select id= "selectTmsSiteBatchBySiteAndBillCode" resultMap= "EmisTmsSiteBatchResult" >
2025-08-20 08:22:34 +00:00
select distinct b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time,
2025-08-01 08:51:43 +00:00
b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering,
2025-08-20 08:22:34 +00:00
CASE
2025-08-12 12:05:42 +00:00
WHEN COALESCE(MAX(d.batch_volume), 0) = 0 THEN COALESCE(w.total_volume, 0)
ELSE COALESCE(MAX(d.batch_volume), 0)
2025-08-08 07:40:25 +00:00
END as total_volume,
2025-08-20 08:22:34 +00:00
CASE
2025-08-12 12:05:42 +00:00
WHEN COALESCE(MAX(d.batch_parcel_qty), 0) = 0 THEN COALESCE(w.parcel_qty, 0)
ELSE COALESCE(MAX(d.batch_parcel_qty), 0)
2025-08-08 07:40:25 +00:00
END as total_parcel_qty,
2025-08-20 08:22:34 +00:00
CASE
2025-08-12 12:05:42 +00:00
WHEN COALESCE(MAX(d.batch_weight), 0) = 0 THEN COALESCE(w.bill_weight, 0)
ELSE COALESCE(MAX(d.batch_weight), 0)
2025-08-08 07:40:25 +00:00
END as total_weight
2025-08-01 08:51:43 +00:00
from emis_tms_site_batch b
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
2025-08-08 07:40:25 +00:00
left join emis_waybill w on d.bill_code = w.bill_code and w.del_flag = '0'
2025-08-01 08:51:43 +00:00
where b.start_site_code = #{startSiteCode}
and b.next_site_code = #{nextSiteCode}
and d.bill_code = #{billCode}
and b.del_flag = '0'
and d.del_flag = '0'
2025-12-08 08:40:00 +00:00
and d.waybill_batch_status != '2'
2025-08-01 08:51:43 +00:00
<if test= "id != null" > AND d.id != #{id}</if>
2025-08-20 08:22:34 +00:00
group by b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time,
2025-08-08 07:40:25 +00:00
b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering,
w.total_volume, w.parcel_qty, w.total_weight
2025-08-01 08:51:43 +00:00
</select>
2025-08-20 08:22:34 +00:00
</mapper>