Merge pull request 'develop' (#69) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/69
This commit is contained in:
heyu 2025-06-25 13:09:40 +08:00
commit ea0fd3749b
4 changed files with 45 additions and 1 deletions

View File

@ -113,7 +113,9 @@ public class EmisWaybillController extends EmisBaseController
*/
@GetMapping(value = "/getMasterEmisWaybills")
public TableDataInfo getMasterEmisWaybills(EmisWaybill emisWaybill){
startPage();
// startPage();
// 设置通用权限查询参数
// setPrivParams(emisWaybill);
emisWaybill.getParams().put("privSiteCode", getLoginUser().getUser().getOwnerSiteCode());
List<EmisWaybill> list = emisWaybillService.selectMasterEmisWaybills(emisWaybill);
return getDataTable(list);

View File

@ -166,4 +166,11 @@ public interface EmisTransPlanRuleMapper {
* @return 总数
*/
int countForAllScan(EmisTransPlanRule emisTransPlanRule);
/**
*
* @param emisTransPlanRule
* @return
*/
List<EmisTransPlanRule> checkTransPlanRule(EmisTransPlanRule emisTransPlanRule);
}

View File

@ -23,6 +23,7 @@ import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper;
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper;
import com.xdadan.erp.emis.mapper.EmisTransPlanRuleMapper;
import com.xdadan.erp.emis.service.EmisBaseService;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
@ -57,6 +58,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
@Autowired
RedissonService redissonService;
@Autowired
private EmisTransPlanRuleMapper emisTransPlanRuleMapper;
/**
* 查询一级网点TMS组批次
*
@ -133,9 +137,23 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
if (Objects.nonNull(emisWaybill) && StringUtil.isNotBlank(emisWaybill.getVirtualRemark())) {
throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已绑定虚拟单,无法录入批次");
}
checkTransPlanRule(oldSiteBatch, emisWaybill);
checkUnique(oldSiteBatch, billCode);
}
private void checkTransPlanRule(EmisTmsSiteBatch oldSiteBatch, EmisWaybill emisWaybill) throws EmisBizError {
EmisTransPlanRule emisTransPlanRule = new EmisTransPlanRule();
emisTransPlanRule.setStartSiteCode(oldSiteBatch.getStartSiteCode());
emisTransPlanRule.setNextSiteCode(oldSiteBatch.getNextSiteCode());
emisTransPlanRule.setSupplierCode(oldSiteBatch.getSupplierCode());
emisTransPlanRule.setLineCode(emisWaybill.getTransLineType());
emisTransPlanRule.setProductType(emisWaybill.getProductType());
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.checkTransPlanRule(emisTransPlanRule);
if (CollectionUtil.isEmpty(list)) {
throw new EmisBizError(EmisBizErrorType.FAIL, "组批次起始网点、下一网点、供应商与规则不匹配");
}
}
private void checkUnique(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError {
EmisTmsSiteBatch emisTmsSiteBatch = new EmisTmsSiteBatch();
emisTmsSiteBatch.setStartSiteCode(oldSiteBatch.getStartSiteCode());

View File

@ -61,6 +61,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by id desc
</select>
<select id="checkTransPlanRule" parameterType="EmisTransPlanRule" resultMap="EmisTransPlanRuleResult">
select r.*
from emis_trans_plan_rule r
<where>
r.del_flag = '0'
<if test="lineCode != null and lineCode != ''"> and r.line_code = #{lineCode}</if>
<if test="productType != null and productType != ''"> and ( FIND_IN_SET(#{productType},r.product_type) )</if>
<if test="startSiteCode != null and startSiteCode != ''"> and r.start_site_code = #{startSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and r.next_site_code = #{nextSiteCode}</if>
<if test="manager != null and manager != ''"> and r.manager = #{manager}</if>
<if test="supplierCode != null and supplierCode != ''"> and ( FIND_IN_SET(#{supplierCode},r.supplier_code) )</if>
<if test="startDate != null"> and r.start_date = #{startDate}</if>
<if test="endDate != null"> and r.end_date = #{endDate}</if>
</where>
order by id desc
</select>
<select id="selectRulesForAllScan" parameterType="EmisTransPlanRule" resultMap="EmisTransPlanRuleResult">
select r.id, r.line_code, r.product_type, r.start_site_code,r.next_site_code, s1.site_name as start_site_name,
s2.site_name as next_site_name,