This commit is contained in:
linfso 2024-05-20 15:38:06 +08:00
parent 8d4f170c08
commit 9acc6fa9ab
3 changed files with 68 additions and 11 deletions

View File

@ -67,4 +67,7 @@ public interface EmisTmsScanRecordMapper extends BaseMapper<EmisTmsScanRecord>
* @return 结果
*/
public int deleteEmisTmsScanRecordByIds(Long[] ids);
public int checkSiteScanUnique(EmisTmsScanRecord emisTmsScanRecord);
}

View File

@ -131,6 +131,13 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
return itemList;
}
// 开始检查数据
String scanDateStr = (String)scanDataItem.get("scanDate");
Date scanDate = DateUtils.parseDate(scanDateStr);;
if(scanDate ==null){
scanDate = new Date();
}
// 开始检查数据
String[] billCodeArr = billCodeInStr.split(",");
for (String billCode:billCodeArr) {
@ -147,6 +154,36 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
}
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
// 公共部分
emisTmsScanRecord.setBillCode(billCode);
emisTmsScanRecord.setOrderSn(emisWaybill.getOrderSn());
emisTmsScanRecord.setWeight(emisWaybill.getBillWeight());
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());
}
// 重复扫描
int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(emisTmsScanRecord);
if(scanCnt>0){
scanResultItem.setResult("fail");
scanResultItem.setMessage("重复扫描");
itemList.add(scanResultItem);
continue;
}
scanResultItem.setResult("success");
scanResultItem.setMessage("允许操作");
@ -157,8 +194,6 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
return itemList;
}
/**
* 扫描操作
* @param scanType
@ -202,16 +237,15 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
continue;
}
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty());
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
// 公共部分
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
emisTmsScanRecord.setBillCode(billCode);
emisTmsScanRecord.setOrderSn(emisWaybill.getOrderSn());
emisTmsScanRecord.setWeight(emisWaybill.getBillWeight());
emisTmsScanRecord.setScanType(scanType);
emisTmsScanRecord.setScanDate(scanDate);
emisTmsScanRecord.setScanManCode(getCurrentUser().getEmpCode());
@ -225,6 +259,16 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
emisTmsScanRecord.setScanSitePhone(scanSite.getPhone());
}
// 重复扫描
// 同站点,同动作,同一天不允许重复扫描
int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(emisTmsScanRecord);
if(scanCnt>0){
scanResultItem.setResult("fail");
scanResultItem.setMessage("重复扫描");
itemList.add(scanResultItem);
continue;
}
// 原始数据返回
scanResultItem.getData().putAll(scanDataItem);

View File

@ -58,14 +58,24 @@
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, create_time, update_by, update_time, remark, update_site, create_site from emis_tms_scan_record
</sql>
<select id="checkSiteScanUnique" parameterType="EmisTmsScanRecord" resultType="int">
select count(1) from emis_tms_scan_record
where billCode = #{billCode} and scan_type=#{scanType}
and scan_site_code=#{scanSiteCode}
and to_days(scan_date) = to_days(#{scanDate})
limit 1
</select>
<select id="selectEmisTmsScanRecordList" parameterType="EmisTmsScanRecord" resultMap="EmisTmsScanRecordResult">
<include refid="selectEmisTmsScanRecordVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="billCode != null and billCode != '' " > and bill_code like concat(#{billCode}, '%')</if>
<if test="billCode != null and billCode != '' " > and bill_code=#{billCode}</if>
<if test="orderSn != null and orderSn != '' "> and order_sn like concat(#{orderSn}, '%')</if>
<if test="scanType != null and scanType != ''"> and scan_type like concat('%', #{scanType}, '%')</if>
<if test="scanType != null and scanType != ''"> and scan_type=#{scanType}</if>
<if test="preOrNextStation != null and preOrNextStation != ''"> and pre_or_next_station like concat('%', #{preOrNextStation}, '%')</if>
<if test="preOrNextStationCode != null and preOrNextStationCode != ''"> and pre_or_next_station_code like concat('%', #{preOrNextStationCode}, '%')</if>
<if test="preOrNextStationPhone != null and preOrNextStationPhone != ''"> and pre_or_next_station_phone like concat('%', #{preOrNextStationPhone}, '%')</if>
@ -77,7 +87,7 @@
<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="scanSiteCode != null and scanSiteCode != ''"> and scan_site_code=#{scanSiteCode}</if>
<if test="scanSitePhone != null and scanSitePhone != ''"> and scan_site_phone like concat('%', #{scanSitePhone}, '%')</if>
<if test="scanWeight != null "> and scan_weight like concat('%', #{scanWeight}, '%')</if>
<if test="weight != null "> and weight like concat('%', #{weight}, '%')</if>
@ -288,11 +298,11 @@
</update>
<delete id="deleteEmisTmsScanRecordById" parameterType="Long">
delete from emis_tms_scan_record where id = #{id}
update emis_tms_scan_record set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisTmsScanRecordByIds" parameterType="String">
delete from emis_tms_scan_record where id in
update emis_tms_scan_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>