This commit is contained in:
linfso 2024-06-18 15:15:28 +08:00
parent a4b3b1af11
commit 5d1e8b7f53
11 changed files with 193 additions and 114 deletions

View File

@ -73,7 +73,6 @@ public class EmisSiteAccountController extends EmisBaseController
setPrivParams(emisSiteAccount); setPrivParams(emisSiteAccount);
List<EmisSiteAccount> list = emisSiteAccountService.selectEmisSiteAccountList(emisSiteAccount); List<EmisSiteAccount> list = emisSiteAccountService.selectEmisSiteAccountList(emisSiteAccount);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -86,8 +86,6 @@ public class EmisWaybillAttachmentController extends EmisBaseController
} }
} }
List<EmisWaybillAttachment> list = emisWaybillAttachmentService.selectEmisWaybillAttachmentList(emisWaybillAttachment); List<EmisWaybillAttachment> list = emisWaybillAttachmentService.selectEmisWaybillAttachmentList(emisWaybillAttachment);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -35,10 +35,13 @@ public class EmisTmsScanRecord extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/* id */ /* id */
private Long id; private Long id;
/* 运单号 */ /* 扫描运单号 */
private String billCode; private String billCode;
/* 主单号 */
private String mainBillCode;
/* 订单号 */ /* 订单号 */
private String orderSn; private String orderSn;
/* 扫描类型: 收发到派签 */ /* 扫描类型: 收发到派签 */

View File

@ -118,5 +118,8 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
public int checkWaybillIsExists(@Param("billCode")String billCode); public int checkWaybillIsExists(@Param("billCode")String billCode);
public int checkWaybillIsSign(@Param("billCode")String billCode);
} }

View File

