This commit is contained in:
linfso 2024-06-21 10:10:36 +08:00
parent 50d4747106
commit e29794bc27
6 changed files with 72 additions and 12 deletions

View File

@ -98,4 +98,6 @@ public interface EmisTmsPackDtlMapper extends BaseMapper<EmisTmsPackDtl>
* @return * @return
*/ */
public int updateScanStatus(EmisTmsPackDtl emisTmsPackDtl); public int updateScanStatus(EmisTmsPackDtl emisTmsPackDtl);
public int deleteEmisTmsPackDtlByBillCode(String billCode);
} }

View File

@ -116,7 +116,11 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
// 转件登记 // 转件登记
public int updateTransferInfo(EmisWaybill emisWaybill); public int updateTransferInfo(EmisWaybill emisWaybill);
public int checkWaybillIsExists(@Param("billCode")String billCode,@Param("childSeqNo") String childSeqNo); // 检查子单是否存在
public int checkSubBillIsExists(@Param("billCode")String billCode,@Param("subNum") Integer subNum);
// 检查主单是否存在
public int checkWaybillIsExists(@Param("billCode")String billCode);
public int checkWaybillIsSign(@Param("billCode")String billCode); public int checkWaybillIsSign(@Param("billCode")String billCode);

View File

@ -173,6 +173,7 @@ public class EmisBaseService {
public String getMainBillCode(String billCode){ public String getMainBillCode(String billCode){
// 判断是否是子单 // 判断是否是子单
String mainBillCode = ""; String mainBillCode = "";
String subSeqNo="";
if(billCode.startsWith("T7080") && billCode.length()>14 ){ if(billCode.startsWith("T7080") && billCode.length()>14 ){
mainBillCode=billCode.substring(0,14); mainBillCode=billCode.substring(0,14);
} }
@ -1399,12 +1400,43 @@ public class EmisBaseService {
/** /**
* 检查运单是否存在 * 检查运单是否存在,包含子单检查
* @param billCode * @param billCode
* @return * @return
*/ */
public boolean checkWaybillIsExists(String billCode,Integer childNum){ public boolean checkWaybillIsExists(String billCode){
return emisWaybillMapper.checkWaybillIsExists(billCode)==1; // 判断是否是子单
String mainBillCode = "";
String subNumStr="";
if(billCode.startsWith("T7080") && billCode.length()>14 ){
mainBillCode=billCode.substring(0,14);
}
else{
// 不是探路主单号是否
// 查询数据看下是否主单,如果不是则同样剔除4位
boolean isExists=emisWaybillMapper.checkWaybillIsExists(billCode)==1;
if(isExists){
mainBillCode=billCode;
return true;
}else{
if(billCode.length()>4){
int len=billCode.length();
subNumStr=billCode.substring(len-4);
if(Integer.valueOf(subNumStr)<=0){
return false;
}
}
else{
return false;
}
}
}
Integer subNum=Integer.valueOf(subNumStr);
return emisWaybillMapper.checkSubBillIsExists(mainBillCode,subNum)==1;
} }

View File

@ -499,11 +499,8 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
scanResultItem.setBillCode(scanBillCode); scanResultItem.setBillCode(scanBillCode);
scanResultItem.getData().putAll(scanDataItem); scanResultItem.getData().putAll(scanDataItem);
// 获取主单号 // 判断单是否存在
String mainBillCode = getMainBillCode(scanBillCode); boolean isExists = checkWaybillIsExists(scanBillCode);
// 判断是主单还是子单
boolean isExists = checkWaybillIsExists(mainBillCode);
// 检查运单号是否存在 // 检查运单号是否存在
if (!isExists) { if (!isExists) {
scanResultItem.setResult("fail"); scanResultItem.setResult("fail");
@ -512,6 +509,8 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "运单不存在"); throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "运单不存在");
} }
// 获取主单号
String mainBillCode = getMainBillCode(scanBillCode);
// 已签收不允许扫描 // 已签收不允许扫描
boolean isSign = checkWaybillIsSign(mainBillCode); boolean isSign = checkWaybillIsSign(mainBillCode);
if (isSign) { if (isSign) {
@ -530,6 +529,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
throw new EmisBizError(EmisBizErrorType.EXISTS, "[" + scanBillCode + "]已组包"); throw new EmisBizError(EmisBizErrorType.EXISTS, "[" + scanBillCode + "]已组包");
} }
/
// 获取订单数据 // 获取订单数据
EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode); EmisWaybill emisWaybill = getWaybillByBillCode(mainBillCode);
// 如果是缅甸允许主单扫描,其他都不允许 // 如果是缅甸允许主单扫描,其他都不允许
@ -587,6 +587,9 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
scanResultItem.setResult("success"); scanResultItem.setResult("success");
scanResultItem.setMessage("操作成功"); scanResultItem.setMessage("操作成功");
itemList.add(scanResultItem); itemList.add(scanResultItem);
if(!countryMap.containsKey(emisWaybill.getReceiveCountry())) {
countryMap.put(emisWaybill.getReceiveCountry(), 1);
}
} }
// 更新合包总重量 // 更新合包总重量
@ -600,7 +603,12 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
emisTmsPack.setSendStiteCode(getCurrentUser().getOwnerSiteCode()); emisTmsPack.setSendStiteCode(getCurrentUser().getOwnerSiteCode());
emisTmsPack.setNextSiteCode(preOrNextStationCode); emisTmsPack.setNextSiteCode(preOrNextStationCode);
emisTmsPack.setPackDate(scanDate); emisTmsPack.setPackDate(scanDate);
emisTmsPack.setPackName(getCurrentUser().getOwnerSiteName()+"组包:"+packNo); emisTmsPack.setPackName("["+getCurrentUser().getOwnerSiteName()+"]组包:"+packNo);
if(countryMap.size()>1){
// 不同国家需要拆
emisTmsPack.setBlUnpack("1");
}
int eCnt=emisTmsPackMapper.checkUnique(emisTmsPack); int eCnt=emisTmsPackMapper.checkUnique(emisTmsPack);
if(eCnt>0){ if(eCnt>0){
@ -666,10 +674,11 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
itemList.add(scanResultItem); itemList.add(scanResultItem);
} }
// 更新合包为拆包状态 // 更新合包为拆包状态,整包拆包
EmisTmsPack emisTmsPack = new EmisTmsPack(); EmisTmsPack emisTmsPack = new EmisTmsPack();
emisTmsPack.setPackNo(packNo); emisTmsPack.setPackNo(packNo);
emisTmsPack.setPackStatus("2"); emisTmsPack.setPackStatus("2");
emisTmsPack.setTotalParcelQty(0);
emisTmsPackMapper.updateEmisTmsPack(emisTmsPack); emisTmsPackMapper.updateEmisTmsPack(emisTmsPack);

