This commit is contained in:
linfso 2024-04-30 23:36:01 +08:00
parent 70c55e091b
commit 1294ecde8f
6 changed files with 181 additions and 24 deletions

View File

@ -202,5 +202,6 @@
<orderEntry type="library" name="Maven: org.jasypt:jasypt:1.9.3" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.28" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.aviator:aviator:5.2.4" level="project" />
<orderEntry type="library" name="Maven: com.xdadan:emis-system:1.0.1" level="project" />
</component>
</module>

View File

@ -31,6 +31,12 @@
<artifactId>aviator</artifactId>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>com.xdadan</groupId>
<artifactId>emis-system</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -2,7 +2,7 @@
* @Project: emis
* @Title: EmisTmsScanRecord.java
* @author linfso
* @date 2024-04-30 14:46:25
* @date 2024-04-30 15:10:40
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> TMS扫描记录 实体类 </p>
@ -26,7 +26,7 @@ import lombok.Data;
* @ClassName EmisTmsScanRecord
* @Description TMS扫描记录
* @author linfso
* @date 2024-04-30 14:46:25
* @date 2024-04-30 15:10:40
*/
@Data
public class EmisTmsScanRecord extends BaseEntity
@ -50,11 +50,16 @@ public class EmisTmsScanRecord extends BaseEntity
/* 上下一站点人员电话 */
private String preOrNextManPhone;
/* 扫描时间 */
private String scanDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scanDate;
/* 扫描员代码 */
private String scanManCode;
/* 扫描员电话 */
private String scanManPhone;
/* 扫描员 */
private String scanMan;
/* 上下一站点人员 */
private String preOrNextMan;
/* 扫描站点 */
private String scanSite;
/* 扫描站点代码 */
@ -62,9 +67,9 @@ public class EmisTmsScanRecord extends BaseEntity
/* 扫描网点代码 */
private String scanSitePhone;
/* 扫描重量 */
private String scanWeight;
private BigDecimal scanWeight;
/* 重量 */
private String weight;
private BigDecimal weight;
/* 派件或取件人 */
private String dispatchOrSendMan;
/* 派件或取件人代码 */
@ -81,6 +86,8 @@ public class EmisTmsScanRecord extends BaseEntity
/* 签收站点代码 */
private String signSiteCode;
/* 录入人代码 */
private String recordMan;
/* 录入人代码 */
private String recordManCode;
/* 录入人电话 */
private String recordManPhone;

View File