@ -156,6 +156,35 @@ public class EmisBaseService {
/**
* 判断获取主单号
* @param billCode
* @return
*/
public String getMainBillCode(String billCode){
// 判断是否是子单
String mainBillCode = "";
if(billCode.startsWith("T7080") && billCode.length()>14 ){
mainBillCode=billCode.substring(0,14);
}
else{
// 不是探路主单号是否
// 查询数据看下是否主单,如果不是则同样剔除4位
boolean isExists=checkWaybillIsExists(billCode);
if(isExists){
mainBillCode=billCode;
}else{
if(billCode.length()>5){
int len=billCode.length();
mainBillCode=billCode.substring(0,len-4);
}
}
}
return mainBillCode;
}
/** /**
@ -1205,12 +1234,26 @@ public class EmisBaseService {
} }
/**
* 检查运单是否存在
* @param billCode
* @return
*/
public boolean checkWaybillIsExists(String billCode){ public boolean checkWaybillIsExists(String billCode){
return emisWaybillMapper.checkWaybillIsExists(billCode)==1; return emisWaybillMapper.checkWaybillIsExists(billCode)==1;
} }
/**
* 检查是否签收
* @param billCode
* @return
*/
public boolean checkWaybillIsSign(String billCode){
return emisWaybillMapper.checkWaybillIsSign(billCode)==1;
}
/** /**
* 改变运单上站点 * 改变运单上站点
* @param billCode * @param billCode

View File

@ -31,6 +31,7 @@ import com.xdadan.erp.emis.domain.vo.scan.ScanResultItem;
import com.xdadan.erp.emis.mapper.*; import com.xdadan.erp.emis.mapper.*;
import com.xdadan.erp.emis.service.EmisBaseService; import com.xdadan.erp.emis.service.EmisBaseService;
import com.xdadan.erp.emis.utils.Kd100Helper; import com.xdadan.erp.emis.utils.Kd100Helper;
import com.xdadan.erp.emis.utils.WaybillHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -144,7 +145,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
public List<ScanResultItem> doScanCheck(String scanType,Map<String,Object> scanDataItem) throws EmisBizError { public List<ScanResultItem> doScanCheck(String scanType,Map<String,Object> scanDataItem) throws EmisBizError {
List<ScanResultItem> itemList = new ArrayList<>(); List<ScanResultItem> itemList = new ArrayList<>();
String billCodeInStr = (String)scanDataItem.get("billCode"); String billCodeInStr = MapUtils.getString(scanDataItem,"billCode",null);
if(StringUtils.isEmpty(billCodeInStr)){ if(StringUtils.isEmpty(billCodeInStr)){
ScanResultItem scanResultItem = new ScanResultItem(); ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCodeInStr); scanResultItem.setBillCode(billCodeInStr);
@ -152,13 +153,15 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
scanResultItem.setMessage("billCode为空"); scanResultItem.setMessage("billCode为空");
itemList.add(scanResultItem); itemList.add(scanResultItem);
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"扫描单号不能为空"); throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"扫描单号不能为空");
// return itemList;
} }
// 开始检查数据 // 开始检查数据
String scanDateStr = (String)scanDataItem.get("scanDate"); Date scanDate = null;
Date scanDate = DateUtils.parseDate(scanDateStr);; String scanDateStr = MapUtils.getString(scanDataItem,"scanDate",null);
if(!StringUtils.isEmpty(scanDateStr)){
scanDate = DateUtils.parseDate(scanDateStr);;
}
if(scanDate ==null){ if(scanDate ==null){
scanDate = new Date(); scanDate = new Date();
} }
@ -221,37 +224,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
return itemList; return itemList;
} }
/**
* 填充公共数据
* @param emisTmsScanRecord
* @param emisWaybill
*/
private void fillBillBaseData(EmisTmsScanRecord emisTmsScanRecord,EmisWaybill emisWaybill){
// 公共部分
emisTmsScanRecord.setBillCode(emisWaybill.getBillCode());
emisTmsScanRecord.setOrderSn(emisWaybill.getOrderSn());
emisTmsScanRecord.setWeight(emisWaybill.getBillWeight());
emisTmsScanRecord.setScanManCode(getCurrentUser().getEmpCode());
emisTmsScanRecord.setScanManPhone(getCurrentUser().getPhonenumber());
emisTmsScanRecord.setScanMan(getCurrentUser().getEmpName());
emisTmsScanRecord.setScanSite(getCurrentUser().getOwnerSiteName());
emisTmsScanRecord.setScanSiteCode(getCurrentUser().getOwnerSiteCode());
EmisSite scanSite=getSiteByCode(emisTmsScanRecord.getScanSiteCode());
if(scanSite!=null){
emisTmsScanRecord.setScanSitePhone(scanSite.getPhone());
}
emisTmsScanRecord.setRecordMan(getCurrentUser().getEmpName());
emisTmsScanRecord.setRecordManCode(getCurrentUser().getEmpCode());
emisTmsScanRecord.setRecordManPhone(getCurrentUser().getPhonenumber());
emisTmsScanRecord.setRecordSiteCode(getCurrentUser().getOwnerSiteCode());
emisTmsScanRecord.setDataFrom("pc");
emisTmsScanRecord.setStatus("1");
emisTmsScanRecord.preInsert();
}
/** /**
* 扫描操作 * 扫描操作
* @param scanType * @param scanType
@ -286,15 +259,19 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
} }
Date scanDate = DateUtils.parseDate(scanDateStr);; Date scanDate = DateUtils.parseDate(scanDateStr);;
for (String billCode:billCodeArr) { for (String scanBillCode:billCodeArr) {
// 返回结果 // 原始数据返回 // 返回原始数据返回
ScanResultItem scanResultItem = new ScanResultItem(); ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode); scanResultItem.setBillCode(scanBillCode);
scanResultItem.getData().putAll(scanDataItem); scanResultItem.getData().putAll(scanDataItem);
// 1.运单号不存在 // 获取主单号
EmisWaybill emisWaybill = getWaybillByBillCode(billCode); String mainBillCode=getMainBillCode(scanBillCode);
if(emisWaybill==null){
// 判断是主单还是子单
boolean isExists=checkWaybillIsExists(mainBillCode);
// 检查运单号是否存在
if(!isExists){
scanResultItem.setResult("fail"); scanResultItem.setResult("fail");
scanResultItem.setMessage("运单号不存在"); scanResultItem.setMessage("运单号不存在");
itemList.add(scanResultItem); itemList.add(scanResultItem);
@ -302,34 +279,43 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
} }
// 已签收不允许扫描 // 已签收不允许扫描
if("1".equals(emisWaybill.getBlSign())){ boolean isSign=checkWaybillIsSign(mainBillCode);
if(isSign){
scanResultItem.setResult("fail"); scanResultItem.setResult("fail");
scanResultItem.setMessage("已签收,不允许再次签收"); scanResultItem.setMessage("运单已签收");
itemList.add(scanResultItem); itemList.add(scanResultItem);
throw new EmisBizError(EmisBizErrorType.EXISTS,"已签收,不允许再扫描"); throw new EmisBizError(EmisBizErrorType.EXISTS,"运单已签收");
} }
// 2.重复扫描 EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode);
// 重复扫描
// 同站点,同动作,同一天不允许重复扫描 // 同站点,同动作,同一天不允许重复扫描
int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(billCode,scanType,getCurrentUser().getOwnerSiteCode(),scanDate); int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(scanBillCode,scanType,getCurrentUser().getOwnerSiteCode(),scanDate);
if(scanCnt>0){ if(scanCnt>0){
scanResultItem.setResult("fail"); scanResultItem.setResult("fail");
scanResultItem.setMessage("单号["+billCode+"]重复扫描"); scanResultItem.setMessage("单号["+scanBillCode+"]重复扫描");
itemList.add(scanResultItem); itemList.add(scanResultItem);
// T12312321已[转件扫描] // T12312321已[转件扫描]
String scanTypeLabel=DictUtils.getDictLabel("emis_scan_type",scanType); String scanTypeLabel=DictUtils.getDictLabel("emis_scan_type",scanType);
throw new EmisBizError(EmisBizErrorType.EXISTS,""+billCode+"已["+scanTypeLabel+"]"); throw new EmisBizError(EmisBizErrorType.EXISTS,""+scanBillCode+"已["+scanTypeLabel+"]");
} }
// 生成扫描记录并填充公共数据 // 生成扫描记录并填充公共数据
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord(); EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
this.fillBillBaseData(emisTmsScanRecord,emisWaybill); // 填充扫描单号
emisTmsScanRecord.setBillCode(scanBillCode);
// 填充运单基础数据
this.fillBillBaseData(emisTmsScanRecord,mainBillCode,emisWaybill);
// 扫描类型
emisTmsScanRecord.setScanType(scanType); emisTmsScanRecord.setScanType(scanType);
// 扫描时间
emisTmsScanRecord.setScanDate(scanDate); emisTmsScanRecord.setScanDate(scanDate);
// 填充特殊数据 // 填充特殊数据
this.fillScanDataByScanType(emisTmsScanRecord,mainBillCode,scanType,scanDataItem);
this.fillScanDataByScanType(emisTmsScanRecord,scanType,scanDataItem);
// 返回数据 // 返回数据
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight()); scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
@ -337,8 +323,8 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty()); scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty());
emisTmsScanRecordMapper.insertEmisTmsScanRecord(emisTmsScanRecord); emisTmsScanRecordMapper.insertEmisTmsScanRecord(emisTmsScanRecord);
// 修改运单状态 // 修改主运单状态
this.changeWaybillStatus(billCode,scanType); this.changeWaybillStatus(mainBillCode,scanType);
scanResultItem.setResult("success"); scanResultItem.setResult("success");
scanResultItem.setMessage("操作成功"); scanResultItem.setMessage("操作成功");
itemList.add(scanResultItem); itemList.add(scanResultItem);
@ -347,7 +333,47 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
return itemList; return itemList;
} }
public void fillScanDataByScanType(EmisTmsScanRecord emisTmsScanRecord, String scanType, Map<String,Object> scanDataItem) throws EmisBizError { /**
* 填充公共数据
* @param emisTmsScanRecord
* @param emisWaybill
*/
private void fillBillBaseData(EmisTmsScanRecord emisTmsScanRecord,String mainBillCode,EmisWaybill emisWaybill){
// 公共部分
emisTmsScanRecord.setMainBillCode(emisWaybill.getBillCode());
emisTmsScanRecord.setOrderSn(emisWaybill.getOrderSn());
emisTmsScanRecord.setWeight(emisWaybill.getBillWeight());
emisTmsScanRecord.setScanManCode(getCurrentUser().getEmpCode());
emisTmsScanRecord.setScanManPhone(getCurrentUser().getPhonenumber());
emisTmsScanRecord.setScanMan(getCurrentUser().getEmpName());
emisTmsScanRecord.setScanSite(getCurrentUser().getOwnerSiteName());
emisTmsScanRecord.setScanSiteCode(getCurrentUser().getOwnerSiteCode());
EmisSite scanSite=getSiteByCode(emisTmsScanRecord.getScanSiteCode());
if(scanSite!=null){
emisTmsScanRecord.setScanSitePhone(scanSite.getPhone());
}
emisTmsScanRecord.setRecordMan(getCurrentUser().getEmpName());
emisTmsScanRecord.setRecordManCode(getCurrentUser().getEmpCode());
emisTmsScanRecord.setRecordManPhone(getCurrentUser().getPhonenumber());
emisTmsScanRecord.setRecordSiteCode(getCurrentUser().getOwnerSiteCode());
emisTmsScanRecord.setDataFrom("pc");
emisTmsScanRecord.setStatus("1");
emisTmsScanRecord.preInsert();
}
/**
* 填充扫描特殊数据
* @param emisTmsScanRecord
* @param mainBillCode
* @param scanType
* @param scanDataItem
* @throws EmisBizError
*/
public void fillScanDataByScanType(EmisTmsScanRecord emisTmsScanRecord,String mainBillCode, String scanType, Map<String,Object> scanDataItem) throws EmisBizError {
// 揽收扫描 // 揽收扫描
if(ScanType.GOT.opCode.equals(scanType)){ if(ScanType.GOT.opCode.equals(scanType)){
@ -404,14 +430,6 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// 判断是否需要发寄件短信 // 判断是否需要发寄件短信
String billCode=emisTmsScanRecord.getBillCode(); String billCode=emisTmsScanRecord.getBillCode();
// 判断是否是子单
String mainBillCode = "";
if(billCode.startsWith("T7080") && billCode.length()>14 ){
mainBillCode=billCode.substring(0,14);
}else{
mainBillCode=billCode;
}
EmisWaybill waybill=getWaybillByBillCode(mainBillCode); EmisWaybill waybill=getWaybillByBillCode(mainBillCode);
if( "1".equals(waybill.getBlMessage()) ) { if( "1".equals(waybill.getBlMessage()) ) {
@ -543,15 +561,6 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
changeWaybillCurrentSite(emisTmsScanRecord.getBillCode(),emisTmsScanRecord.getScanSiteCode()); changeWaybillCurrentSite(emisTmsScanRecord.getBillCode(),emisTmsScanRecord.getScanSiteCode());
// 判断是否需要发寄件短信
String billCode=emisTmsScanRecord.getBillCode();
// 判断是否是子单
String mainBillCode = "";
if(billCode.startsWith("T7080") && billCode.length()>14 ){
mainBillCode=billCode.substring(0,14);
}else{
mainBillCode=billCode;
}
EmisWaybill waybill=getWaybillByBillCode(mainBillCode); EmisWaybill waybill=getWaybillByBillCode(mainBillCode);
if( "1".equals(waybill.getBlMessage()) ) { if( "1".equals(waybill.getBlMessage()) ) {

View File

@ -218,6 +218,9 @@ public class WaybillHelper {
public static void main(String[] args) { public static void main(String[] args) {
//1: 1.02 1.1 1.11 //1: 1.02 1.1 1.11
@ -263,10 +266,13 @@ public class WaybillHelper {
// System.out.println("包含不可见字符:" + c); // System.out.println("包含不可见字符:" + c);
// } // }
// } // }
//
String str="T123213\n1231232,"; // String str="T123213\n1231232,";
str=WaybillHelper.formatQueryValue(str); // str=WaybillHelper.formatQueryValue(str);
System.out.print(str); String billCode="SF9189239821389";
int len=billCode.length();
String mainBillCode=billCode.substring(0,len-4);
System.out.print(mainBillCode);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -74,7 +74,6 @@
and cur_money <![CDATA[ < ]]> watch_money and cur_money <![CDATA[ < ]]> watch_money
</if> </if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'"> <if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and ( and (
site_code in ( site_code in (

View File

@ -7,6 +7,7 @@
<resultMap type="EmisTmsScanRecord" id="BaseEmisTmsScanRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult"> <resultMap type="EmisTmsScanRecord" id="BaseEmisTmsScanRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="billCode" column="bill_code" /> <result property="billCode" column="bill_code" />
<result property="mainBillCode" column="main_bill_code" />
<result property="orderSn" column="order_sn" /> <result property="orderSn" column="order_sn" />
<result property="scanType" column="scan_type" /> <result property="scanType" column="scan_type" />
<result property="preOrNextStation" column="pre_or_next_station" /> <result property="preOrNextStation" column="pre_or_next_station" />
@ -52,7 +53,7 @@
<resultMap type="EmisTmsScanRecord" extends="BaseEmisTmsScanRecordResult" id="EmisTmsScanRecordResult" > <resultMap type="EmisTmsScanRecord" extends="BaseEmisTmsScanRecordResult" id="EmisTmsScanRecordResult" >
<association property="waybillDetail" <association property="waybillDetail"
column="bill_code" column="main_bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode" select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy" fetchType="lazy"
/> />
@ -84,37 +85,37 @@
<!-- 根据获取签收数量统计 --> <!-- 根据获取签收数量统计 -->
<select id="selectSignCountByBillCodeStr" parameterType="string" resultType="int"> <select id="selectSignCountByBillCodeStr" parameterType="string" resultType="int">
select count(DISTINCT bill_code) as sign_cnt from emis_tms_scan_record select count(DISTINCT main_bill_code) as sign_cnt from emis_tms_scan_record
where scan_type='50' and FIND_IN_SET(bill_code,#{billCodeStr}) where scan_type='50' and FIND_IN_SET(bill_code,#{billCodeStr})
</select> </select>
<!--获取扫描统计数据--> <!--获取扫描统计数据-->
<select id="queryScanStatList" parameterType="EmisTmsScanRecord" resultMap="ScanStatDataInfoResult"> <select id="queryScanStatList" parameterType="EmisTmsScanRecord" resultMap="ScanStatDataInfoResult">
select scan_site_code , select a.scan_site_code ,
count(DISTINCT bill_code) as scan_count, count(DISTINCT a.main_bill_code) as scan_count,
GROUP_CONCAT(DISTINCT bill_code) as bill_code_str GROUP_CONCAT(DISTINCT a.main_bill_code) as bill_code_str
from emis_tms_scan_record from emis_tms_scan_record a
where del_flag='0' where a.del_flag='0'
<if test="scanSiteCode != null and scanSiteCode != ''"> and scan_site_code=#{scanSiteCode}</if> <if test="scanSiteCode != null and scanSiteCode != ''"> and a.scan_site_code=#{scanSiteCode}</if>
<if test="scanType != null and scanType != ''"> and scan_type=#{scanType}</if> <if test="scanType != null and scanType != ''"> and a.scan_type=#{scanType}</if>
<if test="preOrNextStationCode != null and preOrNextStationCode != ''"> and pre_or_next_station_code=#{preOrNextStationCode}</if> <if test="preOrNextStationCode != null and preOrNextStationCode != ''"> and a.pre_or_next_station_code=#{preOrNextStationCode}</if>
<if test="scanManCode != null and scanManCode != ''"> and scan_man_code=#{scanManCode}</if> <if test="scanManCode != null and scanManCode != ''"> and a.scan_man_code=#{scanManCode}</if>
<if test="params.beginScanDate != null and params.beginScanDate != ''"> <if test="params.beginScanDate != null and params.beginScanDate != ''">
and scan_date <![CDATA[ >= ]]> #{params.beginScanDate} and a.scan_date <![CDATA[ >= ]]> #{params.beginScanDate}
</if> </if>
<if test="params.endScanDate != null and params.endScanDate != ''"> <if test="params.endScanDate != null and params.endScanDate != ''">
and scan_date <![CDATA[ <= ]]> #{params.endScanDate} and a.scan_date <![CDATA[ <= ]]> #{params.endScanDate}
</if> </if>
<if test="params.thisSiteScanType != null and params.thisSiteScanType !=''"> <if test="params.thisSiteScanType != null and params.thisSiteScanType !=''">
and scan_type=#{params.thisSiteScanType} and a.scan_type=#{params.thisSiteScanType}
</if> </if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'"> <if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and ( and (
scan_site_code in ( a.scan_site_code in (
SELECT t1.site_code FROM ( SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid := SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd #{params.privSiteCode} ) pd
@ -125,24 +126,24 @@
) )
</if> </if>
GROUP BY scan_site_code asc GROUP BY a.scan_site_code asc
</select> </select>
<!-- <if test="params.thisSiteCode != null and params.thisSiteCode !=''">-->
<!-- and scan_site_code=#{params.thisSiteCode}-->
<!-- </if>-->
<!-- <if test="params.thisSiteScanType != null and params.thisSiteScanType !=''">-->
<!-- and bill_code in(-->
<!-- select bill_code from emis_tms_scan_record where scan_site_code=#{params.thisSiteCode} and scan_type=#{params.thisSiteScanType}-->
<!-- )-->
<!-- </if>-->
<select id="queryScanStatRecordList" parameterType="EmisTmsScanRecord" resultMap="EmisTmsScanRecordResult"> <select id="queryScanStatRecordList" parameterType="EmisTmsScanRecord" resultMap="EmisTmsScanRecordResult">
select id, bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, status, del_flag, create_by, update_by, update_time, remark, update_site, create_site,max(create_time) as create_time select id, bill_code, main_bill_code, order_sn, scan_type,
pre_or_next_station, pre_or_next_station_code,
pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code,
scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone,
scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man,
dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man,
sign_site, sign_site_code, record_man, record_man_code, record_man_phone,
record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url,
public_trace_info, inner_trace_info, status, del_flag, create_by, create_time,
update_by, update_time, remark, update_site, create_site from emis_tms_scan_record
from emis_tms_scan_record a from emis_tms_scan_record a
where del_flag='0' where a.del_flag='0'
<if test="scanSiteCode != null and scanSiteCode != ''"> and scan_site_code=#{scanSiteCode}</if> <if test="scanSiteCode != null and scanSiteCode != ''"> and scan_site_code=#{scanSiteCode}</if>
<if test="scanType != null and scanType != ''"> and scan_type=#{scanType}</if> <if test="scanType != null and scanType != ''"> and scan_type=#{scanType}</if>
@ -171,7 +172,6 @@
and exists (select 1 from emis_waybill ewb where ewb.bl_sign != '1' and ewb.bill_code=a.bill_code) and exists (select 1 from emis_waybill ewb where ewb.bl_sign != '1' and ewb.bill_code=a.bill_code)
group by bill_code group by bill_code
@ -181,7 +181,7 @@
<!-- 获取订单最后一条扫描记录 --> <!-- 获取订单最后一条扫描记录 -->
<select id="selectLastRecordByBillCode" parameterType="string" resultMap="EmisTmsScanRecordResult"> <select id="selectLastRecordByBillCode" parameterType="string" resultMap="EmisTmsScanRecordResult">
select id, bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, status, del_flag, create_by, update_by, update_time, remark, update_site, create_site,max(create_time) as create_time select id, bill_code, main_bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, public_trace_info, inner_trace_info, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site
from emis_tms_scan_record a from emis_tms_scan_record a
where del_flag='0' and a.bill_code = #{billCode} where del_flag='0' and a.bill_code = #{billCode}
order by create_time desc limit 1 order by create_time desc limit 1
@ -205,7 +205,7 @@
<sql id="selectEmisTmsScanRecordVo"> <sql id="selectEmisTmsScanRecordVo">
select id, bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, public_trace_info, inner_trace_info, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site from emis_tms_scan_record select id, bill_code, main_bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, public_trace_info, inner_trace_info, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site
</sql> </sql>
@ -323,7 +323,7 @@
<!-- and params.queryType = 2--> <!-- and params.queryType = 2-->
<select id="selectEmisTmsScanRecordById" parameterType="Long" resultMap="EmisTmsScanRecordResult"> <select id="selectEmisTmsScanRecordById" parameterType="Long" resultMap="EmisTmsScanRecordResult">
select id, bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, public_trace_info, inner_trace_info, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site select id, bill_code, main_bill_code, order_sn, scan_type, pre_or_next_station, pre_or_next_station_code, pre_or_next_station_phone, pre_or_next_man_code, pre_or_next_man_phone, scan_date, scan_man_code, scan_man_phone, scan_man, pre_or_next_man, scan_site, scan_site_code, scan_site_phone, scan_weight, weight, dest_site_code, dest_code, dispatch_or_send_man, dispatch_or_send_man_code, dispatch_or_send_man_phone, sign_date, sign_man, sign_site, sign_site_code, record_man, record_man_code, record_man_phone, record_site_code, car_no, bag_no, truck_man, truck_code, data_from, pic_url, public_trace_info, inner_trace_info, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site
from emis_tms_scan_record a from emis_tms_scan_record a
where a.id = #{id} where a.id = #{id}
</select> </select>
@ -333,6 +333,7 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if> <if test="billCode != null and billCode != ''">bill_code,</if>
<if test="mainBillCode != null and mainBillCode != ''">main_bill_code,</if>
<if test="orderSn != null and orderSn != ''">order_sn,</if> <if test="orderSn != null and orderSn != ''">order_sn,</if>
<if test="scanType != null and scanType != ''">scan_type,</if> <if test="scanType != null and scanType != ''">scan_type,</if>
<if test="preOrNextStation != null and preOrNextStation != ''">pre_or_next_station,</if> <if test="preOrNextStation != null and preOrNextStation != ''">pre_or_next_station,</if>
@ -384,6 +385,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if> <if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="mainBillCode != null and mainBillCode != ''">#{mainBillCode},</if>
<if test="orderSn != null and orderSn != ''">#{orderSn},</if> <if test="orderSn != null and orderSn != ''">#{orderSn},</if>
<if test="scanType != null and scanType != ''">#{scanType},</if> <if test="scanType != null and scanType != ''">#{scanType},</if>
<if test="preOrNextStation != null and preOrNextStation != ''">#{preOrNextStation},</if> <if test="preOrNextStation != null and preOrNextStation != ''">#{preOrNextStation},</if>
@ -437,8 +439,6 @@
<update id="updateEmisTmsScanRecord" parameterType="EmisTmsScanRecord"> <update id="updateEmisTmsScanRecord" parameterType="EmisTmsScanRecord">
update emis_tms_scan_record update emis_tms_scan_record
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="orderSn != null and orderSn != ''">order_sn = #{orderSn},</if>
<if test="scanType != null and scanType != ''">scan_type = #{scanType},</if> <if test="scanType != null and scanType != ''">scan_type = #{scanType},</if>
<if test="preOrNextStation != null and preOrNextStation != ''">pre_or_next_station = #{preOrNextStation},</if> <if test="preOrNextStation != null and preOrNextStation != ''">pre_or_next_station = #{preOrNextStation},</if>
<if test="preOrNextStationCode != null and preOrNextStationCode != ''">pre_or_next_station_code = #{preOrNextStationCode},</if> <if test="preOrNextStationCode != null and preOrNextStationCode != ''">pre_or_next_station_code = #{preOrNextStationCode},</if>
@ -489,6 +489,7 @@
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteEmisTmsScanRecordById" parameterType="Long"> <delete id="deleteEmisTmsScanRecordById" parameterType="Long">
update emis_tms_scan_record set del_flag='1' where id = #{id} update emis_tms_scan_record set del_flag='1' where id = #{id}
</delete> </delete>

View File

@ -52,6 +52,19 @@
and create_time <![CDATA[ <= ]]> #{params.endCreateTime} and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if> </if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
create_site in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
)
</if>
</where> </where>
order by create_time desc order by create_time desc
</select> </select>

View File

@ -237,6 +237,11 @@
select count(1) as cnt from emis_waybill where bill_code=#{billCode} limit 1 select count(1) as cnt from emis_waybill where bill_code=#{billCode} limit 1
</select> </select>
<!-- 检查运单号是否签收 -->
<select id="checkWaybillIsSign" parameterType="String" resultType="int">
select count(1) as cnt from emis_waybill where bill_code=#{billCode} and bl_sign='1' limit 1
</select>
<select id="selectCommissionStatData" parameterType="String" resultType="map"> <select id="selectCommissionStatData" parameterType="String" resultType="map">
select waybill_status as waybillStatus,count(1) as cnt from emis_waybill select waybill_status as waybillStatus,count(1) as cnt from emis_waybill