From 4f4559efbe2d2f20f2c37d8582b74f0a558a54c7 Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期一, 30 一月 2023 22:10:51 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/bfasrs' into bfasrs --- src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java new file mode 100644 index 0000000..0c3f3ef --- /dev/null +++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java @@ -0,0 +1,50 @@ +package com.zy.asrs.service.impl; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.Cools; +import com.zy.asrs.entity.Mat; +import com.zy.asrs.mapper.LocRuleMapper; +import com.zy.asrs.entity.LocRule; +import com.zy.asrs.service.LocRuleService; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.zy.asrs.service.MatService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service("locRuleService") +public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService { + + @Autowired + private MatService matService; + + @Override + public LocRule find(String matnr, String batch) { + if (Cools.isEmpty(matnr)) { + return null; + } + Mat mat = matService.selectByMatnr(matnr); + if (Cools.isEmpty(mat)) { + return null; + } + LocRule locRule = null; + do { + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).eq("status", 1)); + if (null != locRule) { + break; + } + } while (false); + return locRule; + } +} -- Gitblit v1.9.1