View File

@ -187,6 +187,7 @@
<if test="remark != null and remark != ''">remark = #{remark},</if> <if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if> <if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
</trim> </trim>
where bill_code = #{billCode} and pack_no = #{packNo} where bill_code = #{billCode} and pack_no = #{packNo}
</update> </update>
@ -201,4 +202,9 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteEmisTmsPackDtlByBillCode" parameterType="String">
update from emis_tms_pack_dtl where id = #{id}
</delete>
</mapper> </mapper>

View File

@ -232,7 +232,7 @@
group by waybill_status group by waybill_status
</select> </select>
<!-- 检查运单号及子单号是否存在 --> <!-- 检查主运单号是否存在 -->
<select id="checkWaybillIsExists" resultType="int"> <select id="checkWaybillIsExists" resultType="int">
select count(1) as cnt from emis_waybill select count(1) as cnt from emis_waybill
where bill_code=#{billCode} where bill_code=#{billCode}
@ -242,6 +242,13 @@
limit 1 limit 1
</select> </select>
<!-- 检查子单号是否存在 -->
<select id="checkSubBillIsExists" resultType="int">
select count(1) as cnt from emis_waybill
where bill_code=#{billCode} and bl_gen_subbill='1' and #{subNum} <![CDATA[ <= ]]> parcel_qty
limit 1
</select>
<!-- 检查运单号是否签收 --> <!-- 检查运单号是否签收 -->
<select id="checkWaybillIsSign" parameterType="String" resultType="int"> <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 count(1) as cnt from emis_waybill where bill_code=#{billCode} and bl_sign='1' limit 1