@ -26,6 +26,7 @@ package com.xdadan.erp.emis.service;
import com.xdadan.erp.emis.service.IEmisWaybillFeeitemService;
import com.xdadan.erp.emis.service.IEmisWaybillService;
import com.xdadan.erp.emis.utils.WaybillHelper;
import com.xdadan.erp.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +34,7 @@ package com.xdadan.erp.emis.service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
@ -64,16 +66,25 @@ public class EmisBaseService {
protected EmisTransProductMapper emisTransProductMapper;
@Autowired
private EmisNotCalcAgingMapper emisNotCalcAgingMapper;
protected EmisNotCalcAgingMapper emisNotCalcAgingMapper;
@Autowired
private EmisQuotePriceMapper emisQuotePriceMapper;
protected EmisQuotePriceMapper emisQuotePriceMapper;
@Autowired
private EmisCustomerUserMapper emisCustomerUserMapper;
protected EmisCustomerUserMapper emisCustomerUserMapper;
@Autowired
EmisCustomerAddressMapper emisCustomerAddressMapper;
protected EmisCustomerAddressMapper emisCustomerAddressMapper;
@Autowired
protected EmisTmsScanRecordMapper emisTmsScanRecordMapper;
@Autowired
private EmisSiteMapper emisSiteMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
@ -84,6 +95,20 @@ public class EmisBaseService {
return SecurityUtils.getLoginUser().getUser();
}
public EmisSite getSiteByCode(String siteCode){
EmisSite querySite = new EmisSite();
querySite.setSiteCode(siteCode);
List<EmisSite> siteList=emisSiteMapper.selectEmisSiteList(querySite);
if(!CollectionUtils.isEmpty(siteList)){
return siteList.get(0);
}
return null;
}
public SysUser getEmisStaffByCode(String empCode){
return sysUserMapper.selectUserByUserName(empCode);
}
public List<ScanResultItem> checkCanScan(String scanType,Map<String,Object> scanDataItem){
@ -119,6 +144,103 @@ public class EmisBaseService {
return itemList;
}
/**
* 扫描操作
* @param scanType
* @param scanDataItem
* @return
*/
public List<ScanResultItem> doScan(String scanType,Map<String,Object> scanDataItem){
List<ScanResultItem> itemList = new ArrayList<>();
String billCode = (String)scanDataItem.get("billCode");
if(StringUtils.isEmpty(billCode)){
ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode);
scanResultItem.setResult("fail");
scanResultItem.setMessage("billCode为空");
itemList.add(scanResultItem);
return itemList;
}
// 开始检查数据
String[] billCodeArr = billCode.split(",");
String scanDateStr = (String)scanDataItem.get("scanDate");
String scanWeightStr = (String)scanDataItem.get("scanWeight");
String dispatchOrSendManCode = (String)scanDataItem.get("dispatchOrSendManCode");
Date scanDate = DateUtils.parseDate(scanDateStr);;
if(scanDate ==null){
scanDate = new Date();
}
double scanWeight = 0.0D;
if(!StringUtils.isEmpty(scanWeightStr)){
scanWeight= Double.valueOf(scanWeightStr);
}
for (String billCodeItem:billCodeArr) {
ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode);
// 检查区间
scanResultItem.setResult("success");
scanResultItem.setMessage("允许操作");
// 检查操作员
if(ScanType.ACCEPT.name().equals(scanType)){
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
emisTmsScanRecord.setBillCode(billCode);
emisTmsScanRecord.setScanType(scanType);
emisTmsScanRecord.setScanDate(scanDate);
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.setWeight(BigDecimal.valueOf(scanWeight));
emisTmsScanRecord.setDispatchOrSendManCode(dispatchOrSendManCode);
SysUser emUser=getEmisStaffByCode(dispatchOrSendManCode);
if(emUser!=null){
emisTmsScanRecord.setDispatchOrSendMan(emUser.getEmpName());
emisTmsScanRecord.setDispatchOrSendManPhone(emUser.getPhonenumber());
}
// emisTmsScanRecord.setSignDate(ObjectB.getSignDate());
// emisTmsScanRecord.setSignMan(ObjectB.getSignMan());
// emisTmsScanRecord.setSignSite(ObjectB.getSignSite());
// emisTmsScanRecord.setSignSiteCode(ObjectB.getSignSiteCode());
emisTmsScanRecord.setRecordMan(getCurrentUser().getEmpName());
emisTmsScanRecord.setRecordManCode(getCurrentUser().getEmpCode());
emisTmsScanRecord.setRecordManPhone(getCurrentUser().getPhonenumber());
emisTmsScanRecord.setRecordSiteCode(getCurrentUser().getOwnerSiteCode());
// emisTmsScanRecord.setTruckMan(ObjectB.getTruckMan());
// emisTmsScanRecord.setTruckCode(ObjectB.getTruckCode());
emisTmsScanRecord.setDataFrom("pc");
// emisTmsScanRecord.setPicUrl(ObjectB.getPicUrl());
emisTmsScanRecord.setStatus("1");
emisTmsScanRecord.preInsert();
emisTmsScanRecordMapper.insertEmisTmsScanRecord(emisTmsScanRecord);
}
itemList.add(scanResultItem);
}
return itemList;
}
/**
* 产生客户编码 规则: siteCode+ 000000

View File

@ -117,7 +117,13 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
scanResult.setScanType(scanInfo.getScanType());
scanResult.setOpType(scanInfo.getOpType());
List<ScanResultItem> resultList = new ArrayList<>();
if(scanInfo.getOpType()==1){
if(scanInfo.getOpType()==2){
for (Map<String,Object> item: scanInfo.getScanData()) {
List<ScanResultItem> itemCheckList=doScan(scanInfo.getScanType(),item);
resultList.addAll(itemCheckList);
}
}
else{
for (Map<String,Object> item: scanInfo.getScanData()) {
List<ScanResultItem> itemCheckList=checkCanScan(scanInfo.getScanType(),item);
resultList.addAll(itemCheckList);

View File

@ -16,6 +16,8 @@
<result property="scanDate" column="scan_date" />
<result property="scanManCode" column="scan_man_code" />
<result property="scanManPhone" column="scan_man_phone" />
<result property="scanMan" column="scan_man" />
<result property="preOrNextMan" column="pre_or_next_man" />
<result property="scanSite" column="scan_site" />
<result property="scanSiteCode" column="scan_site_code" />
<result property="scanSitePhone" column="scan_site_phone" />
@ -28,6 +30,7 @@
<result property="signMan" column="sign_man" />
<result property="signSite" column="sign_site" />
<result property="signSiteCode" column="sign_site_code" />
<result property="recordMan" column="record_man" />
<result property="recordManCode" column="record_man_code" />
<result property="recordManPhone" column="record_man_phone" />
<result property="recordSiteCode" column="record_site_code" />
@ -47,7 +50,7 @@
</resultMap>
<sql id="selectEmisTmsScanRecordVo">
select id, bill_code, 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_site, scan_site_code, scan_site_phone, scan_weight, weight, 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_code, record_man_phone, record_site_code, truck_man, truck_code, data_from, pic_url, 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, 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, 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, truck_man, truck_code, data_from, pic_url, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site from emis_tms_scan_record
</sql>
<select id="selectEmisTmsScanRecordList" parameterType="EmisTmsScanRecord" resultMap="EmisTmsScanRecordResult">
@ -61,14 +64,16 @@
<if test="preOrNextStationPhone != null and preOrNextStationPhone != ''"> and pre_or_next_station_phone like concat('%', #{preOrNextStationPhone}, '%')</if>
<if test="preOrNextManCode != null and preOrNextManCode != ''"> and pre_or_next_man_code like concat('%', #{preOrNextManCode}, '%')</if>
<if test="preOrNextManPhone != null and preOrNextManPhone != ''"> and pre_or_next_man_phone like concat('%', #{preOrNextManPhone}, '%')</if>
<if test="scanDate != null and scanDate != ''"> and scan_date like concat('%', #{scanDate}, '%')</if>
<if test="scanDate != null "> and scan_date like concat('%', #{scanDate}, '%')</if>
<if test="scanManCode != null and scanManCode != ''"> and scan_man_code like concat('%', #{scanManCode}, '%')</if>
<if test="scanManPhone != null and scanManPhone != ''"> and scan_man_phone like concat('%', #{scanManPhone}, '%')</if>
<if test="scanMan != null and scanMan != ''"> and scan_man like concat('%', #{scanMan}, '%')</if>
<if test="preOrNextMan != null and preOrNextMan != ''"> and pre_or_next_man like concat('%', #{preOrNextMan}, '%')</if>
<if test="scanSite != null and scanSite != ''"> and scan_site like concat('%', #{scanSite}, '%')</if>
<if test="scanSiteCode != null and scanSiteCode != ''"> and scan_site_code like concat('%', #{scanSiteCode}, '%')</if>
<if test="scanSitePhone != null and scanSitePhone != ''"> and scan_site_phone like concat('%', #{scanSitePhone}, '%')</if>
<if test="scanWeight != null and scanWeight != ''"> and scan_weight like concat('%', #{scanWeight}, '%')</if>
<if test="weight != null and weight != ''"> and weight like concat('%', #{weight}, '%')</if>
<if test="scanWeight != null "> and scan_weight like concat('%', #{scanWeight}, '%')</if>
<if test="weight != null "> and weight like concat('%', #{weight}, '%')</if>
<if test="dispatchOrSendMan != null and dispatchOrSendMan != ''"> and dispatch_or_send_man like concat('%', #{dispatchOrSendMan}, '%')</if>
<if test="dispatchOrSendManCode != null and dispatchOrSendManCode != ''"> and dispatch_or_send_man_code like concat('%', #{dispatchOrSendManCode}, '%')</if>
<if test="dispatchOrSendManPhone != null and dispatchOrSendManPhone != ''"> and dispatch_or_send_man_phone like concat('%', #{dispatchOrSendManPhone}, '%')</if>
@ -76,6 +81,7 @@
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
<if test="signSite != null and signSite != ''"> and sign_site like concat('%', #{signSite}, '%')</if>
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code like concat('%', #{signSiteCode}, '%')</if>
<if test="recordMan != null and recordMan != ''"> and record_man like concat('%', #{recordMan}, '%')</if>
<if test="recordManCode != null and recordManCode != ''"> and record_man_code like concat('%', #{recordManCode}, '%')</if>
<if test="recordManPhone != null and recordManPhone != ''"> and record_man_phone like concat('%', #{recordManPhone}, '%')</if>
<if test="recordSiteCode != null and recordSiteCode != ''"> and record_site_code like concat('%', #{recordSiteCode}, '%')</if>
@ -97,7 +103,7 @@
</select>
<select id="selectEmisTmsScanRecordById" parameterType="Long" resultMap="EmisTmsScanRecordResult">
select id, bill_code, 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_site, scan_site_code, scan_site_phone, scan_weight, weight, 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_code, record_man_phone, record_site_code, truck_man, truck_code, data_from, pic_url, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site
select id, bill_code, 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, 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, truck_man, truck_code, data_from, pic_url, status, del_flag, create_by, create_time, update_by, update_time, remark, update_site, create_site
from emis_tms_scan_record a
where a.id = #{id}
</select>
@ -113,14 +119,16 @@
<if test="preOrNextStationPhone != null and preOrNextStationPhone != ''">pre_or_next_station_phone,</if>
<if test="preOrNextManCode != null and preOrNextManCode != ''">pre_or_next_man_code,</if>
<if test="preOrNextManPhone != null and preOrNextManPhone != ''">pre_or_next_man_phone,</if>
<if test="scanDate != null and scanDate != ''">scan_date,</if>
<if test="scanDate != null">scan_date,</if>
<if test="scanManCode != null and scanManCode != ''">scan_man_code,</if>
<if test="scanManPhone != null and scanManPhone != ''">scan_man_phone,</if>
<if test="scanMan != null and scanMan != ''">scan_man,</if>
<if test="preOrNextMan != null and preOrNextMan != ''">pre_or_next_man,</if>
<if test="scanSite != null and scanSite != ''">scan_site,</if>
<if test="scanSiteCode != null and scanSiteCode != ''">scan_site_code,</if>
<if test="scanSitePhone != null and scanSitePhone != ''">scan_site_phone,</if>
<if test="scanWeight != null and scanWeight != ''">scan_weight,</if>
<if test="weight != null and weight != ''">weight,</if>
<if test="scanWeight != null">scan_weight,</if>
<if test="weight != null">weight,</if>
<if test="dispatchOrSendMan != null and dispatchOrSendMan != ''">dispatch_or_send_man,</if>
<if test="dispatchOrSendManCode != null and dispatchOrSendManCode != ''">dispatch_or_send_man_code,</if>
<if test="dispatchOrSendManPhone != null and dispatchOrSendManPhone != ''">dispatch_or_send_man_phone,</if>
@ -128,6 +136,7 @@
<if test="signMan != null and signMan != ''">sign_man,</if>
<if test="signSite != null and signSite != ''">sign_site,</if>
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code,</if>
<if test="recordMan != null and recordMan != ''">record_man,</if>
<if test="recordManCode != null and recordManCode != ''">record_man_code,</if>
<if test="recordManPhone != null and recordManPhone != ''">record_man_phone,</if>
<if test="recordSiteCode != null and recordSiteCode != ''">record_site_code,</if>
@ -154,14 +163,16 @@
<if test="preOrNextStationPhone != null and preOrNextStationPhone != ''">#{preOrNextStationPhone},</if>
<if test="preOrNextManCode != null and preOrNextManCode != ''">#{preOrNextManCode},</if>
<if test="preOrNextManPhone != null and preOrNextManPhone != ''">#{preOrNextManPhone},</if>
<if test="scanDate != null and scanDate != ''">#{scanDate},</if>
<if test="scanDate != null">#{scanDate},</if>
<if test="scanManCode != null and scanManCode != ''">#{scanManCode},</if>
<if test="scanManPhone != null and scanManPhone != ''">#{scanManPhone},</if>
<if test="scanMan != null and scanMan != ''">#{scanMan},</if>
<if test="preOrNextMan != null and preOrNextMan != ''">#{preOrNextMan},</if>
<if test="scanSite != null and scanSite != ''">#{scanSite},</if>
<if test="scanSiteCode != null and scanSiteCode != ''">#{scanSiteCode},</if>
<if test="scanSitePhone != null and scanSitePhone != ''">#{scanSitePhone},</if>
<if test="scanWeight != null and scanWeight != ''">#{scanWeight},</if>
<if test="weight != null and weight != ''">#{weight},</if>
<if test="scanWeight != null">#{scanWeight},</if>
<if test="weight != null">#{weight},</if>
<if test="dispatchOrSendMan != null and dispatchOrSendMan != ''">#{dispatchOrSendMan},</if>
<if test="dispatchOrSendManCode != null and dispatchOrSendManCode != ''">#{dispatchOrSendManCode},</if>
<if test="dispatchOrSendManPhone != null and dispatchOrSendManPhone != ''">#{dispatchOrSendManPhone},</if>
@ -169,6 +180,7 @@
<if test="signMan != null and signMan != ''">#{signMan},</if>
<if test="signSite != null and signSite != ''">#{signSite},</if>
<if test="signSiteCode != null and signSiteCode != ''">#{signSiteCode},</if>
<if test="recordMan != null and recordMan != ''">#{recordMan},</if>
<if test="recordManCode != null and recordManCode != ''">#{recordManCode},</if>
<if test="recordManPhone != null and recordManPhone != ''">#{recordManPhone},</if>
<if test="recordSiteCode != null and recordSiteCode != ''">#{recordSiteCode},</if>
@ -198,14 +210,16 @@
<if test="preOrNextStationPhone != null and preOrNextStationPhone != ''">pre_or_next_station_phone = #{preOrNextStationPhone},</if>
<if test="preOrNextManCode != null and preOrNextManCode != ''">pre_or_next_man_code = #{preOrNextManCode},</if>
<if test="preOrNextManPhone != null and preOrNextManPhone != ''">pre_or_next_man_phone = #{preOrNextManPhone},</if>
<if test="scanDate != null and scanDate != ''">scan_date = #{scanDate},</if>
<if test="scanDate != null">scan_date = #{scanDate},</if>
<if test="scanManCode != null and scanManCode != ''">scan_man_code = #{scanManCode},</if>
<if test="scanManPhone != null and scanManPhone != ''">scan_man_phone = #{scanManPhone},</if>
<if test="scanMan != null and scanMan != ''">scan_man = #{scanMan},</if>
<if test="preOrNextMan != null and preOrNextMan != ''">pre_or_next_man = #{preOrNextMan},</if>
<if test="scanSite != null and scanSite != ''">scan_site = #{scanSite},</if>
<if test="scanSiteCode != null and scanSiteCode != ''">scan_site_code = #{scanSiteCode},</if>
<if test="scanSitePhone != null and scanSitePhone != ''">scan_site_phone = #{scanSitePhone},</if>
<if test="scanWeight != null and scanWeight != ''">scan_weight = #{scanWeight},</if>
<if test="weight != null and weight != ''">weight = #{weight},</if>
<if test="scanWeight != null">scan_weight = #{scanWeight},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="dispatchOrSendMan != null and dispatchOrSendMan != ''">dispatch_or_send_man = #{dispatchOrSendMan},</if>
<if test="dispatchOrSendManCode != null and dispatchOrSendManCode != ''">dispatch_or_send_man_code = #{dispatchOrSendManCode},</if>
<if test="dispatchOrSendManPhone != null and dispatchOrSendManPhone != ''">dispatch_or_send_man_phone = #{dispatchOrSendManPhone},</if>
@ -213,6 +227,7 @@
<if test="signMan != null and signMan != ''">sign_man = #{signMan},</if>
<if test="signSite != null and signSite != ''">sign_site = #{signSite},</if>
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code = #{signSiteCode},</if>
<if test="recordMan != null and recordMan != ''">record_man = #{recordMan},</if>
<if test="recordManCode != null and recordManCode != ''">record_man_code = #{recordManCode},</if>
<if test="recordManPhone != null and recordManPhone != ''">record_man_phone = #{recordManPhone},</if>
<if test="recordSiteCode != null and recordSiteCode != ''">record_site_code = #{recordSiteCode},</if>