This commit is contained in:
linfso 2024-06-19 09:43:57 +08:00
parent 73dba9c1ca
commit 152231b267

View File

@ -168,46 +168,50 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// 开始检查数据 // 开始检查数据
String[] billCodeArr = billCodeInStr.split(","); String[] billCodeArr = billCodeInStr.split(",");
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);
// 检查 // 获取主单号
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);
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"扫描单号不能为空"); throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"运单号不存在");
// continue;
} }
// 已签收不允许扫描 // 已签收不允许扫描
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,"运单已签收");
// continue;
} }
// 重复扫描 // 重复扫描
// 同站点,同动作,同一天不允许重复扫描 // 同站点,同动作,同一天不允许重复扫描
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);
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+"]");
// continue; // continue;
} }
EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode);
// 返回数据 // 返回数据
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight()); scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
scanResultItem.getData().put("totalVolume",emisWaybill.getTotalVolume()); scanResultItem.getData().put("totalVolume",emisWaybill.getTotalVolume());
@ -287,7 +291,6 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
throw new EmisBizError(EmisBizErrorType.EXISTS,"运单已签收"); throw new EmisBizError(EmisBizErrorType.EXISTS,"运单已签收");
} }
EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode);
// 重复扫描 // 重复扫描
// 同站点,同动作,同一天不允许重复扫描 // 同站点,同动作,同一天不允许重复扫描
int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(scanBillCode,scanType,getCurrentUser().getOwnerSiteCode(),scanDate); int scanCnt=emisTmsScanRecordMapper.checkSiteScanUnique(scanBillCode,scanType,getCurrentUser().getOwnerSiteCode(),scanDate);
@ -300,11 +303,15 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
throw new EmisBizError(EmisBizErrorType.EXISTS,""+scanBillCode+"已["+scanTypeLabel+"]"); throw new EmisBizError(EmisBizErrorType.EXISTS,""+scanBillCode+"已["+scanTypeLabel+"]");
} }
// 生成扫描记录并填充公共数据 // 生成扫描记录并填充公共数据
EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord(); EmisTmsScanRecord emisTmsScanRecord=new EmisTmsScanRecord();
// 填充扫描单号 // 填充扫描单号
emisTmsScanRecord.setBillCode(scanBillCode); emisTmsScanRecord.setBillCode(scanBillCode);
EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode);
// 填充运单基础数据 // 填充运单基础数据
this.fillBillBaseData(emisTmsScanRecord,mainBillCode,emisWaybill); this.fillBillBaseData(emisTmsScanRecord,mainBillCode,emisWaybill);